addLiquidity() function reverts without any reason on local development instance of ganache, any ideas why this might be happening?
Some background:
- I have forked the UniswapV2Factory and UniswapV2Router02 and deployed on ganache.
- I have created 2 ERC20 tokens, and created a pair (via factory.createPair()) for them.
- Minted both ERC20 tokens to my address.
- I have approved token amounts to the router contract address (via erc20.approve() function)
This is how I am calling the addLiquidity Function
const blockNumber = await web3.eth.getBlockNumber();
const block = await web3.eth.getBlock(blockNumber);
const timestamp = block.timestamp + 300;
await router.addLiquidity(
ERC20_TOKEN_1_ADDRESS,
ERC20_TOKEN_2_ADDRESS,
web3.utils.toWei('1', 'ether'),
web3.utils.toWei('1', 'ether'),
web3.utils.toWei('0.001', 'ether'),
web3.utils.toWei('0.001', 'ether'),
OWNER_ADDRESS,
timestamp,
{ gas: 4000000 }
)