Skip to content

Commit

Permalink
Merge pull request #9 from ComposableFi/dz/6
Browse files Browse the repository at this point in the history
bug: transfers
  • Loading branch information
dzmitry-lahoda authored Nov 22, 2023
2 parents 800e3a2 + 1ca5e8b commit 0f6b9ae
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions contracts/cosmwasm/order/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,17 +342,19 @@ impl OrderContract<'_> {
)?;
response = response.add_message(route);
};

let solution_chosen = Event::new("mantis-solution-chosen")
.add_attribute("token_a", ab.clone().0)
.add_attribute("token_b", ab.clone().1)
.add_attribute("solver_address", &ctx.info.sender.to_string());
let transfers = self.fill(
ctx.deps.storage,
transfers,
ctx.info.sender.to_string(),
solution_item.block_added,
)?;

let solution_chosen = Event::new("mantis-solution-chosen")
.add_attribute("token_a", ab.clone().0)
.add_attribute("token_b", ab.clone().1)
.add_attribute("solver_address", &ctx.info.sender.to_string())
.add_attribute("total_transfers", transfers.len().to_string());

ctx.deps
.api
.debug(&format!("mantis-solution-chosen: {:?}", &solution_chosen));
Expand All @@ -362,7 +364,8 @@ impl OrderContract<'_> {
}
Ok(response
.add_event(solution_upserted)
.add_event(solution_chosen))
.add_event(solution_chosen)
.add_messages(transfers))
}

fn merge_solution_with_orders(
Expand Down
2 changes: 1 addition & 1 deletion devnet.sh → mainnet.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
RUST_BACKTRACE=1 RUST_TRACE=trace cargo run --bin mantis -- --rpc-centauri "https://composable-rpc.polkachu.com:443" --grpc-centauri "https://composable-grpc.polkachu.com:22290" --osmosis "todo" --neutron "todo" --cvm-contract "centauri1wpf2szs4uazej8pe7g8vlck34u24cvxx7ys0esfq6tuw8yxygzuqpjsn0d" --wallet "$WALLET" --order-contract "centauri1cpcyl3nhp74vux7h9ux7egwm3gpy8tk3p556v90tt8le30z2qmvsft5ftk" --simulate "200000ppica,3ibc/EF48E6B1A1A19F47ECAEA62F5670C37C0580E86A9E88498B7E393EB6F49F33C0"
RUST_BACKTRACE=1 RUST_TRACE=trace cargo run --bin mantis -- --rpc-centauri "https://composable-rpc.polkachu.com:443" --grpc-centauri "https://composable-grpc.polkachu.com:22290" --osmosis "todo" --neutron "todo" --cvm-contract "centauri1wpf2szs4uazej8pe7g8vlck34u24cvxx7ys0esfq6tuw8yxygzuqpjsn0d" --wallet "$WALLET" --order-contract "centauri1zanf7k7uxth9js5jw2j4sqdhpllldedq9cl72jn4m2e3ddu23jqqp47cum" --simulate "200000ppica,3ibc/EF48E6B1A1A19F47ECAEA62F5670C37C0580E86A9E88498B7E393EB6F49F33C0"
2 changes: 1 addition & 1 deletion mantis/node/src/bin/mantis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ async fn solve(

fn decimal_to_fraction(amount: Decimal) -> (u64, u64) {
let digits_after_decimal = amount.to_string().split('.').nth(1).unwrap().len() as u32;
let denominator = 10_u64.pow(digits_after_decimal);
let denominator = 10_u128.pow(digits_after_decimal) as u64;
let numerator = (amount * Decimal::from(denominator))
.to_f64()
.expect("converted")
Expand Down

0 comments on commit 0f6b9ae

Please sign in to comment.