v3-periphery icon indicating copy to clipboard operation
v3-periphery copied to clipboard

SwapRouter on celo is actually SwapRouter2. why don't use SwapRouter ?

Open lj92458 opened this issue 2 years ago • 3 comments
trafficstars

celo only has SwapRouter2 celo not have SwapRouter

lj92458 avatar Apr 20 '23 11:04 lj92458

If we want to call contract swapRouter.exactInputSingle directly on celo, we must use the correct abi: import SwapRouter02Abi from '@uniswap/swap-router-contracts/artifacts/contracts/V3SwapRouter.sol/V3SwapRouter.json' assert {type: 'json'} , and the params object for exactInputSinglem method need not have deadline properties. That means params should have 7 properties, not 8. See also How to swap Celo tokens on Uniswap programmatically with code , this example has 2 bugs, which have mentioned above.

Other wise, if we want to use js function swaprouter.swapCallParameters on celo, we must create a ts file which is named swapRouter02.ts : copy this code to swapRouter02.ts , then delete all the deadline properties, and use the correct abi: import SwapRouter02Abi from '@uniswap/swap-router-contracts/artifacts/contracts/V3SwapRouter.sol/V3SwapRouter.json' assert {type: 'json'}

lj92458 avatar Apr 21 '23 08:04 lj92458

There are DEXes using the interface with deadline field, others are not using it. Even Uniswap as a DEX itself seems to not be using the deadline field, so if you follow their docs which is using the deadline field it's never gonna work.

This has become a nightmare become we want to support any DEX that is Uniswap compliant, but now there are two versions of the same contract.

AlissonRS avatar Aug 30 '23 22:08 AlissonRS

Hello from 2024. This discrepancy is annoying. SwapRouter02 seems to be deployed everywhere though (the one without deadline).

kasparkallas avatar Apr 25 '24 16:04 kasparkallas