[Ethereum] Uniswap fork: remove liquidity error

blockchainerc-20go-ethereumuniswap

I am trying to fork uniswap. And I have a problem when liquidity is removed. Problem in UniswapERC20. I don't know what's wrong.

Step by step (repeatedly for Rinkeby and Ropsten):

  1. Copy Uniswap Factory and Router from etherscan

  2. Go to Remix

  3. Add this string for testnet in the factory contract:

    bytes32 public constant INIT_CODE_HASH = keccak256(abi.encodePacked(type(UniswapV2Pair).creationCode));

  4. Compile. Set feeToSetter address and deploy (save init code hash and Factory address)

  5. Set feeTo address

  6. Replace init code hash in the Router contract

  7. Compile. Set Factory and WETH addresses and deploy (save addresses)

  8. Replace addresses in the interface and start local server

  9. Work test:

  • Create pair: ok
  • Swaps: ok:
  • Add liquidity: ok
  • Remove part or all liquidity: fail (error -> UniswapV2: INVALID_SIGNATURE)

More info:

  • Etherscan Geth VM Trace Transaction:
    { "type": "CALL", "from": "0x57d49704f453cdd2b995280d9d7f557e42847d82", "to": "0x0b024ab7886e87dde36103d6f4a53e35456d5341", "value": "0x0", "gas": "0x2d6978", "gasUsed": "0x7460", "input": "0xded9382a000000000000000000000000d9ba894e0097f8cc2bbc9d24d308b98e36dc6d02000000000000000000000000000000000000000000000000000470de4df81f060000000000000000000000000000000000000000000000000016452ae3c6431a0000000000000000000000000000000000000000000000000000e07255bdf06900000000000000000000000057d49704f453cdd2b995280d9d7f557e42847d82000000000000000000000000000000000000000000000000000000005ffd5ee00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001c9f3cd9721b08bacde6ec671f9186f0e621990760d1b73009516a8db5f2403e5773b73eb0cddc9d288a1b2d5cef84d1c8f4475d5d90a33dc9615e81f982499281", "output": "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001c556e697377617056323a20494e56414c49445f5349474e415455524500000000", "error": "execution reverted", "time": "11.0239ms", "calls": [ { "type": "CALL", "from": "0x0b024ab7886e87dde36103d6f4a53e35456d5341", "to": "0xa5baae8372d14ee9394dace03cb53222db293aee", "value": "0x0", "gas": "0x2ca8bc", "gasUsed": "0x68ea", "input": "0xd505accf00000000000000000000000057d49704f453cdd2b995280d9d7f557e42847d820000000000000000000000000b024ab7886e87dde36103d6f4a53e35456d5341000000000000000000000000000000000000000000000000000470de4df81f06000000000000000000000000000000000000000000000000000000005ffd5ee0000000000000000000000000000000000000000000000000000000000000001c9f3cd9721b08bacde6ec671f9186f0e621990760d1b73009516a8db5f2403e5773b73eb0cddc9d288a1b2d5cef84d1c8f4475d5d90a33dc9615e81f982499281", "error": "execution reverted" } ] }
  • Transaction

Best Answer

Change you LP token name in file located at

/src/pages/RemoveLiquidity/index.ts

search for domain object:

const domain = {
      name: 'Spooky LP', // <= here place your LP token smart contract name
      version: '1',
      chainId,
      verifyingContract: pair.liquidityToken.address,
    }
Related Topic