-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix quote fee handling in market price (#2572)
# Description Fixes the way we scale quote sell and quote buy amounts to consider quote fee. Quoting @fhenneke and his example: > Suppose there is a quote for an order selling 100 DAI to USDC. The quote might be something like sell amount: 100 DAI, buy amount 100 USDC, network fee 50 DAI. > The logic currently used by the solver team: the reference buy amount for computing price improvement is 50 USDC. This is because if a user sells 100 DAI and 50 DAI are for network fees and the exchange rate is 100->100, i.e., 1 -> 1, the expected buy amount is 50 DAI. > The logic currently used by the driver: the reference buy amount for computing price improvement is 66 USDC. This is because if the user payed additional 50DAI on top of the 100DAI they want to sell, they could get 100USDC. Scaling down this trade from 150DAI -> 100USDC gives 100DAI -> 66USDC. Note that this is affecting only sell orders. ## How to test Fixed existing tests to be aligned with new logic.
- Loading branch information
Showing
7 changed files
with
152 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.