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

fix: trade ratio & CoW quote display #5062

Conversation

0xApotheosis
Copy link
Contributor

@0xApotheosis 0xApotheosis commented Aug 11, 2023

Description

  • Fixes the trade ratio calculation, which was incorrectly handling sell asset fees (which currently only affects CoW Swap quotes)
  • Fixes the display of sell asset fees, which were not correctly shown to the user (again, currently only affects CoW Swap quotes)
  • Renames sellAmountBeforeFeesCryptoBaseUnit to sellAmountIncludingProtocolFeesCryptoBaseUnit, because that's what it actually is, and probably caused this bug

This PR is also important as it fixes the ratio data send to MixPanel.

Pull Request Type

  • 🐛 Bug fix (Non-breaking Change: Fixes an issue)
  • 🛠️ Chore (Non-breaking Change: Doc updates, pkg upgrades, typos, etc..)
  • 💅 New Feature (Breaking/Non-breaking Change)

Issue (if applicable)

N/A

Risk

Medium - quotes and their ratio/percent better/worse than display might be broken.

Testing

Get a quote for an asset pair with many supported swappers (e.g. USDC to FOX).

  • Ensure that the percent difference looks sane
  • Ensure that for CoW Swap quotes, we are subtracting the fee from the receive amount

Engineering

Inspect CoW quote network requests and ensure that the data matches what we are showing, particularly with regard to fees and receive amount.

Operations

Check our CoW quotes against https://swap.cow.fi/#/1/swap and ensure they are close.

Screenshots (if applicable)

Screenshot 2023-08-11 at 4 17 04 pm

@0xApotheosis
Copy link
Contributor Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@0xApotheosis 0xApotheosis marked this pull request as ready for review August 11, 2023 05:04
@0xApotheosis 0xApotheosis requested a review from a team as a code owner August 11, 2023 05:04
@0xApotheosis 0xApotheosis changed the title fix: trade ratio & CoW quote display (WIP) fix: trade ratio & CoW quote display Aug 11, 2023
@0xApotheosis 0xApotheosis merged commit c726de2 into develop Aug 11, 2023
7 checks passed
@0xApotheosis 0xApotheosis deleted the 08-10-chore_rename_sellAmountBeforeFeesCryptoBaseUnit_to_sellAmountIncludingProtocolFeesCryptoBaseUnit branch August 11, 2023 06:40
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