From 7135b31eb361016284d3f87ec5de7036c9c021e0 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 12:43:28 +0100 Subject: [PATCH 01/10] rename dot function ot one --- .../integration-tests/pendulum/src/polkadot_test_net.rs | 8 ++++---- runtime/integration-tests/pendulum/src/setup.rs | 4 ++-- runtime/integration-tests/pendulum/src/tests.rs | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/polkadot_test_net.rs b/runtime/integration-tests/pendulum/src/polkadot_test_net.rs index bba21cf92..60529a4c4 100644 --- a/runtime/integration-tests/pendulum/src/polkadot_test_net.rs +++ b/runtime/integration-tests/pendulum/src/polkadot_test_net.rs @@ -1,4 +1,4 @@ -use crate::setup::{dot, ExtBuilderPendulum, ExtStatemintBuilder, ALICE, BOB}; +use crate::setup::{one, ExtBuilderPendulum, ExtStatemintBuilder, ALICE, BOB}; use frame_support::traits::GenesisBuild; use polkadot_core_primitives::{AccountId, BlockNumber}; use polkadot_parachain::primitives::Id as ParaId; @@ -54,9 +54,9 @@ pub fn relay_ext() -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); pallet_balances::GenesisConfig:: { balances: vec![ - (AccountId::from(ALICE), dot(100000)), - (AccountId::from(BOB), dot(100)), - (para_account_id(2094), 10 * dot(100000)), + (AccountId::from(ALICE), one(100000)), + (AccountId::from(BOB), one(100)), + (para_account_id(2094), 10 * one(100000)), ], } .assimilate_storage(&mut t) diff --git a/runtime/integration-tests/pendulum/src/setup.rs b/runtime/integration-tests/pendulum/src/setup.rs index 4ecec011c..1ddc4af81 100644 --- a/runtime/integration-tests/pendulum/src/setup.rs +++ b/runtime/integration-tests/pendulum/src/setup.rs @@ -2,7 +2,7 @@ use frame_support::traits::GenesisBuild; use pendulum_runtime::{PendulumCurrencyId, Runtime, System}; use polkadot_core_primitives::{AccountId, Balance}; -pub fn dot(amount: Balance) -> Balance { +pub fn one(amount: Balance) -> Balance { amount * 10u128.saturating_pow(9) } pub const ALICE: [u8; 32] = [4u8; 32]; @@ -40,7 +40,7 @@ impl ExtBuilderPendulum { .unwrap(); orml_tokens::GenesisConfig:: { - balances: vec![(AccountId::from(BOB), PendulumCurrencyId::XCM(0), dot(100))], + balances: vec![(AccountId::from(BOB), PendulumCurrencyId::XCM(0), one(100))], } .assimilate_storage(&mut t) .unwrap(); diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index 875db6504..7a956d8a0 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -22,7 +22,7 @@ const FEE: u128 = 421434140; fn transfer_polkadot_from_relay_chain_to_pendulum() { MockNet::reset(); - let transfer_amount: Balance = dot(20); + let transfer_amount: Balance = one(20); let mut orml_tokens_before = 0; PendulumParachain::execute_with(|| { orml_tokens_before = pendulum_runtime::Tokens::balance( @@ -70,11 +70,11 @@ fn transfer_polkadot_from_relay_chain_to_pendulum() { fn transfer_polkadot_from_pendulum_to_relay_chain() { MockNet::reset(); - let transfer_dot_amount: Balance = dot(10); + let transfer_dot_amount: Balance = one(10); Relay::execute_with(|| { let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - assert_eq!(after_bob_free_balance, dot(100)); + assert_eq!(after_bob_free_balance, one(100)); }); PendulumParachain::execute_with(|| { @@ -128,7 +128,7 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { Relay::execute_with(|| { let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - assert_eq!(after_bob_free_balance, dot(100) + transfer_dot_amount - FEE); + assert_eq!(after_bob_free_balance, one(100) + transfer_dot_amount - FEE); }); } From 50e8ba7dd99a81924c18e571c71bba6ff1d2defe Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 12:46:01 +0100 Subject: [PATCH 02/10] refactor setup rs file --- runtime/integration-tests/pendulum/src/setup.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runtime/integration-tests/pendulum/src/setup.rs b/runtime/integration-tests/pendulum/src/setup.rs index 1ddc4af81..7eb1fe79e 100644 --- a/runtime/integration-tests/pendulum/src/setup.rs +++ b/runtime/integration-tests/pendulum/src/setup.rs @@ -5,6 +5,7 @@ use polkadot_core_primitives::{AccountId, Balance}; pub fn one(amount: Balance) -> Balance { amount * 10u128.saturating_pow(9) } + pub const ALICE: [u8; 32] = [4u8; 32]; pub const BOB: [u8; 32] = [5u8; 32]; pub const INITIAL_BALANCE: u128 = 1_000_000_000; @@ -13,6 +14,7 @@ pub struct ExtBuilderPendulum { balances: Vec<(AccountId, PendulumCurrencyId, Balance)>, parachain_id: u32, } + impl Default for ExtBuilderPendulum { fn default() -> Self { Self { balances: vec![], parachain_id: 2094 } @@ -24,10 +26,12 @@ impl ExtBuilderPendulum { self.balances = balances; self } + pub fn parachain_id(mut self, parachain_id: u32) -> Self { self.parachain_id = parachain_id; self } + pub fn build(self) -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::default().build_storage::().unwrap(); pallet_balances::GenesisConfig:: { From 5e22da54934a4f69497fba48110796c2601665c9 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 12:55:44 +0100 Subject: [PATCH 03/10] add #[cfg(test)] attribute for all modules --- runtime/integration-tests/pendulum/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/integration-tests/pendulum/src/lib.rs b/runtime/integration-tests/pendulum/src/lib.rs index 552378512..c41ea7300 100644 --- a/runtime/integration-tests/pendulum/src/lib.rs +++ b/runtime/integration-tests/pendulum/src/lib.rs @@ -1,4 +1,8 @@ -#![cfg(test)] +#[cfg(test)] mod polkadot_test_net; + +#[cfg(test)] mod setup; + +#[cfg(test)] mod tests; From fc0780c0913e6eaba475ce0e5351abcb0b6b7b71 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 13:11:09 +0100 Subject: [PATCH 04/10] add comments about fees and rename TEN to TEN_UNITS --- .../integration-tests/pendulum/src/tests.rs | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index 7a956d8a0..cf94d65b0 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -11,11 +11,11 @@ use xcm_emulator::{Junctions, TestExt}; use polkadot_core_primitives::{AccountId, Balance}; use polkadot_parachain::primitives::Sibling; -const DOT_FEE: Balance = 3200000000; +const DOT_FEE: Balance = 3200000000; //The fees tha relay chain will charge when transfer DOT to parachain. sovereign account of some parachain will receive transfer_amount - DOT_FEE const ASSET_ID: u32 = 1984; //Real USDT Asset ID from Statemint const INCORRECT_ASSET_ID: u32 = 0; pub const UNIT: Balance = 1_000_000_000_000; -pub const TEN: Balance = 10_000_000_000_000; +pub const TEN_UNITS: Balance = 10_000_000_000_000; const FEE: u128 = 421434140; #[test] @@ -150,7 +150,7 @@ fn statemint_transfer_incorrect_asset_to_pendulum_fails() { use statemint_runtime::*; let origin = RuntimeOrigin::signed(ALICE.into()); - Balances::make_free_balance_be(&ALICE.into(), TEN); + Balances::make_free_balance_be(&ALICE.into(), TEN_UNITS); Balances::make_free_balance_be(&BOB.into(), UNIT); // If using non root, create custom asset cost 0.1 Dot @@ -178,7 +178,8 @@ fn statemint_transfer_incorrect_asset_to_pendulum_fails() { Box::new(MultiLocation::new(1, X1(Parachain(2094))).into()), Box::new(Junction::AccountId32 { id: BOB, network: NetworkId::Any }.into().into()), Box::new( - (X2(PalletInstance(50), GeneralIndex(INCORRECT_ASSET_ID as u128)), TEN).into() + (X2(PalletInstance(50), GeneralIndex(INCORRECT_ASSET_ID as u128)), TEN_UNITS) + .into() ), 0, WeightLimit::Unlimited @@ -187,7 +188,7 @@ fn statemint_transfer_incorrect_asset_to_pendulum_fails() { assert_eq!(990 * UNIT, Assets::balance(INCORRECT_ASSET_ID, &AccountId::from(ALICE))); assert_eq!(0, Assets::balance(INCORRECT_ASSET_ID, &AccountId::from(BOB))); - assert_eq!(TEN, Assets::balance(INCORRECT_ASSET_ID, ¶_2094)); + assert_eq!(TEN_UNITS, Assets::balance(INCORRECT_ASSET_ID, ¶_2094)); // the DOT balance of sibling parachain sovereign account is not changed assert_eq!(UNIT, Balances::free_balance(¶_2094)); }); @@ -227,7 +228,7 @@ fn statemint_transfer_asset_to_pendulum() { use statemint_runtime::*; let origin = RuntimeOrigin::signed(ALICE.into()); - Balances::make_free_balance_be(&ALICE.into(), TEN); + Balances::make_free_balance_be(&ALICE.into(), TEN_UNITS); Balances::make_free_balance_be(&BOB.into(), UNIT); // If using non root, create custom asset cost 0.1 Dot @@ -254,7 +255,7 @@ fn statemint_transfer_asset_to_pendulum() { origin.clone(), Box::new(MultiLocation::new(1, X1(Parachain(2094))).into()), Box::new(Junction::AccountId32 { id: BOB, network: NetworkId::Any }.into().into()), - Box::new((X2(PalletInstance(50), GeneralIndex(ASSET_ID as u128)), TEN).into()), + Box::new((X2(PalletInstance(50), GeneralIndex(ASSET_ID as u128)), TEN_UNITS).into()), 0, WeightLimit::Unlimited )); @@ -262,7 +263,7 @@ fn statemint_transfer_asset_to_pendulum() { assert_eq!(990 * UNIT, Assets::balance(ASSET_ID, &AccountId::from(ALICE))); assert_eq!(0, Assets::balance(ASSET_ID, &AccountId::from(BOB))); - assert_eq!(TEN, Assets::balance(ASSET_ID, ¶_2094)); + assert_eq!(TEN_UNITS, Assets::balance(ASSET_ID, ¶_2094)); // the DOT balance of sibling parachain sovereign account is not changed assert_eq!(UNIT, Balances::free_balance(¶_2094)); }); @@ -295,7 +296,7 @@ fn statemint_transfer_asset_to_pendulum() { pendulum_runtime::PendulumCurrencyId::XCM(1), &BOB.into() ), - TEN + TEN_UNITS ); }); } @@ -307,9 +308,9 @@ fn statemint_transfer_asset_to_statemint() { Statemint::execute_with(|| {}); PendulumParachain::execute_with(|| { - assert_eq!(TEN, Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB))); + assert_eq!(TEN_UNITS, Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB))); // ensure sender has enough PEN balance to be charged as fee - assert_ok!(Balances::mint_into(&AccountId::from(BOB), TEN)); + assert_ok!(Balances::mint_into(&AccountId::from(BOB), TEN_UNITS)); assert_ok!(XTokens::transfer( RuntimeOrigin::signed(BOB.into()), @@ -329,7 +330,7 @@ fn statemint_transfer_asset_to_statemint() { )); assert_eq!( - TEN - 1 * UNIT, //inital balance - one unit + TEN_UNITS - 1 * UNIT, //inital balance - one unit Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB)) ); From f0f9b99d66a2ec76a3b28e45dd4d0ce262686bc0 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 13:19:25 +0100 Subject: [PATCH 05/10] update comment and constants name to show what is it --- runtime/integration-tests/pendulum/src/tests.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index cf94d65b0..60671da60 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -11,15 +11,15 @@ use xcm_emulator::{Junctions, TestExt}; use polkadot_core_primitives::{AccountId, Balance}; use polkadot_parachain::primitives::Sibling; -const DOT_FEE: Balance = 3200000000; //The fees tha relay chain will charge when transfer DOT to parachain. sovereign account of some parachain will receive transfer_amount - DOT_FEE +const DOT_FEE_WHEN_TRANSFER_TO_PARACHAIN: Balance = 3200000000; //The fees that relay chain will charge when transfer DOT to parachain. sovereign account of some parachain will receive transfer_amount - DOT_FEE const ASSET_ID: u32 = 1984; //Real USDT Asset ID from Statemint const INCORRECT_ASSET_ID: u32 = 0; pub const UNIT: Balance = 1_000_000_000_000; pub const TEN_UNITS: Balance = 10_000_000_000_000; -const FEE: u128 = 421434140; +const DOT_FEE_WHEN_TRANSFER_TO_RELAY: u128 = 421434140; //This fee will taken to transfer assets(Polkadot) from sovereign parachain account to destination user account; #[test] -fn transfer_polkadot_from_relay_chain_to_pendulum() { +fn transfer_dot_from_relay_chain_to_pendulum() { MockNet::reset(); let transfer_amount: Balance = one(20); @@ -61,7 +61,7 @@ fn transfer_polkadot_from_relay_chain_to_pendulum() { pendulum_runtime::PendulumCurrencyId::XCM(0), &ALICE.into() ), - orml_tokens_before + transfer_amount - DOT_FEE + orml_tokens_before + transfer_amount - DOT_FEE_WHEN_TRANSFER_TO_PARACHAIN ); }); } @@ -128,7 +128,10 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { Relay::execute_with(|| { let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - assert_eq!(after_bob_free_balance, one(100) + transfer_dot_amount - FEE); + assert_eq!( + after_bob_free_balance, + one(100) + transfer_dot_amount - DOT_FEE_WHEN_TRANSFER_TO_RELAY + ); }); } From 922df2a2e4095984dbb49b97b68e2bd27cd1cbe4 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 13:36:00 +0100 Subject: [PATCH 06/10] wrap Parachain into X1 to have the same approach everywhere --- runtime/integration-tests/pendulum/src/tests.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index 60671da60..31c2f0447 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -34,7 +34,7 @@ fn transfer_dot_from_relay_chain_to_pendulum() { Relay::execute_with(|| { assert_ok!(polkadot_runtime::XcmPallet::reserve_transfer_assets( polkadot_runtime::RuntimeOrigin::signed(ALICE.into()), - Box::new(Parachain(2094).into().into()), + Box::new(X1(Parachain(2094)).into().into()), Box::new(Junction::AccountId32 { network: NetworkId::Any, id: ALICE }.into().into()), Box::new((Here, transfer_amount).into()), 0 @@ -67,7 +67,7 @@ fn transfer_dot_from_relay_chain_to_pendulum() { } #[test] -fn transfer_polkadot_from_pendulum_to_relay_chain() { +fn transfer_dot_from_pendulum_to_relay_chain() { MockNet::reset(); let transfer_dot_amount: Balance = one(10); @@ -128,10 +128,7 @@ fn transfer_polkadot_from_pendulum_to_relay_chain() { Relay::execute_with(|| { let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - assert_eq!( - after_bob_free_balance, - one(100) + transfer_dot_amount - DOT_FEE_WHEN_TRANSFER_TO_RELAY - ); + assert_eq!(after_bob_free_balance, one(100) + transfer_dot_amount - DOT_FEE_WHEN_TRANSFER_TO_RELAY); }); } From 7f6b4cbdec44514b81d4867388ec29e83e805a51 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 13:41:24 +0100 Subject: [PATCH 07/10] update transfer_dot_from_pendulum_to_relay_chain assert statement --- runtime/integration-tests/pendulum/src/tests.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index 31c2f0447..b7dcb7740 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -72,9 +72,10 @@ fn transfer_dot_from_pendulum_to_relay_chain() { let transfer_dot_amount: Balance = one(10); + let expected_base_balance = one(100); Relay::execute_with(|| { - let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - assert_eq!(after_bob_free_balance, one(100)); + let before_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); + assert_eq!(before_bob_free_balance, expected_base_balance); }); PendulumParachain::execute_with(|| { @@ -128,7 +129,10 @@ fn transfer_dot_from_pendulum_to_relay_chain() { Relay::execute_with(|| { let after_bob_free_balance = polkadot_runtime::Balances::free_balance(&BOB.into()); - assert_eq!(after_bob_free_balance, one(100) + transfer_dot_amount - DOT_FEE_WHEN_TRANSFER_TO_RELAY); + assert_eq!( + after_bob_free_balance, + expected_base_balance + transfer_dot_amount - DOT_FEE_WHEN_TRANSFER_TO_RELAY + ); }); } From a2e659f84b7cd2523fcfbbfe3629cfe00e3c4d76 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 13:51:11 +0100 Subject: [PATCH 08/10] add. comment statemint_transfer_incorrect_asset_to_pendulum_should_fails --- .../integration-tests/pendulum/src/tests.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index b7dcb7740..c7a6fdc01 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -137,16 +137,21 @@ fn transfer_dot_from_pendulum_to_relay_chain() { } #[test] -fn statemint_transfer_incorrect_asset_to_pendulum_fails() { +fn statemint_transfer_incorrect_asset_to_pendulum_should_fails() { let para_2094: AccountId = Sibling::from(2094).into_account_truncating(); + //pendulum_runtime::PendulumCurrencyId::XCM(1) is the representation of USDT from Statemint on Pendulum chain. + //The asset id for USDT on Statemint is 1984. and pendulum support only this asset id to recive it on chain. + //we are going to execute XCM call to sent incorrect Asset Id and expect to see cumulus_pallet_xcmp_queue::Event::Fail event with an error FailedToTransactAsset. + //we what to be sure that the initial USDT balance for BOB is the same after XCM call from statemint when we tried to send wrong ASSET_ID from system parachain. + let extected_base_usdt_balance = 0; PendulumParachain::execute_with(|| { assert_eq!( pendulum_runtime::Tokens::balance( pendulum_runtime::PendulumCurrencyId::XCM(1), &BOB.into() ), - 0 + extected_base_usdt_balance ); }); @@ -212,6 +217,16 @@ fn statemint_transfer_incorrect_asset_to_pendulum_fails() { }) ))); }); + + PendulumParachain::execute_with(|| { + assert_eq!( + pendulum_runtime::Tokens::balance( + pendulum_runtime::PendulumCurrencyId::XCM(1), + &BOB.into() + ), + extected_base_usdt_balance + ); + }); } #[test] From 872e800d8da2d7814ebd896d6135404fe0a19c1b Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 13:53:29 +0100 Subject: [PATCH 09/10] add comment statemint_transfer_asset_to_statemint --- runtime/integration-tests/pendulum/src/tests.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index c7a6fdc01..75528160d 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -322,6 +322,7 @@ fn statemint_transfer_asset_to_pendulum() { #[test] fn statemint_transfer_asset_to_statemint() { + //first we need to set up USDT balance on pendulum chain before to start transfer it back. statemint_transfer_asset_to_pendulum(); Statemint::execute_with(|| {}); From 8172fd1c7cb724a1516f6a40093273ac1aa08a22 Mon Sep 17 00:00:00 2001 From: cr4pt0 Date: Wed, 5 Apr 2023 13:59:28 +0100 Subject: [PATCH 10/10] move use pendulum_runtime::{RuntimeEvent, System}; to top of the file --- runtime/integration-tests/pendulum/src/tests.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/runtime/integration-tests/pendulum/src/tests.rs b/runtime/integration-tests/pendulum/src/tests.rs index 75528160d..79b716d7a 100644 --- a/runtime/integration-tests/pendulum/src/tests.rs +++ b/runtime/integration-tests/pendulum/src/tests.rs @@ -8,12 +8,13 @@ use sp_runtime::{traits::AccountIdConversion, MultiAddress}; use xcm::latest::{Junction, Junction::*, Junctions::*, MultiLocation, NetworkId, WeightLimit}; use xcm_emulator::{Junctions, TestExt}; +use pendulum_runtime::{RuntimeEvent, System}; use polkadot_core_primitives::{AccountId, Balance}; use polkadot_parachain::primitives::Sibling; const DOT_FEE_WHEN_TRANSFER_TO_PARACHAIN: Balance = 3200000000; //The fees that relay chain will charge when transfer DOT to parachain. sovereign account of some parachain will receive transfer_amount - DOT_FEE const ASSET_ID: u32 = 1984; //Real USDT Asset ID from Statemint -const INCORRECT_ASSET_ID: u32 = 0; +const INCORRECT_ASSET_ID: u32 = 0; //Incorrect asset id that pendulum is not supporting pendulum_runtime xcm_config pub const UNIT: Balance = 1_000_000_000_000; pub const TEN_UNITS: Balance = 10_000_000_000_000; const DOT_FEE_WHEN_TRANSFER_TO_RELAY: u128 = 421434140; //This fee will taken to transfer assets(Polkadot) from sovereign parachain account to destination user account; @@ -42,8 +43,6 @@ fn transfer_dot_from_relay_chain_to_pendulum() { }); PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( r.event, RuntimeEvent::Tokens(orml_tokens::Event::Deposited { .. }) @@ -95,8 +94,6 @@ fn transfer_dot_from_pendulum_to_relay_chain() { }); PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( r.event, RuntimeEvent::Tokens(orml_tokens::Event::Withdrawn { .. }) @@ -206,8 +203,6 @@ fn statemint_transfer_incorrect_asset_to_pendulum_should_fails() { Statemint::execute_with(|| {}); PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System}; - assert!(System::events().iter().any(|r| matches!( r.event, RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::Fail { @@ -291,7 +286,6 @@ fn statemint_transfer_asset_to_pendulum() { Statemint::execute_with(|| {}); PendulumParachain::execute_with(|| { - use pendulum_runtime::{RuntimeEvent, System}; for i in System::events().iter() { println!(" Pendulum_runtime {:?}", i); } @@ -354,7 +348,6 @@ fn statemint_transfer_asset_to_statemint() { Tokens::balance(PendulumCurrencyId::XCM(1), &AccountId::from(BOB)) ); - use pendulum_runtime::{RuntimeEvent, System}; assert!(System::events().iter().any(|r| matches!( r.event, RuntimeEvent::XcmpQueue(cumulus_pallet_xcmp_queue::Event::XcmpMessageSent { .. })