From 9cf33e8bbf22285cb87157e4d12868b7c91a30b5 Mon Sep 17 00:00:00 2001 From: brightiron <95196612+brightiron@users.noreply.github.com> Date: Wed, 18 Oct 2023 21:02:54 -0400 Subject: [PATCH] cooler gas limit to 1M (#3011) --- src/views/Lending/Cooler/hooks/useCreateLoan.tsx | 5 ++++- src/views/Lending/Cooler/hooks/useExtendLoan.tsx | 5 ++++- src/views/Lending/Cooler/hooks/useRepayLoan.tsx | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/views/Lending/Cooler/hooks/useCreateLoan.tsx b/src/views/Lending/Cooler/hooks/useCreateLoan.tsx index fe733873c7..894e868f15 100644 --- a/src/views/Lending/Cooler/hooks/useCreateLoan.tsx +++ b/src/views/Lending/Cooler/hooks/useCreateLoan.tsx @@ -1,4 +1,5 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; +import { BigNumber } from "ethers"; import toast from "react-hot-toast"; import { DecimalBigNumber } from "src/helpers/DecimalBigNumber/DecimalBigNumber"; import { balanceQueryKey } from "src/hooks/useBalance"; @@ -22,7 +23,9 @@ export const useCreateLoan = () => { }) => { if (!signer) throw new Error(`Please connect a wallet`); const contract = CoolerClearingHouse__factory.connect(clearingHouseAddress, signer); - const loan = await contract.lendToCooler(coolerAddress, borrowAmount.toBigNumber(18)); + const loan = await contract.lendToCooler(coolerAddress, borrowAmount.toBigNumber(18), { + gasLimit: BigNumber.from("1000000"), + }); const receipt = await loan.wait(); return receipt; }, diff --git a/src/views/Lending/Cooler/hooks/useExtendLoan.tsx b/src/views/Lending/Cooler/hooks/useExtendLoan.tsx index 0dabc2187d..e6ad1b4ed6 100644 --- a/src/views/Lending/Cooler/hooks/useExtendLoan.tsx +++ b/src/views/Lending/Cooler/hooks/useExtendLoan.tsx @@ -1,4 +1,5 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; +import { BigNumber } from "ethers"; import toast from "react-hot-toast"; import { balanceQueryKey } from "src/hooks/useBalance"; import { contractAllowanceQueryKey } from "src/hooks/useContractAllowance"; @@ -23,7 +24,9 @@ export const useExtendLoan = () => { }) => { if (!signer) throw new Error(`Please connect a wallet`); const contract = CoolerClearingHouse__factory.connect(clearingHouseAddress, signer); - const loan = await contract.extendLoan(coolerAddress, loanId, times); + const loan = await contract.extendLoan(coolerAddress, loanId, times, { + gasLimit: BigNumber.from("1000000"), + }); const receipt = await loan.wait(); return receipt; }, diff --git a/src/views/Lending/Cooler/hooks/useRepayLoan.tsx b/src/views/Lending/Cooler/hooks/useRepayLoan.tsx index 677485c694..3f467c41d7 100644 --- a/src/views/Lending/Cooler/hooks/useRepayLoan.tsx +++ b/src/views/Lending/Cooler/hooks/useRepayLoan.tsx @@ -1,4 +1,5 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; +import { BigNumber } from "ethers"; import toast from "react-hot-toast"; import { DecimalBigNumber } from "src/helpers/DecimalBigNumber/DecimalBigNumber"; import { balanceQueryKey } from "src/hooks/useBalance"; @@ -15,7 +16,9 @@ export const useRepayLoan = () => { if (!signer) throw new Error(`Please connect a wallet`); const coolerContract = Cooler__factory.connect(coolerAddress, signer); - const loan = await coolerContract.repayLoan(loanId, amount.toBigNumber(18)); + const loan = await coolerContract.repayLoan(loanId, amount.toBigNumber(18), { + gasLimit: BigNumber.from("1000000"), + }); const receipt = await loan.wait(); return receipt; },