Skip to content

Commit

Permalink
all checked
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Nov 22, 2023
1 parent ba00814 commit 1bc2c14
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions contracts/cosmwasm/order/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub struct OrderContract<'a> {
pub orders: Map<'a, u128, OrderItem>,
/// (a,b,solver)
pub solutions:
IndexedMap<'a, &'a (Denom, Denom, SolverAddress), SolutionItem, SolutionIndexes<'a>>,
IndexedMap<'a, &'a (Denom, Denom, SolverAddress), SolutionItem, SolutionIndexes<'a>> ,
pub next_order_id: Item<'a, u128>,
/// address for CVM contact to send routes to
pub cvm_address: Item<'a, String>,
Expand Down Expand Up @@ -320,7 +320,7 @@ impl OrderContract<'_> {
return Err(err);
}
} else if let Ok(alternative_transfers) = alternative_transfers {
if a_total_in * b_total_in > a_in * b_in {
if a_total_in.saturating_mul(b_total_in) >= a_in.saturating_mul(b_in) {
a_in = a_total_in;
b_in = b_total_in;
all_orders = alternative_all_orders;
Expand Down
2 changes: 1 addition & 1 deletion contracts/cosmwasm/order/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct OrderItem {
impl OrderItem {
pub fn fill(&mut self, wanted_transfer: Uint128) {
// was given more or exact wanted - user happy
if wanted_transfer >= self.msg.wants.amount {
if wanted_transfer >= self.msg.wants.amount || self.msg.wants.amount == 0 {
self.given.amount = <_>::default();
self.msg.wants.amount = <_>::default();
} else {
Expand Down

0 comments on commit 1bc2c14

Please sign in to comment.