Skip to content

Commit 6263c16

Browse files
committed
fix(Approve): 2x approval
1 parent 3e37180 commit 6263c16

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/components/Wallet/AddressButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const StyledAddressButton = styled.div`
5959
text-decoration: none;
6060
background: black;
6161
color: grey;
62-
margin-bottom: 0.2em;
62+
margin-bottom: 0em;
6363
&:hover {
6464
color: ${(props) => props.theme.color.white};
6565
}

src/hooks/transactions/useApprove.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useCallback } from 'react'
22
import { useWeb3React } from '@web3-react/core'
33
import { Operation } from '@/constants/index'
4-
import ethers from 'ethers'
4+
import ethers, { BigNumber } from 'ethers'
55
import ERC20 from '@primitivefi/contracts/artifacts/ERC20.json'
66
import { parseEther, formatEther, parseUnits } from 'ethers/lib/utils'
77

@@ -28,7 +28,7 @@ const approve = async (
2828
const erc20 = new ethers.Contract(tokenAddress, ERC20.abi, signer)
2929
tx = await erc20.approve(
3030
spender,
31-
parseUnits(amount.toString()).toString()
31+
BigNumber.from(parseUnits(amount)).mul(BigNumber.from('2')).toString()
3232
) // 0 gwei approval
3333
} else throw 'Approval Error'
3434
return tx

0 commit comments

Comments
 (0)