From 5fafb5b390534474d19f48ab4eac560d716cd45e Mon Sep 17 00:00:00 2001 From: Luis Camargo Date: Tue, 3 Oct 2023 18:57:09 -0600 Subject: [PATCH] feat: add buffer to approvals --- src/components/transaction-modal/index.tsx | 2 +- src/views/issuance/components/issue/CollateralApprovals.tsx | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/transaction-modal/index.tsx b/src/components/transaction-modal/index.tsx index 43fb17894..9f7bd0d15 100644 --- a/src/components/transaction-modal/index.tsx +++ b/src/components/transaction-modal/index.tsx @@ -33,7 +33,7 @@ const Approval = ({ address: token, abi: ERC20, functionName: 'approve', - args: [spender, amount], + args: [spender, (amount * 120n) / 100n], }) const checkingAllowance = !gas.isLoading && !gas.estimateUsd diff --git a/src/views/issuance/components/issue/CollateralApprovals.tsx b/src/views/issuance/components/issue/CollateralApprovals.tsx index 6ae3fdc7e..07cf0df6b 100644 --- a/src/views/issuance/components/issue/CollateralApprovals.tsx +++ b/src/views/issuance/components/issue/CollateralApprovals.tsx @@ -38,7 +38,11 @@ const CollateralApproval = ({ functionName: 'approve', args: [ rToken?.main ? rToken.address : RSV_MANAGER, - collateral.symbol === 'wcUSDCv3' ? BIGINT_MAX : amount ?? 0n, + collateral.symbol === 'wcUSDCv3' + ? BIGINT_MAX + : amount + ? (amount * 120n) / 100n + : 0n, ], enabled: !loading && !!amount && !allowance, })