Skip to content

Commit

Permalink
fix: paymaster approval error
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv committed Jun 17, 2024
1 parent 4813693 commit 2053736
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hooks/useApproveCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export function useApproveCallback(
}
}

const gasLimit = calculateGasMargin(estimatedGas)
const response = await (paymentToken?.address
? paymasterExecute(
paymentToken.address,
Expand All @@ -137,7 +136,9 @@ export function useApproveCallback(
to: token.address,
data: ERC20Interface.encodeFunctionData('approve', [spender, approvedAmount]),
},
gasLimit.toNumber(),
// increase x2 for approval only due to failed tx bcs of gasLimit
// for more detail: https://team-kyber.slack.com/archives/C048KKJ4TPW/p1718600494715929?thread_ts=1718267233.557269&cid=C048KKJ4TPW
estimatedGas.toNumber() * 2,
)
: tokenContract.approve(spender, approvedAmount, {
gasLimit: calculateGasMargin(estimatedGas),
Expand Down

0 comments on commit 2053736

Please sign in to comment.