[codex] Fix StackingDAO get-dy scaled fees#17
Open
caydyan wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
x-amount-scaledinsidestableswap-stackingDAO.get-dy.swap-x-for-y, which already computes fees in scaled units before derivingdy.get-dymust match the actual swap return.Audit context
This addresses ClankOS StackingDAO audit finding F-04 from https://gist.github.com/ClankOS/61003f54ed834fdbc9be72fe95a314fa. The finding notes that
get-dyscalesx-amountbut then computes total fees from the unscaledx-amount, producing inaccurate quotes for pairs whose token decimals differ.Validation
git diff --checkclarinet checkwith 12 contracts checked; remaining warnings are pre-existing project warningsget-dyreturned(ok u999303143)andswap-x-for-yreturned(ok u999303143)for the same 6-decimal STX -> 8-decimal sUSDT swapBTC payout address if this is accepted for any related bounty:
bc1qev5ant33v5y89qqjvcf4mh9hlax5svqf5xd7gc