From 09c898a51a9b42826a36d635e4aafb2db0c7abc2 Mon Sep 17 00:00:00 2001 From: Connor Barr Date: Thu, 22 Feb 2024 17:39:12 +0000 Subject: [PATCH] Renamed fulfill method --- contracts/orderbook/src/order.rs | 2 +- contracts/orderbook/src/tests/test_order.rs | 2 +- contracts/orderbook/src/types/order.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/orderbook/src/order.rs b/contracts/orderbook/src/order.rs index 41597e1..4f12839 100644 --- a/contracts/orderbook/src/order.rs +++ b/contracts/orderbook/src/order.rs @@ -296,7 +296,7 @@ pub fn resolve_fulfillments( // TODO: Add price detection for tick let msg = fulfillment .order - .fulfill(&denom, fulfillment.amount, Decimal::one())?; + .fill(&denom, fulfillment.amount, Decimal::one())?; msgs.push(msg); if fulfillment.order.quantity.is_zero() { orders().remove( diff --git a/contracts/orderbook/src/tests/test_order.rs b/contracts/orderbook/src/tests/test_order.rs index ff23775..29ce3ab 100644 --- a/contracts/orderbook/src/tests/test_order.rs +++ b/contracts/orderbook/src/tests/test_order.rs @@ -836,7 +836,7 @@ fn test_resolve_fulfillments() { // Check message is generated as expected let mut order = order.clone(); let denom = orderbook.get_expected_denom(&order.order_direction); - let msg = order.fulfill(denom, *amount, Decimal::one()).unwrap(); + let msg = order.fill(denom, *amount, Decimal::one()).unwrap(); assert_eq!(response[idx], msg, "{}", format_test_name(test.name)); } diff --git a/contracts/orderbook/src/types/order.rs b/contracts/orderbook/src/types/order.rs index 615cb74..2e1c147 100644 --- a/contracts/orderbook/src/types/order.rs +++ b/contracts/orderbook/src/types/order.rs @@ -40,7 +40,7 @@ impl LimitOrder { } // Transfers the specified quantity of the order's asset to the owner - pub fn fulfill( + pub fn fill( &mut self, denom: impl Into, quantity: Uint128, @@ -56,7 +56,7 @@ impl LimitOrder { reason: Some("Order does not have enough funds".to_string()) } ); - self.quantity = self.quantity.checked_sub(quantity.min(self.quantity))?; + self.quantity = self.quantity.checked_sub(quantity)?; Ok(BankMsg::Send { to_address: self.owner.to_string(), amount: vec![coin(