-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: swap adapter #281
base: master
Are you sure you want to change the base?
feat: swap adapter #281
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few changes, and I guess we've settled to make it upgradeable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swapTokens()
function could return the balanceAfter
instead of amountIn
now. Then calling functions could just check if it is positive to decide the transfer back to the user.
Does keeping approvals at 0 at the end of each tx saves gas? That is how it was done before the latest change. Will have to check after migration to hardhat. |
@MakMuftic Should we move this into new repo. sprinter-contracts where hardhat will be used together with multichain deploy tool? |
I think that makes a lot of sense, @mpetrunic, as we talked. I know we also talked about merging all adapters into one "UX adapter," which would be upgradable and essentially an entry point for many of these flows that require an adapter. Also, it would always live at the same address, which is very convenient. @viatrix @lastperson wdyt about this? |
I'll check all the adapters we have to see which ones can be merged. For instance if any adapters are holding assets then they should be much stricter in terms of upgrading. And as always we need to discourage unlimited approvals. |
We were talking on devcon, I think only native adapter should stay here |
I think we should already start extracting this to a separate repository @lastperson @viatrix, Will add separate issues to the repo, but some of the things we definitely want to have:
Please let me know what do you think or if you have some other ideas 🙏 |
Starting right away. We will raise questions to discuss if there are any concerns. |
Add SwapAdapter (ETH-> USDC, USDC->ETH)
Description
Add SwapAdapter (ETH-> USDC, USDC->ETH). It uses Uniswap. Using it will also require getting the route for the swap (paths and fees) before submitting the transaction.
Related Issue Or Context
https://github.com/ChainSafe/sprinter-api/issues/250
closes https://github.com/ChainSafe/sprinter-contracts/issues/14
resolves https://github.com/ChainSafe/sprinter-contracts/issues/13
How Has This Been Tested? Testing details.
Unit tests under forked mainnet.
For these tests to pass, add USDC_OWNER_ADDRESS to your .env. The example address that can be used is specified in .env.example. This is a sample address of an owner of USDC tokens on mainnet.
Types of changes
Checklist: