Skip to content

Commit cd637d0

Browse files
authored
Merge pull request #200 from osmosis-labs/alpo/swap-step-check
[Sumtree]: Add defense in depth check to swap steps
2 parents 6eb0431 + 25d79fa commit cd637d0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

contracts/sumtree-orderbook/src/order.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,14 @@ pub(crate) fn run_market_order_internal(
557557
tick_price,
558558
RoundingDirection::Up,
559559
)?;
560+
561+
ensure!(
562+
!input_filled.is_zero(),
563+
ContractError::InvalidSwap {
564+
error: "Input amount for a given swap step cannot be zero".to_string()
565+
}
566+
);
567+
560568
order.quantity = order
561569
.quantity
562570
// Safe conversions as amount filled should never be larger than order quantity which is upper bounded by Uint128::MAX

0 commit comments

Comments
 (0)