Skip to content

Commit

Permalink
gas limits, approval fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brightiron committed Dec 21, 2024
1 parent 28c1808 commit 18a7af3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/views/Lending/Cooler/hooks/useConsolidateCooler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const useConsolidateCooler = () => {
toCoolerAddress,
loanIds,
{
gasLimit: loanIds.length <= 30 ? loanIds.length * 1000000 : 30000000,
gasLimit: loanIds.length <= 15 ? loanIds.length * 2000000 : 30000000,
},
);
const receipt = await cooler.wait();
Expand Down
19 changes: 10 additions & 9 deletions src/views/Lending/Cooler/positions/ConsolidateLoan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ export const ConsolidateLoans = ({
: selectedVersion === "v2"
? clearingHouseAddresses.v2
: clearingHouseAddresses.v3;
const duration = 90; // Standard duration for consolidated loans
const debtAddress = selectedClearingHouse.debtAddress;
const duration = 121; // Standard duration for consolidated loans
const debtAddress = clearingHouseAddresses.v3.debtAddress;

// Show button only if there are loans that can be consolidated
const showConsolidateButton = hasV1Loans || hasV2Loans || hasMultipleV3Loans;
Expand Down Expand Up @@ -184,8 +184,8 @@ export const ConsolidateLoans = ({
<>
<InfoNotification>
All existing open loans for this Cooler and Clearinghouse will be repaid and consolidated into a new
loan with a {duration} day duration. You must hold enough {selectedClearingHouse.debtAssetName} in your
wallet to cover the interest owed at consolidation.
loan with a {duration} day duration. You must hold enough {clearingHouseAddresses.v3.debtAssetName} in
your wallet to cover the interest owed at consolidation.
</InfoNotification>
<Box
display="flex"
Expand Down Expand Up @@ -227,7 +227,8 @@ export const ConsolidateLoans = ({
<Typography sx={{ fontSize: "15px", lineHeight: "21px" }}>Interest Owed At Consolidation</Typography>
<Box display="flex" flexDirection="column" textAlign="right">
<Typography sx={{ fontSize: "15px", lineHeight: "21px" }}>
{formatNumber(parseFloat(formatEther(totals.interest)), 4)} {selectedClearingHouse.debtAssetName}
{formatNumber(parseFloat(formatEther(totals.interest)), 4)}{" "}
{clearingHouseAddresses.v3.debtAssetName}
</Typography>
</Box>
</Box>
Expand Down Expand Up @@ -275,14 +276,14 @@ export const ConsolidateLoans = ({
</PrimaryButton>
) : (
<TokenAllowanceGuard
tokenAddressMap={{ [NetworkId.MAINNET]: selectedClearingHouse.debtAddress }}
tokenAddressMap={{ [NetworkId.MAINNET]: clearingHouseAddresses.v3.debtAddress }}
spenderAddressMap={COOLER_CONSOLIDATION_ADDRESSES}
isVertical
message={
<>Approve {selectedClearingHouse.debtAssetName} for Spending on the Consolidation Contract</>
<>Approve {clearingHouseAddresses.v3.debtAssetName} for Spending on the Consolidation Contract</>
}
spendAmount={allowances?.totalDebtWithFee}
approvalText={`Approve ${selectedClearingHouse.debtAssetName} for Spending`}
approvalText={`Approve ${clearingHouseAddresses.v3.debtAssetName} for Spending`}
>
<TokenAllowanceGuard
tokenAddressMap={GOHM_ADDRESSES}
Expand All @@ -307,7 +308,7 @@ export const ConsolidateLoans = ({
) : (
<PrimaryButton disabled fullWidth>
{insufficientCollateral
? `Insufficient ${selectedClearingHouse.debtAssetName} Balance`
? `Insufficient ${clearingHouseAddresses.v3.debtAssetName} Balance`
: "Select loans to consolidate"}
</PrimaryButton>
)}
Expand Down

0 comments on commit 18a7af3

Please sign in to comment.