-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Sumtree]: Min Order Quantity #193
Conversation
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! Had a couple minor comments
tick_values.total_amount_of_liquidity = tick_values | ||
.total_amount_of_liquidity | ||
.checked_add(quant_dec256) | ||
.unwrap(); |
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.
Just realized – we should be returning the error here instead of unwrapping right?
@@ -669,9 +667,6 @@ pub(crate) fn claim_order( | |||
// Immutable amount to prevent bounty/maker fee calculations affecting each other | |||
let raw_amount = amount; | |||
|
|||
// Cannot send a zero amount, may be zero'd out by rounding | |||
ensure!(!amount.is_zero(), ContractError::ZeroClaim); | |||
|
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.
Since we are skipping this check now, we should also probably be skipping the bounty & maker fee calculations if the amount is zero right?
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.
Committed changes directly since they were light & not worth a merge-blocking iteration
What is the purpose of the change
In the current implementation when placing a limit it is possible to place an order with a quantity small enough that when claiming the order a
ZeroClaim
error is thrown due to the order not being enough to fill a single unit. These changes cause these types of orders to silently fail, ignoring the claim of the dust amount.Testing and Verifying
Several tests were updated to accommodate for this change and a min quantity test case was added for placing a limit.