-
Notifications
You must be signed in to change notification settings - Fork 91
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
Allow whitelisting addresses for protocol fees discounts #2573
Allow whitelisting addresses for protocol fees discounts #2573
Conversation
protocol_fee_discounted_addresses.kind, | ||
) | ||
}) | ||
.collect::<HashMap<_, _>>(), |
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.
Convert into a HashMap
in order to have O(1) access when checking the addresses.
04072f9
to
ee1f11d
Compare
ee1f11d
to
6036bc1
Compare
6036bc1
to
bf3f8f5
Compare
I cut the review a bit short since addressing the autopilot comment will most likely cause a bunch of changes anyway. |
bf3f8f5
to
2862193
Compare
@@ -110,9 +129,18 @@ impl ProtocolFees { | |||
buy: quote.buy_amount, | |||
fee: quote.fee, | |||
}; | |||
let protocol_fees = protocol_fees | |||
let apply_protocol_fee = if let Ok(Some(address)) = order |
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.
This could be done better, it is mostly a placeholder to apply different kind of discounts in the future.
e835e06
to
55d45ef
Compare
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.
Looks way better!
I would just recommend to cross the bridge of different fee discounts when we actually need to and not support it from the get go. Overall I like to think in terms of "lines spent" since every line of code that is actually not needed just adds mental overhead and opportunities for bugs to sneak in.
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.
LGTM.
This merge gonna add some conflicts to the protocol fee e2e tests clean-up PR( |
Maybe merge this one first then. It's been pending for a long time and shouldn't get more delayed. |
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.
Looks good, I don't think you need to pass down the domain separator (you can get the owner straight from the order)
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.
Lg.
@fleupold should we skip integrator fees for these addresses as well? Could this edge case happen in practice?
4abdf2a
to
5f88090
Compare
Dang, I missed that comment... |
5f88090
to
3073517
Compare
The following messages need to be updated according to the current elements count: |
Remove the extra logic to determine the kind of discounts Support only whitelisting of addresses and not struct Remove commented code Inline the fee policy whitelisted addresses filter Remove domain separator
3073517
to
89133ed
Compare
89133ed
to
e024627
Compare
9c280e6
to
e024627
Compare
Description
Allow configuring contracts which are exempt from protocol fees.
Our CoW AMM experiment is placing a lot of limit orders, some of which are being classified as out of market orders (mainly because they are partially fillable and usually a bit larger than what is currently fillable at the specified price).
It therefore pays significant protocol fees, impacting it's own PnL
Changes
How to test
Fixes #2461