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