-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust verified token diffs for settlement contract address (#2735)
# Description When verifying a quote we determine its accuracy by how many tokens had to be paid out of the settlement contract balances. The more tokens were lost from the buffers during the quote simulation the sloppier the computed provided quote was. The one major edge case this has is when the settlement contract itself is the trader account. Then it currently looks like we pay all of the buy tokens from the settlement contract and leave all of the sell tokens in the settlement contract. (effectively the same issue as in #2681). Since all these quotes look super inaccurate they all get discarded leaving no quote to return to the user which currently prevents us from running the fee withdrawal script. ([log](https://production-6de61f.kb.eu-central-1.aws.cloud.es.io/app/discover#/doc/c0e240e0-d9b3-11ed-b0e6-e361adffce0b/cowlogs-prod-2024.05.14?id=_N_Od48B0pqFYaDRNuDm) showing the messed up token diff amounts) # Changes When we see that the settlement contract is the trader we simply adjust the sell and buy token diff amounts with the traded buy and sell token amounts. Technically this is not 100% correct. If either of the tokens has a fee on transfer or the solver provided quote would not have sold the entire token amounts for whatever reason this result will be inaccurate. But since this is an extreme edge case and the super correct fix would be way more involved I wanted to float that by you anyway.
- Loading branch information
1 parent
813fb12
commit d61e2f8
Showing
2 changed files
with
129 additions
and
19 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