DPI_Arb_Bot_Example
DPI_Arb_Bot_Example copied to clipboard
Fixed KNC-ETH pool bug
The uniswap v2 sdk returns the incorrect KNC-ETH pool address (seems to be a known bug: https://ethereum.stackexchange.com/questions/98011/uniswap-js-sdk-returns-invalid-pair-address-for-two-erc20-tokens-in-hardhat-netw), which results in the following revert exception:
Error: call revert exception (method="getReserves()", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.4)
at Logger.makeError (/home/samlaf/dev/bots/DPI_Arb_Bot_Example/node_modules/@ethersproject/logger/lib/index.js:179:21)
at Logger.throwError (/home/samlaf/dev/bots/DPI_Arb_Bot_Example/node_modules/@ethersproject/logger/lib/index.js:188:20)
at Interface.decodeFunctionResult (/home/samlaf/dev/bots/DPI_Arb_Bot_Example/node_modules/@ethersproject/contracts/node_modules/@ethersproject/abi/lib/interface.js:286:23)
at Contract.<anonymous> (/home/samlaf/dev/bots/DPI_Arb_Bot_Example/node_modules/@ethersproject/contracts/lib/index.js:300:56)
at step (/home/samlaf/dev/bots/DPI_Arb_Bot_Example/node_modules/@ethersproject/contracts/lib/index.js:46:23)
at Object.next (/home/samlaf/dev/bots/DPI_Arb_Bot_Example/node_modules/@ethersproject/contracts/lib/index.js:27:53)
at fulfilled (/home/samlaf/dev/bots/DPI_Arb_Bot_Example/node_modules/@ethersproject/contracts/lib/index.js:18:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
reason: null,
code: 'CALL_EXCEPTION',
method: 'getReserves()',
errorSignature: null,
errorArgs: [ null ],
address: '0x1db6A673102dc8af48fDF73fD3dAf9D784B47de7',
args: [],
transaction: {
data: '0x0902f1ac',
to: '0x1db6A673102dc8af48fDF73fD3dAf9D784B47de7'
}
}
So I hardcoded the correct pool address (0xdeFA4e8a7bcBA345F687a2f1456F5Edd9CE97202).