-
Notifications
You must be signed in to change notification settings - Fork 89
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
feat(slippage): small order slippage v2 #4934
base: develop
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
apps/cowswap-frontend/src/modules/swap/updaters/SmartSlippageUpdater.ts
Outdated
Show resolved
Hide resolved
apps/cowswap-frontend/src/modules/swap/pure/Row/RowSlippageContent/index.tsx
Show resolved
Hide resolved
* for the limit price to take this much more fee. | ||
* More relevant for small orders in relation to fee amount, negligent for larger orders. | ||
*/ | ||
function useSmartSlippageFromFeePercentageV2(): number { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hooks deserves its own file :)
I would also suggest to extract the whole logic into a pure function and cover it by unit-tests
Hey @alfetopito , I have some questions to clarify/suggestions:
|
c08b061
to
bfb70b9
Compare
Update 2024/10/03
Added feature flag
smartSlippageFeeMultiplierPercentage
, that returns the multiplier value and can still be used to feature flag the individual feature of small orders slippage.Also, slippage is now capped at 50%.
New testing steps
smartSlippageFeeMultiplierPercentage
and disableisSmartSlippageEnabled
5000
One more fun test is to add/pick new values to be served when on for the new feature flag:
And then observe the slippage change accordingly in the UI.
Summary
Supersedes #4911
Instead of using the fee % in relation to order size, calculate how much slippage is needed if the fee is 50% higher.
This value is added to the one returned by BFF.
To Test
You can also observe all the smart slippage values by filtering the console logs by
SmartSlippage