Skip to content

Commit

Permalink
bugfix: Arithmetic operation overflowstack (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
squadgazzz authored May 24, 2024
1 parent ca55c3c commit 6924224
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/domain/dex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ impl Swap {
}

pub fn satisfies(&self, order: &domain::order::Order) -> bool {
self.output.amount * order.sell.amount >= self.input.amount * order.buy.amount
self.output.amount.full_mul(order.sell.amount)
>= self.input.amount.full_mul(order.buy.amount)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/tests/zeroex/out_of_price.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ async fn sell() {
"buyToken": "0xe41d2489571d322189246dafa5ebde1f4699f498",
"sellAmount": "1000000000000000000",
// Way too much...
"buyAmount": "1000000000000000000000000000000000000",
"buyAmount": "30014022222222222222222222222222222222222222222199033052181473140736",
"fullSellAmount": "1000000000000000000",
"fullBuyAmount": "1000000000000000000000000000000000000",
"kind": "sell",
Expand Down

0 comments on commit 6924224

Please sign in to comment.