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

Feat: SwapQuoterV2 #258

Merged
merged 43 commits into from
Aug 7, 2023
Merged

Conversation

ChiTimesChi
Copy link
Collaborator

@ChiTimesChi ChiTimesChi commented Jul 31, 2023

Description

Supersedes #249. Adds new Quoter contract, which is supposed to keep track of all the supported chain pools. Pools could be either:

  • Used for "origin swap" only in the bridge workflow.
  • Be a whitelisted liquidity pool for a bridge token, and thus be used either for "origin swaps", or for "destination swaps" from the given bridge token.

In both cases, the pools could be of two types:

  • Default Pool. Implement IDefaultPool interface. In other words, these are the pools that Synapse:Bridge currently works with. Allows a single-hop swap between a set of tokens.
  • Linked Pool. New wrapper for multiple liquidity pools (which could be both default and non-default pools). Allows multi-hop swaps between a set of tokens.

Quoter returns SynapseRouter-compatible SwapQuery structs, which define the swap parameters. See #257 for more details about Router<>Quoter internal interactions.

TODO:

  • Adjust old Quoter tests to use QuoterV2 instead.
  • Make SynapseRouter address to be upgradeable by the contract owner.
  • Add parity tests where both LinkedPool and SwapQuoterV2 are used.
  • Add unit tests for Swap Quoter V2.
    • Fix found bugs(?)

Checklist

  • New Contracts have been tested
  • Lint has been run
  • I have checked my code and corrected any misspellings

@github-actions
Copy link

github-actions bot commented Jul 31, 2023

Pull Request Test Coverage Report for Build 5762213519

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.8%) to 13.861%

Totals Coverage Status
Change from base Build 5752621076: -1.8%
Covered Lines: 664
Relevant Lines: 4356

💛 - Coveralls

- `setSynapseRouter()`
- `addPools()`
@ChiTimesChi
Copy link
Collaborator Author

Parity tests where both LinkedPool and SwapQuoterV2 would've caught bug fixed in bd99d2f, therefore added these tests to the TODO list.

Shouldn't be too hard, though the old test structure is likely to be these as messy as other parity tests out there.

@ChiTimesChi ChiTimesChi force-pushed the feat/new-swap-quoter branch from 021a996 to d818150 Compare August 3, 2023 18:18
@mikeyrf
Copy link
Contributor

mikeyrf commented Aug 3, 2023

@ChiTimesChi outside of a few questions above, looks good to me.

@ChiTimesChi ChiTimesChi marked this pull request as ready for review August 4, 2023 12:33
@ChiTimesChi
Copy link
Collaborator Author

@mikeyrf the set of tests should be completed now

@ChiTimesChi ChiTimesChi merged commit b61fc19 into feat/universal-swap-wrapper Aug 7, 2023
@ChiTimesChi ChiTimesChi deleted the feat/new-swap-quoter branch August 7, 2023 19:59
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

Successfully merging this pull request may close these issues.

2 participants