我正在尝试创建一个nodejs套利机器人。我可以让我的机器人从主网网中获取对,但不能使用Goerli测试网获取Uniswap对。
例如,在mainnet上获取我使用的WETH/WBTC对:
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,
);
我从https://etherscan.io/address/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599获得wbtc地址
但是,如果我尝试使用Goerli测试网,我将使用https://goerli.etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f作为我的Uniswap工厂合同,https://goerli.etherscan.io/address/0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6用于wbtc的WETH & https://goerli.etherscan.io/address/0xe6d830937fa8db2ebd2c046c58f797a95550fa4e。
当我试图得到上面的一对时,我得到:
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'
}
}
有人能看出我哪里出了问题吗?或者在测试网上是否有用于测试Uniswap的合同地址列表?
谢谢
发布于 2022-08-10 15:35:04
只需为goerli网络设置钱包,转到app.uniswap.org,单击“池”和"+新建位置“--然后您可以看到可用的令牌--我看到ETH、UNI和WETH,您可以在”选择令牌“的底部‘管理令牌列表’。
我创造了一个UNI/WETH的位置来玩。使用部署参考https://docs.uniswap.org/protocol/reference/deployments中的地址,我可以在https://goerli.etherscan.io/address/0x1F98431c8aD98523631AE4a59f267346ea31F984#readContract上查询该池
返回池:
const poolAddress = '0x4d1892f15B03db24b55E73F9801826a56d6f0755';
发布于 2022-10-25 17:48:06
这个。Uniswap在Goerli上的合同地址是0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984
。
要在Goerli上找到令牌地址,您可以使用https://app.uniswap.org/#/swap连接钱包,在Goerli网络上使用您可以选择的令牌进行事务处理,事务成功后您可以在Goerli上获得合同地址。
发布于 2022-10-14 21:13:06
听起来答案被处理了。如果你真的需要更多的戈利,testETH - https://goerlifaucet.com/是炼金术士的水龙头,这是非常可靠的。
https://ethereum.stackexchange.com/questions/132880
复制相似问题