Skip to content

Commit

Permalink
coding model
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Mar 13, 2024
1 parent 7e6ccf6 commit b6846ba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions contracts/cosmwasm/order/model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# model of CoW+CVM protocol
Empty file.
8 changes: 4 additions & 4 deletions contracts/cosmwasm/order/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl OrderContract<'_> {
}

#[msg(exec)]
pub fn route(&self, mut ctx: ExecCtx, msg: RouteSubMsg) -> StdResult<Response> {
pub fn route(&self, mut ctx: ExecCtx, msg: RouteSubMsg) -> StdResult<Response> {
ensure!(
ctx.info.sender == ctx.env.contract.address
|| ctx.info.sender
Expand Down Expand Up @@ -452,7 +452,7 @@ impl OrderContract<'_> {
pair: DenomPair,
) -> Result<(u128, u128), StdError> {
let mut routed_a_amount: u128 = 0;
let mut route_b_amount: u128 = 0;
let mut routed_b_amount: u128 = 0;
for order in all_orders.iter() {
let order_id = order.order.order_id.u128();
let mut item: OrderItem = self.orders.load(ctx.deps.storage, order_id)?;
Expand All @@ -464,7 +464,7 @@ impl OrderContract<'_> {
if item.given.denom == pair.0 {
routed_a_amount += taken;
} else {
route_b_amount += taken;
routed_b_amount += taken;
};

let promised = order.solution.out_asset_amount;
Expand All @@ -489,6 +489,6 @@ impl OrderContract<'_> {
&tracker,
)?;
}
Ok((routed_a_amount, route_b_amount))
Ok((routed_a_amount, routed_b_amount))
}
}

0 comments on commit b6846ba

Please sign in to comment.