Skip to content

Commit

Permalink
fix approve allowance issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shan57blocks committed Nov 14, 2023
1 parent 706f706 commit 2f5b6a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/huma-widget/src/components/ApproveAllowanceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export function ApproveAllowanceModal({
const amountToIncrease = BigNumber.from(targetAllowanceAmount).sub(
currentAllowance ?? 0,
)

if (amountToIncrease.lte(0)) {
handleSuccess()
return
}

send({
contract: poolUnderlyingTokenContract!,
method: 'increaseAllowance',
Expand All @@ -94,6 +100,7 @@ export function ApproveAllowanceModal({
}, [
account,
allowanceAmount,
handleSuccess,
poolInfo.pool,
poolUnderlyingTokenContract,
provider,
Expand Down

0 comments on commit 2f5b6a4

Please sign in to comment.