Get LP pair address after addLiqudityETH

I am programmatically trying to add token1/ETH liquidity to uniswap.

I have the following code snippet working on my ganache.

await token1.approve(router.address, token_1_amt);

await router.addLiquidityETH(
  Math.floor( / 1000) + 60 * 10}

Which I can see creates a transaction and if I use await web3.eth.getPastLogs()
on truffle console I can see LP token address. How can I obtain the LP contract address from this code snippet so I can store it as a variable?

Hi, welcome! :wave:

Actually, you can calculate the pair address, have a look at the code in the sushiswap, they have a similar function.

Thanks, got it woking!

1 Like