Skip to content
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

Merged
merged 7 commits into from
Jun 26, 2024
Merged

Conversation

crnbarr93
Copy link
Collaborator

@crnbarr93 crnbarr93 commented Jun 24, 2024

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.

Copy link
Collaborator

@AlpinYukseloglu AlpinYukseloglu left a 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();
Copy link
Collaborator

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);

Copy link
Collaborator

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?

Copy link
Collaborator

@AlpinYukseloglu AlpinYukseloglu left a 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

@AlpinYukseloglu AlpinYukseloglu merged commit d3f4a27 into main Jun 26, 2024
2 checks passed
@AlpinYukseloglu AlpinYukseloglu deleted the connor/min-order-quantity branch June 26, 2024 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants