4

I am attempting to create a nodejs arbitrage bot. I can get my bot to fetch pairs from the mainnet but cannot fetch Uniswap pairs using the Goerli testnet.

For example, on the mainnet to get the WETH/WBTC pair I use:

const provider = new ethers.providers.InfuraProvider('mainnet', process.env.INFURA_KEY);

const wallet = new ethers.Wallet(privateKey, provider);

const uniswapFactory = new ethers.Contract(
  '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f',
  UniswapV2Factory.abi, wallet,
);

const wethAddress = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
const wbtcAddress = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'


const wbtcPairContract = new ethers.Contract(
  uniswapFactory.getPair(wethAddress, wbtcAddress),
  UniswapV2Pair.abi, wallet,
);

And I get the wbtc address from https://etherscan.io/address/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599

However, if I try and use the Goerli testnet I use https://goerli.etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f for my Uniswap factory contract, https://goerli.etherscan.io/address/0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6 for my WETH & https://goerli.etherscan.io/address/0xe6d830937fa8db2ebd2c046c58f797a95550fa4e for my wbtc.

When trying to get the pair for the above I get:

Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="getReserves()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.6.4)
    at Logger.makeError (/Users/random/GolandProjects/random/uni-sushi-flashloaner/node_modules/@ethersproject/logger/lib/index.js:233:21)
    at Logger.throwError (/Users/random/GolandProjects/random/uni-sushi-flashloaner/node_modules/@ethersproject/logger/lib/index.js:242:20)
    at Interface.decodeFunctionResult (/Users/random/GolandProjects/random/uni-sushi-flashloaner/node_modules/@ethersproject/abi/lib/interface.js:388:23)
    at Contract.<anonymous> (/Users/random/GolandProjects/random/uni-sushi-flashloaner/node_modules/@ethersproject/contracts/lib/index.js:395:56)
    at step (/Users/random/GolandProjects/random/uni-sushi-flashloaner/node_modules/@ethersproject/contracts/lib/index.js:48:23)
    at Object.next (/Users/random/GolandProjects/random/uni-sushi-flashloaner/node_modules/@ethersproject/contracts/lib/index.js:29:53)
    at fulfilled (/Users/random/GolandProjects/roger/uni-sushi-flashloaner/node_modules/@ethersproject/contracts/lib/index.js:20:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: null,
  code: 'CALL_EXCEPTION',
  method: 'getReserves()',
  data: '0x',
  errorArgs: null,
  errorName: null,
  errorSignature: null,
  address: Promise { '0x0000000000000000000000000000000000000000' },
  args: [],
  transaction: {
    data: '0x0902f1ac',
    to: '0x0000000000000000000000000000000000000000',
    from: '0x4Aec689A464ba3676Eb04ec1c7278819CB9B8521'
  }
}

Can anyone see where I am going wrong? Or is there a list of contract addresses to use on the testnets for testing Uniswap?

Thanks

3
  • Maybe that specific pair simply doesnt exist?
    – Foxxxey
    Aug 2, 2022 at 20:31
  • @Foxxxey is there a way to find pairs on the testnet?
    – pocockn
    Aug 3, 2022 at 9:01
  • did you get an answer that works? I don't get it.
    – Suisse
    Jun 23 at 22:38

3 Answers 3

6

Just set your wallet for goerli network, go to app.uniswap.org, click "Pool" and "+ New Position" - then you can see the available tokens - I see ETH, UNI and WETH and you can 'Manage Token Lists' at the bottom of "select a token".

I created a UNI/WETH position to play with. Using addresses from the deployments reference https://docs.uniswap.org/protocol/reference/deployments I can query for that pool at https://goerli.etherscan.io/address/0x1F98431c8aD98523631AE4a59f267346ea31F984#readContract

  1. getPool
    0x1f9840a85d5af5bf1d1762f925bdaddc4201f984 <-- UNI token and UniswapV3Factory
    0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6 <-- WETH token
    3000 <-- fee ?

returns the pool:
const poolAddress = '0x4d1892f15B03db24b55E73F9801826a56d6f0755';

1
  • 1
    is there no list of the addresses of the tokens? I don't get it, why do I have first to do a transaction?
    – Suisse
    Jun 23 at 22:38
5

the. Uniswap contract address on Goerli is 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984.

To find a token address on Goerli, you most go https://app.uniswap.org/#/swap, connect you wallet on Goerli network does a transaction with token that you get to choose, after transaction success you can get contract address on Goerli. enter image description here

1
2

Sounds like the answer got handled. If you do need more Goerli testETH - https://goerlifaucet.com/ is Alchemy's faucet that's really reliable.

Your Answer

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

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