1

I have the project of making some educational content on the history of AMMs and to do so I’m trying to interact with Uniswap V1 contracts on Goerli. I’m quite new to all that (this exercise is also an opportunity for me to learn), so my apologies if you see rookie mistakes :)

What I’m trying to do is:

  1. Create a new Token on Goerli
  2. Create a Uniswap V1 pool to swap between this token and ETH
  3. Add some liquidity to that pool.

  I managed to the first 2:  

Note: the pool TOTO / ETH has been created by calling the createExchange function of the Uniswap V1 factory contract here: https://goerli.etherscan.io/address/0x6ce570d02d73d4c384b46135e87f8c592a8c86da#writeContract

My first issue is that I didn’t manage in Etherscan to Verify & Publish the pool’s contract (it’s in Vyper, maybe this doesn’t help), hence I cannot interact directly with the contract in Etherscan. So now I’m trying to interact with the pool contract using Remix IDE.

To do so, I first created a .ABI file in Remix with the ABI of the TOTO / ETH pool. To find the ABI, I used the one here, since the factory contract of Uniswap V1 seems to be using this template to create new pools: https://goerli.etherscan.io/address/0xf9555870C0575A4ECB47cB1587bCA162A3076d7F#code

enter image description here

enter image description here

I managed to load the ABI in Remix, but when I tried calling the addLiquidity function with these parameters:

  • min_liquidity: 0
  • max_tokens: 500000
  • deadline: 1695139366 (I generate a timestamp in the future on the website unixtimestamp dot com

And sending 1000000000000 wei in the "VALUE" field (since it’s a payable function)   I get this message:    

enter image description here   I try sending the transaction, it gets mined in a block but the execution fails:

  https://goerli.etherscan.io/tx/0xe825c8aadceb952643b4666ebb9ff22990071a9a592dd63fb83c485cfb99d856  

 

If anyone can either:

  • Help me make that work
  • Or help me verify & publish the TOTO / ETH contract on Etherscan
  • Or both :)

I would be very grateful since I’m struggling with this for a while now.

Cheers!

3
  • you have insufficient allowance: dashboard.tenderly.co/tx/goerli/…
    – kfx
    Commented Sep 18, 2023 at 19:25
  • Thanks for the reply. but I do not understand: using remix, I try to add liquidity by calling the contract using this address: 0x703657253bbe9c887b27422cf9d36d45aee5a8dd for which I did previously set the allowance to 5000000000000000000 on the token I'm trying to add liquidity for (0xdf3c316d3ae3a24c548458d5c847740cba553753)
    – toto_story
    Commented Sep 19, 2023 at 19:34
  • 1
    I found the solution, I needed to call the approve method of the token with the address of the pool as a parameter. I then managed to add liquidity to the pool. Thanks again!
    – toto_story
    Commented Sep 20, 2023 at 19:42

1 Answer 1

1

I found the solution, I needed to call the approve method of the token with the address of the pool as a parameter. I then managed to add liquidity to the pool. Thanks again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.