Skip to content

Commit

Permalink
fixing rust code
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 16, 2024
1 parent 5faa734 commit afba1ad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
6 changes: 2 additions & 4 deletions contracts/cosmwasm/executor/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ use alloc::borrow::Cow;
#[cfg(not(feature = "library"))]
use cosmwasm_std::entry_point;
use cosmwasm_std::{
ensure, to_json_binary, wasm_execute, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut,
Env, MessageInfo, QueryRequest, Reply, Response, StdError, StdResult, SubMsg, SubMsgResult,
WasmQuery,
ensure, to_json_binary, wasm_execute, Addr, BankMsg, Binary, Coin, CosmosMsg, Deps, DepsMut, Env, MessageInfo, QueryRequest, Reply, Response, StdError, StdResult, SubMsg, SubMsgResult, Uint128, WasmQuery
};
use cvm_route::{asset::AssetReference, exchange::ExchangeItem};
use cvm_runtime::{
Expand Down Expand Up @@ -483,7 +481,7 @@ pub fn interpret_transfer(
let mut coin = deps
.querier
.query_balance(env.contract.address.clone(), denom)?;
let transfer_amount = balance.apply(coin.amount.into())?.into();
let transfer_amount: Uint128 = balance.apply(coin.amount.into())?.into();
if transfer_amount.is_zero() {
// after cross chain route 1% of total can become zero, so it is not error
continue;
Expand Down
11 changes: 4 additions & 7 deletions mantis/node/src/mantis/blackbox/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bounded_collections::Get;
use cvm_runtime::{
outpost::GetConfigResponse,
shared::{CvmFundsFilter, CvmInstruction, CvmProgram},
Amount,
Amount, AssetId,
};
use cw_mantis_order::{CrossChainPart, OrderItem, SolutionSubMsg};

Expand Down Expand Up @@ -43,15 +43,12 @@ fn build_next(
}

fn new_spawn(
spawn: &Spawn,
spawn: &SpawnStrStr,
program: CvmProgram,
glt: &GetConfigResponse,
salt: &[u8],
) -> CvmInstruction {
let in_asset_id = match spawn.in_asset_id.as_ref().expect("in_asset_id") {
InAssetId::Variant1(id) => id.parse().expect("in_asset_id"),
_ => panic!("in_asset_id"),
};
let in_asset_id = AssetId(spawn.in_asset_id.parse().expect("in_asset_id"));

let in_amount: Amount = match spawn.in_asset_amount.as_ref().expect("in_asset_amount") {
InAssetAmount::Variant0(x) => (*x).try_into().expect("in_asset_amount"),
Expand Down Expand Up @@ -80,7 +77,7 @@ fn new_spawn(
}
}

fn new_exchange(exchange: &Exchange) -> CvmInstruction {
fn new_exchange(exchange: &ExchangeStrStr) -> CvmInstruction {
let exchange_id = match &exchange.pool_id {
PoolId::Variant1(id) => id.parse().expect("pool id"),
_ => panic!("exchange_id"),
Expand Down

0 comments on commit afba1ad

Please sign in to comment.