Uniswap / v3-periphery

🦄 🦄 🦄 Peripheral smart contracts for interacting with Uniswap v3
https://uniswap.org
GNU General Public License v2.0
1.14k stars 1.05k forks source link

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

Open lj92458 opened 1 year ago

lj92458 commented 1 year ago

celo only has SwapRouter2 celo not have SwapRouter

lj92458 commented 1 year ago

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'}

AlissonRS commented 10 months ago

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.

kasparkallas commented 2 months ago

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