Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lj92458 opened this issue Apr 20, 2023 · 3 comments
Open

Comments

@lj92458
Copy link

lj92458 commented Apr 20, 2023

celo only has SwapRouter2
celo not have SwapRouter

@lj92458
Copy link
Author

lj92458 commented Apr 21, 2023

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
Copy link

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
Copy link

kasparkallas commented Apr 25, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants