diff --git a/contracts/core-contracts/cw-asset-manager/tests/deposit_test.rs b/contracts/core-contracts/cw-asset-manager/tests/deposit_test.rs index 1ddd3b0..816aec5 100644 --- a/contracts/core-contracts/cw-asset-manager/tests/deposit_test.rs +++ b/contracts/core-contracts/cw-asset-manager/tests/deposit_test.rs @@ -1,13 +1,13 @@ mod setup; use cosmwasm_std::{Addr, Uint128}; -use cw_common::{x_call_msg::XCallMsg as XCallExecuteMsg, asset_manager_msg::ExecuteMsg}; +use cw_common::{asset_manager_msg::ExecuteMsg, x_call_msg::XCallMsg as XCallExecuteMsg}; use cw_ibc_rlp_lib::rlp::RlpStream; use cw_multi_test::Executor; use cw_xcall_lib::network_address::NetId; use crate::setup::{ - execute_config_x_call, instantiate_contracts, set_default_connection, setup_context, - TestContext, get_event, + execute_config_x_call, get_event, instantiate_contracts, set_default_connection, setup_context, + TestContext, }; use cw20::{Cw20Contract, Cw20ExecuteMsg}; @@ -85,7 +85,6 @@ fn test_deposit_expected_for_revert() { assert_eq!(Uint128::new(100), bl); } - #[test] fn test_deposit_revert() { let mut context = setup_context(); @@ -96,11 +95,10 @@ fn test_deposit_revert() { let xcall_connection = context.get_xcall_connection(); context = set_default_connection(context, xcall_connection.clone()); - let (mut ctx, _allowance) = increase_allowance(context, Uint128::new(1000)); let user = ctx.sender.clone(); - let initial_balance = check_balance(&ctx, &spoke_addr, &user); + let initial_balance = check_balance(&ctx, &spoke_addr, &user); let deposit_msg = ExecuteMsg::Deposit { token_address: spoke_addr.to_string(), @@ -111,7 +109,13 @@ fn test_deposit_revert() { let response = ctx .app - .execute_contract(ctx.sender.clone(), ctx.get_asset_manager_app(), &deposit_msg, &[]).unwrap(); + .execute_contract( + ctx.sender.clone(), + ctx.get_asset_manager_app(), + &deposit_msg, + &[], + ) + .unwrap(); let event = get_event(&response, "wasm-CallMessageSent").unwrap(); let sequence_no = event.get("sn").unwrap(); @@ -134,29 +138,29 @@ fn test_deposit_revert() { let data = stream.out().to_vec(); - ctx.app.execute_contract( - xcall_connection.clone(), - ctx.get_xcall_app(), - &XCallExecuteMsg::HandleMessage { - from: NetId::from("icon".to_owned()), - msg: data, - }, - &[], - ).unwrap(); + ctx.app + .execute_contract( + xcall_connection.clone(), + ctx.get_xcall_app(), + &XCallExecuteMsg::HandleMessage { + from: NetId::from("icon".to_owned()), + msg: data, + }, + &[], + ) + .unwrap(); - ctx - .app + ctx.app .execute_contract( user.clone(), ctx.get_xcall_app(), &XCallExecuteMsg::ExecuteRollback { - sequence_no: sequence_no.parse::().unwrap() + sequence_no: sequence_no.parse::().unwrap(), }, &[], ) .unwrap(); - let bl = check_balance(&ctx, &spoke_addr, &user); assert_eq!(initial_balance, bl); } diff --git a/contracts/token-contracts/cw-hub-bnusd/tests/cw20_flow_test.rs b/contracts/token-contracts/cw-hub-bnusd/tests/cw20_flow_test.rs index 21fa19d..a89860f 100644 --- a/contracts/token-contracts/cw-hub-bnusd/tests/cw20_flow_test.rs +++ b/contracts/token-contracts/cw-hub-bnusd/tests/cw20_flow_test.rs @@ -34,7 +34,7 @@ fn cw20_flow_test() { assert!(resp.is_err()); //cannot mint tokens from hubtoken app //use loop to mint tokens from xcall app to alice, bob and carol - vec![alice.to_string(), bob.to_string(), carol.to_string()] + [alice.to_string(), bob.to_string(), carol.to_string()] .iter() .for_each(|recipient| { let _resp = context @@ -52,7 +52,7 @@ fn cw20_flow_test() { }); //check balance of each account, and assert this to be 1000 - vec![ + [ (alice.to_string(), amount), (bob.to_string(), amount), (carol.to_string(), amount), diff --git a/contracts/token-contracts/cw-hub-bnusd/tests/handle_call_message_test.rs b/contracts/token-contracts/cw-hub-bnusd/tests/handle_call_message_test.rs index c255a53..9d7873f 100644 --- a/contracts/token-contracts/cw-hub-bnusd/tests/handle_call_message_test.rs +++ b/contracts/token-contracts/cw-hub-bnusd/tests/handle_call_message_test.rs @@ -1,13 +1,13 @@ mod setup; use std::str::FromStr; -use cw_common::{x_call_msg::XCallMsg as XCallExecuteMsg, hub_token_msg::ExecuteMsg}; -use cw_multi_test::{Executor, AppResponse}; +use cw_common::{hub_token_msg::ExecuteMsg, x_call_msg::XCallMsg as XCallExecuteMsg}; +use cw_multi_test::Executor; use cosmwasm_std::{Addr, Uint128}; use cw_common::{data_types::CrossTransfer, network_address::NetworkAddress}; -use crate::setup::{execute_setup, instantiate_contracts, mint_token, call_set_xcall_host}; +use crate::setup::{call_set_xcall_host, execute_setup, instantiate_contracts, mint_token}; use cw20::BalanceResponse; use cw20_base::msg::QueryMsg; use cw_common::network_address::NetId; @@ -163,7 +163,7 @@ pub fn cross_transfer_revert_data_test() { user.clone(), context.get_hubtoken_app(), &ExecuteMsg::CrossTransfer { - to: to, + to, amount: amount.into(), data: vec![], }, @@ -175,7 +175,7 @@ pub fn cross_transfer_revert_data_test() { let sequence_no = event.get("sn").unwrap(); let balance = balance_of(&context, user.clone()); - let expected_balance = Uint128::from(initial_balance - amount); + let expected_balance = (initial_balance - amount); assert_eq!(balance.balance, expected_balance); let message_type: u64 = 2; @@ -193,15 +193,18 @@ pub fn cross_transfer_revert_data_test() { let data = stream.out().to_vec(); - context.app.execute_contract( - x_call_connection.clone(), - context.get_xcall_app(), - &XCallExecuteMsg::HandleMessage { - from: NetId::from("icon".to_owned()), - msg: data, - }, - &[], - ).unwrap(); + context + .app + .execute_contract( + x_call_connection.clone(), + context.get_xcall_app(), + &XCallExecuteMsg::HandleMessage { + from: NetId::from("icon".to_owned()), + msg: data, + }, + &[], + ) + .unwrap(); context .app @@ -209,13 +212,13 @@ pub fn cross_transfer_revert_data_test() { user.clone(), context.get_xcall_app(), &XCallExecuteMsg::ExecuteRollback { - sequence_no: sequence_no.parse::().unwrap() + sequence_no: sequence_no.parse::().unwrap(), }, &[], ) .unwrap(); - let balance = balance_of(&context, user.clone()); - println!("{:?}", balance.balance); - assert_eq!(balance.balance, initial_balance); + let balance = balance_of(&context, user.clone()); + println!("{:?}", balance.balance); + assert_eq!(balance.balance, initial_balance); }