From 20537361ec33ad1f37fa783793739778fc503587 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Mon, 17 Jun 2024 12:09:47 +0700 Subject: [PATCH] fix: paymaster approval error --- src/hooks/useApproveCallback.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hooks/useApproveCallback.ts b/src/hooks/useApproveCallback.ts index 98aabce4dc..bb4ba92ba4 100644 --- a/src/hooks/useApproveCallback.ts +++ b/src/hooks/useApproveCallback.ts @@ -128,7 +128,6 @@ export function useApproveCallback( } } - const gasLimit = calculateGasMargin(estimatedGas) const response = await (paymentToken?.address ? paymasterExecute( paymentToken.address, @@ -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),