Skip to content

Commit

Permalink
fix #288 (#290)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkanoider authored May 27, 2024
1 parent f1a8c17 commit e410b32
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/app/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ pub async fn order_action(
// Get max and and min amount in case of range order
// in case of single order do like usual
if let (Some(min), Some(max)) = (order.min_amount, order.max_amount) {
amount_vec.clear();
amount_vec.push(min);
amount_vec.push(max);
if order.amount == 0 {
amount_vec.clear();
amount_vec.push(min);
amount_vec.push(max);
} else {
let msg = "Amount must be 0 in case of range order".to_string();
send_cant_do_msg(order.id, Some(msg), &event.pubkey).await;
return Ok(());
}
}

for fiat_amount in amount_vec {
Expand All @@ -55,12 +61,12 @@ pub async fn order_action(
_ => order.amount,
};

// Check amount is positive - extra safety check
if quote < 0 {
let msg = format!("Amount must be positive {} is not valid", order.amount);
send_cant_do_msg(order.id, Some(msg), &event.pubkey).await;
return Ok(());
}
// Check amount is positive - extra safety check
if quote < 0 {
let msg = format!("Amount must be positive {} is not valid", order.amount);
send_cant_do_msg(order.id, Some(msg), &event.pubkey).await;
return Ok(());
}

if quote > mostro_settings.max_order_amount as i64
|| quote < mostro_settings.min_payment_amount as i64
Expand Down

0 comments on commit e410b32

Please sign in to comment.