-
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.
Change logic how network fee is calculated (#2904)
# Description Fix rounding issues for volume based fee policies (a follow up for #2857) # Changes <!-- List of detailed changes (how the change is accomplished) --> - [ ] Reuse `sell_amount` and `buy_amount` to calculate traded amounts for volume based policy (there is one ceil_div hidden here that wasn't used until now). - [ ] `saturating_sub` instead of `checked_sub` to avoid rounding issues when total fee is smaller than protocol fee by 1 wei (this happened on xdai for a solution where network fee is 0 because total fee is calculated as a difference of surpluses over uniform and clearing prices and then returned back to sell token). But, since total fee is 99999999999999 which is equal [how the old code calculated it](https://aws-es.cow.fi/_dashboards/app/discover#/doc/5ed837d0-4a67-11ef-8b11-a98c7c46873d/cowlogs-staging-2024.08.16?id=t06PWpEBxgnhShsyGxFw) I still think this PR is an improvement and tackles differences between old and new code for calculating fees.
- Loading branch information
Showing
4 changed files
with
21 additions
and
37 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