mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 13:21:10 +00:00
Externalize received fees checks from receive_reserve_asset_deposited_from_different_consensus_works (#3409)
Backport of patch-fix: https://github.com/paritytech/polkadot-sdk/pull/3404
This commit is contained in:
Generated
-1
@@ -1050,7 +1050,6 @@ dependencies = [
|
|||||||
"frame-support",
|
"frame-support",
|
||||||
"frame-system",
|
"frame-system",
|
||||||
"hex-literal",
|
"hex-literal",
|
||||||
"pallet-asset-conversion",
|
|
||||||
"pallet-assets",
|
"pallet-assets",
|
||||||
"pallet-balances",
|
"pallet-balances",
|
||||||
"pallet-collator-selection",
|
"pallet-collator-selection",
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ use asset_hub_rococo_runtime::{
|
|||||||
xcm_config::{
|
xcm_config::{
|
||||||
bridging, AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount,
|
bridging, AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount,
|
||||||
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, ForeignCreatorsSovereignAccountOf,
|
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, ForeignCreatorsSovereignAccountOf,
|
||||||
LocationToAccountId, TokenLocation, TokenLocationV3, TrustBackedAssetsPalletLocation,
|
LocationToAccountId, StakingPot, TokenLocation, TokenLocationV3,
|
||||||
TrustBackedAssetsPalletLocationV3, XcmConfig,
|
TrustBackedAssetsPalletLocation, TrustBackedAssetsPalletLocationV3, XcmConfig,
|
||||||
},
|
},
|
||||||
AllPalletsWithoutSystem, AssetConversion, AssetDeposit, Assets, Balances, CollatorSelection,
|
AllPalletsWithoutSystem, AssetConversion, AssetDeposit, Assets, Balances, CollatorSelection,
|
||||||
ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase,
|
ExistentialDeposit, ForeignAssets, ForeignAssetsInstance, MetadataDepositBase,
|
||||||
MetadataDepositPerByte, ParachainSystem, Runtime, RuntimeCall, RuntimeEvent, SessionKeys,
|
MetadataDepositPerByte, ParachainSystem, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
|
||||||
ToWestendXcmRouterInstance, TrustBackedAssetsInstance, XcmpQueue,
|
SessionKeys, ToWestendXcmRouterInstance, TrustBackedAssetsInstance, XcmpQueue,
|
||||||
};
|
};
|
||||||
use asset_test_utils::{
|
use asset_test_utils::{
|
||||||
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys,
|
test_cases_over_bridge::TestBridgingConfig, CollatorSessionKey, CollatorSessionKeys,
|
||||||
@@ -49,6 +49,7 @@ use frame_support::{
|
|||||||
use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance};
|
use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance};
|
||||||
use sp_consensus_aura::SlotDuration;
|
use sp_consensus_aura::SlotDuration;
|
||||||
use sp_runtime::traits::MaybeEquivalence;
|
use sp_runtime::traits::MaybeEquivalence;
|
||||||
|
use sp_std::ops::Mul;
|
||||||
use std::convert::Into;
|
use std::convert::Into;
|
||||||
use testnet_parachains_constants::rococo::{consensus::*, currency::UNITS, fee::WeightToFee};
|
use testnet_parachains_constants::rococo::{consensus::*, currency::UNITS, fee::WeightToFee};
|
||||||
use xcm::latest::prelude::{Assets as XcmAssets, *};
|
use xcm::latest::prelude::{Assets as XcmAssets, *};
|
||||||
@@ -85,6 +86,52 @@ fn slot_durations() -> SlotDurations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setup_pool_for_paying_fees_with_foreign_assets(
|
||||||
|
(foreign_asset_owner, foreign_asset_id_location, foreign_asset_id_minimum_balance): (
|
||||||
|
AccountId,
|
||||||
|
xcm::v3::Location,
|
||||||
|
Balance,
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
let existential_deposit = ExistentialDeposit::get();
|
||||||
|
|
||||||
|
// setup a pool to pay fees with `foreign_asset_id_location` tokens
|
||||||
|
let pool_owner: AccountId = [14u8; 32].into();
|
||||||
|
let native_asset = xcm::v3::Location::parent();
|
||||||
|
let pool_liquidity: Balance =
|
||||||
|
existential_deposit.max(foreign_asset_id_minimum_balance).mul(100_000);
|
||||||
|
|
||||||
|
let _ = Balances::force_set_balance(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
pool_owner.clone().into(),
|
||||||
|
(existential_deposit + pool_liquidity).mul(2).into(),
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_ok!(ForeignAssets::mint(
|
||||||
|
RuntimeOrigin::signed(foreign_asset_owner),
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
pool_owner.clone().into(),
|
||||||
|
(foreign_asset_id_minimum_balance + pool_liquidity).mul(2).into(),
|
||||||
|
));
|
||||||
|
|
||||||
|
assert_ok!(AssetConversion::create_pool(
|
||||||
|
RuntimeOrigin::signed(pool_owner.clone()),
|
||||||
|
Box::new(native_asset.into()),
|
||||||
|
Box::new(foreign_asset_id_location.into())
|
||||||
|
));
|
||||||
|
|
||||||
|
assert_ok!(AssetConversion::add_liquidity(
|
||||||
|
RuntimeOrigin::signed(pool_owner.clone()),
|
||||||
|
Box::new(native_asset.into()),
|
||||||
|
Box::new(foreign_asset_id_location.into()),
|
||||||
|
pool_liquidity,
|
||||||
|
pool_liquidity,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
pool_owner,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_buy_and_refund_weight_in_native() {
|
fn test_buy_and_refund_weight_in_native() {
|
||||||
ExtBuilder::<Runtime>::default()
|
ExtBuilder::<Runtime>::default()
|
||||||
@@ -1056,7 +1103,8 @@ fn limited_reserve_transfer_assets_for_native_asset_over_bridge_works(
|
|||||||
|
|
||||||
mod asset_hub_rococo_tests {
|
mod asset_hub_rococo_tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use asset_hub_rococo_runtime::{PolkadotXcm, RuntimeOrigin};
|
use asset_hub_rococo_runtime::PolkadotXcm;
|
||||||
|
use xcm_executor::traits::ConvertLocation;
|
||||||
|
|
||||||
fn bridging_to_asset_hub_westend() -> TestBridgingConfig {
|
fn bridging_to_asset_hub_westend() -> TestBridgingConfig {
|
||||||
let _ = PolkadotXcm::force_xcm_version(
|
let _ = PolkadotXcm::force_xcm_version(
|
||||||
@@ -1081,27 +1129,135 @@ mod asset_hub_rococo_tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn receive_reserve_asset_deposited_wnd_from_asset_hub_westend_works() {
|
fn receive_reserve_asset_deposited_wnd_from_asset_hub_westend_fees_paid_by_pool_swap_works() {
|
||||||
const BLOCK_AUTHOR_ACCOUNT: [u8; 32] = [13; 32];
|
const BLOCK_AUTHOR_ACCOUNT: [u8; 32] = [13; 32];
|
||||||
|
let block_author_account = AccountId::from(BLOCK_AUTHOR_ACCOUNT);
|
||||||
|
let staking_pot = StakingPot::get();
|
||||||
|
|
||||||
|
let foreign_asset_id_location = xcm::v3::Location::new(
|
||||||
|
2,
|
||||||
|
[xcm::v3::Junction::GlobalConsensus(xcm::v3::NetworkId::Westend)],
|
||||||
|
);
|
||||||
|
let foreign_asset_id_minimum_balance = 1_000_000_000;
|
||||||
|
// sovereign account as foreign asset owner (can be whoever for this scenario)
|
||||||
|
let foreign_asset_owner =
|
||||||
|
LocationToAccountId::convert_location(&Location::parent()).unwrap();
|
||||||
|
let foreign_asset_create_params =
|
||||||
|
(foreign_asset_owner, foreign_asset_id_location, foreign_asset_id_minimum_balance);
|
||||||
|
|
||||||
asset_test_utils::test_cases_over_bridge::receive_reserve_asset_deposited_from_different_consensus_works::<
|
asset_test_utils::test_cases_over_bridge::receive_reserve_asset_deposited_from_different_consensus_works::<
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithoutSystem,
|
AllPalletsWithoutSystem,
|
||||||
XcmConfig,
|
XcmConfig,
|
||||||
LocationToAccountId,
|
|
||||||
ForeignAssetsInstance,
|
ForeignAssetsInstance,
|
||||||
>(
|
>(
|
||||||
collator_session_keys().add(collator_session_key(BLOCK_AUTHOR_ACCOUNT)),
|
collator_session_keys().add(collator_session_key(BLOCK_AUTHOR_ACCOUNT)),
|
||||||
ExistentialDeposit::get(),
|
ExistentialDeposit::get(),
|
||||||
AccountId::from([73; 32]),
|
AccountId::from([73; 32]),
|
||||||
AccountId::from(BLOCK_AUTHOR_ACCOUNT),
|
block_author_account,
|
||||||
// receiving WNDs
|
// receiving WNDs
|
||||||
(xcm::v3::Location::new(2, [xcm::v3::Junction::GlobalConsensus(xcm::v3::NetworkId::Westend)]), 1000000000000, 1_000_000_000),
|
foreign_asset_create_params.clone(),
|
||||||
|
1000000000000,
|
||||||
|
|| {
|
||||||
|
// setup pool for paying fees to touch `SwapFirstAssetTrader`
|
||||||
|
setup_pool_for_paying_fees_with_foreign_assets(foreign_asset_create_params);
|
||||||
|
// staking pot account for collecting local native fees from `BuyExecution`
|
||||||
|
let _ = Balances::force_set_balance(RuntimeOrigin::root(), StakingPot::get().into(), ExistentialDeposit::get());
|
||||||
|
// prepare bridge configuration
|
||||||
|
bridging_to_asset_hub_westend()
|
||||||
|
},
|
||||||
|
(
|
||||||
|
[PalletInstance(bp_bridge_hub_rococo::WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX)].into(),
|
||||||
|
GlobalConsensus(Westend),
|
||||||
|
[Parachain(1000)].into()
|
||||||
|
),
|
||||||
|
|| {
|
||||||
|
// check staking pot for ED
|
||||||
|
assert_eq!(Balances::free_balance(&staking_pot), ExistentialDeposit::get());
|
||||||
|
// check now foreign asset for staking pot
|
||||||
|
assert_eq!(
|
||||||
|
ForeignAssets::balance(
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
&staking_pot
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|| {
|
||||||
|
// `SwapFirstAssetTrader` - staking pot receives xcm fees in ROCs
|
||||||
|
assert!(
|
||||||
|
Balances::free_balance(&staking_pot) > ExistentialDeposit::get()
|
||||||
|
);
|
||||||
|
// staking pot receives no foreign assets
|
||||||
|
assert_eq!(
|
||||||
|
ForeignAssets::balance(
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
&staking_pot
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn receive_reserve_asset_deposited_wnd_from_asset_hub_westend_fees_paid_by_sufficient_asset_works(
|
||||||
|
) {
|
||||||
|
const BLOCK_AUTHOR_ACCOUNT: [u8; 32] = [13; 32];
|
||||||
|
let block_author_account = AccountId::from(BLOCK_AUTHOR_ACCOUNT);
|
||||||
|
let staking_pot = StakingPot::get();
|
||||||
|
|
||||||
|
let foreign_asset_id_location = xcm::v3::Location::new(
|
||||||
|
2,
|
||||||
|
[xcm::v3::Junction::GlobalConsensus(xcm::v3::NetworkId::Westend)],
|
||||||
|
);
|
||||||
|
let foreign_asset_id_minimum_balance = 1_000_000_000;
|
||||||
|
// sovereign account as foreign asset owner (can be whoever for this scenario)
|
||||||
|
let foreign_asset_owner =
|
||||||
|
LocationToAccountId::convert_location(&Location::parent()).unwrap();
|
||||||
|
let foreign_asset_create_params =
|
||||||
|
(foreign_asset_owner, foreign_asset_id_location, foreign_asset_id_minimum_balance);
|
||||||
|
|
||||||
|
asset_test_utils::test_cases_over_bridge::receive_reserve_asset_deposited_from_different_consensus_works::<
|
||||||
|
Runtime,
|
||||||
|
AllPalletsWithoutSystem,
|
||||||
|
XcmConfig,
|
||||||
|
ForeignAssetsInstance,
|
||||||
|
>(
|
||||||
|
collator_session_keys().add(collator_session_key(BLOCK_AUTHOR_ACCOUNT)),
|
||||||
|
ExistentialDeposit::get(),
|
||||||
|
AccountId::from([73; 32]),
|
||||||
|
block_author_account.clone(),
|
||||||
|
// receiving WNDs
|
||||||
|
foreign_asset_create_params,
|
||||||
|
1000000000000,
|
||||||
bridging_to_asset_hub_westend,
|
bridging_to_asset_hub_westend,
|
||||||
(
|
(
|
||||||
[PalletInstance(bp_bridge_hub_rococo::WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX)].into(),
|
[PalletInstance(bp_bridge_hub_rococo::WITH_BRIDGE_ROCOCO_TO_WESTEND_MESSAGES_PALLET_INDEX)].into(),
|
||||||
GlobalConsensus(Westend),
|
GlobalConsensus(Westend),
|
||||||
[Parachain(1000)].into()
|
[Parachain(1000)].into()
|
||||||
)
|
),
|
||||||
|
|| {
|
||||||
|
// check block author before
|
||||||
|
assert_eq!(
|
||||||
|
ForeignAssets::balance(
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
&block_author_account
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|| {
|
||||||
|
// `TakeFirstAssetTrader` puts fees to the block author
|
||||||
|
assert!(
|
||||||
|
ForeignAssets::balance(
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
&block_author_account
|
||||||
|
) > 0
|
||||||
|
);
|
||||||
|
// `SwapFirstAssetTrader` did not work
|
||||||
|
assert_eq!(Balances::free_balance(&staking_pot), 0);
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ use asset_hub_westend_runtime::{
|
|||||||
xcm_config::{
|
xcm_config::{
|
||||||
bridging, AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount,
|
bridging, AssetFeeAsExistentialDepositMultiplierFeeCharger, CheckingAccount,
|
||||||
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, ForeignCreatorsSovereignAccountOf,
|
ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger, ForeignCreatorsSovereignAccountOf,
|
||||||
LocationToAccountId, TrustBackedAssetsPalletLocation, TrustBackedAssetsPalletLocationV3,
|
LocationToAccountId, StakingPot, TrustBackedAssetsPalletLocation,
|
||||||
WestendLocation, WestendLocationV3, XcmConfig,
|
TrustBackedAssetsPalletLocationV3, WestendLocation, WestendLocationV3, XcmConfig,
|
||||||
},
|
},
|
||||||
AllPalletsWithoutSystem, Assets, Balances, ExistentialDeposit, ForeignAssets,
|
AllPalletsWithoutSystem, Assets, Balances, ExistentialDeposit, ForeignAssets,
|
||||||
ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem,
|
ForeignAssetsInstance, MetadataDepositBase, MetadataDepositPerByte, ParachainSystem,
|
||||||
@@ -50,11 +50,11 @@ use frame_support::{
|
|||||||
use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance};
|
use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance};
|
||||||
use sp_consensus_aura::SlotDuration;
|
use sp_consensus_aura::SlotDuration;
|
||||||
use sp_runtime::traits::MaybeEquivalence;
|
use sp_runtime::traits::MaybeEquivalence;
|
||||||
use std::convert::Into;
|
use std::{convert::Into, ops::Mul};
|
||||||
use testnet_parachains_constants::westend::{consensus::*, currency::UNITS, fee::WeightToFee};
|
use testnet_parachains_constants::westend::{consensus::*, currency::UNITS, fee::WeightToFee};
|
||||||
use xcm::latest::prelude::{Assets as XcmAssets, *};
|
use xcm::latest::prelude::{Assets as XcmAssets, *};
|
||||||
use xcm_builder::V4V3LocationConverter;
|
use xcm_builder::V4V3LocationConverter;
|
||||||
use xcm_executor::traits::{JustTry, WeightTrader};
|
use xcm_executor::traits::{ConvertLocation, JustTry, WeightTrader};
|
||||||
|
|
||||||
const ALICE: [u8; 32] = [1u8; 32];
|
const ALICE: [u8; 32] = [1u8; 32];
|
||||||
const SOME_ASSET_ADMIN: [u8; 32] = [5u8; 32];
|
const SOME_ASSET_ADMIN: [u8; 32] = [5u8; 32];
|
||||||
@@ -86,6 +86,52 @@ fn slot_durations() -> SlotDurations {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn setup_pool_for_paying_fees_with_foreign_assets(
|
||||||
|
(foreign_asset_owner, foreign_asset_id_location, foreign_asset_id_minimum_balance): (
|
||||||
|
AccountId,
|
||||||
|
xcm::v3::Location,
|
||||||
|
Balance,
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
let existential_deposit = ExistentialDeposit::get();
|
||||||
|
|
||||||
|
// setup a pool to pay fees with `foreign_asset_id_location` tokens
|
||||||
|
let pool_owner: AccountId = [14u8; 32].into();
|
||||||
|
let native_asset = xcm::v3::Location::parent();
|
||||||
|
let pool_liquidity: Balance =
|
||||||
|
existential_deposit.max(foreign_asset_id_minimum_balance).mul(100_000);
|
||||||
|
|
||||||
|
let _ = Balances::force_set_balance(
|
||||||
|
RuntimeOrigin::root(),
|
||||||
|
pool_owner.clone().into(),
|
||||||
|
(existential_deposit + pool_liquidity).mul(2).into(),
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_ok!(ForeignAssets::mint(
|
||||||
|
RuntimeOrigin::signed(foreign_asset_owner),
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
pool_owner.clone().into(),
|
||||||
|
(foreign_asset_id_minimum_balance + pool_liquidity).mul(2).into(),
|
||||||
|
));
|
||||||
|
|
||||||
|
assert_ok!(AssetConversion::create_pool(
|
||||||
|
RuntimeOrigin::signed(pool_owner.clone()),
|
||||||
|
Box::new(native_asset.into()),
|
||||||
|
Box::new(foreign_asset_id_location.into())
|
||||||
|
));
|
||||||
|
|
||||||
|
assert_ok!(AssetConversion::add_liquidity(
|
||||||
|
RuntimeOrigin::signed(pool_owner.clone()),
|
||||||
|
Box::new(native_asset.into()),
|
||||||
|
Box::new(foreign_asset_id_location.into()),
|
||||||
|
pool_liquidity,
|
||||||
|
pool_liquidity,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
pool_owner,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_buy_and_refund_weight_in_native() {
|
fn test_buy_and_refund_weight_in_native() {
|
||||||
ExtBuilder::<Runtime>::default()
|
ExtBuilder::<Runtime>::default()
|
||||||
@@ -1071,30 +1117,133 @@ fn limited_reserve_transfer_assets_for_native_asset_to_asset_hub_rococo_works()
|
|||||||
Some(xcm_config::TreasuryAccount::get()),
|
Some(xcm_config::TreasuryAccount::get()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn receive_reserve_asset_deposited_roc_from_asset_hub_rococo_works() {
|
fn receive_reserve_asset_deposited_roc_from_asset_hub_rococo_fees_paid_by_pool_swap_works() {
|
||||||
const BLOCK_AUTHOR_ACCOUNT: [u8; 32] = [13; 32];
|
const BLOCK_AUTHOR_ACCOUNT: [u8; 32] = [13; 32];
|
||||||
|
let block_author_account = AccountId::from(BLOCK_AUTHOR_ACCOUNT);
|
||||||
|
let staking_pot = StakingPot::get();
|
||||||
|
|
||||||
|
let foreign_asset_id_location =
|
||||||
|
xcm::v3::Location::new(2, [xcm::v3::Junction::GlobalConsensus(xcm::v3::NetworkId::Rococo)]);
|
||||||
|
let foreign_asset_id_minimum_balance = 1_000_000_000;
|
||||||
|
// sovereign account as foreign asset owner (can be whoever for this scenario)
|
||||||
|
let foreign_asset_owner = LocationToAccountId::convert_location(&Location::parent()).unwrap();
|
||||||
|
let foreign_asset_create_params =
|
||||||
|
(foreign_asset_owner, foreign_asset_id_location, foreign_asset_id_minimum_balance);
|
||||||
|
|
||||||
asset_test_utils::test_cases_over_bridge::receive_reserve_asset_deposited_from_different_consensus_works::<
|
asset_test_utils::test_cases_over_bridge::receive_reserve_asset_deposited_from_different_consensus_works::<
|
||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithoutSystem,
|
AllPalletsWithoutSystem,
|
||||||
XcmConfig,
|
XcmConfig,
|
||||||
LocationToAccountId,
|
|
||||||
ForeignAssetsInstance,
|
ForeignAssetsInstance,
|
||||||
>(
|
>(
|
||||||
collator_session_keys().add(collator_session_key(BLOCK_AUTHOR_ACCOUNT)),
|
collator_session_keys().add(collator_session_key(BLOCK_AUTHOR_ACCOUNT)),
|
||||||
ExistentialDeposit::get(),
|
ExistentialDeposit::get(),
|
||||||
AccountId::from([73; 32]),
|
AccountId::from([73; 32]),
|
||||||
AccountId::from(BLOCK_AUTHOR_ACCOUNT),
|
block_author_account.clone(),
|
||||||
// receiving ROCs
|
// receiving ROCs
|
||||||
(xcm::v3::Location::new(2, [xcm::v3::Junction::GlobalConsensus(xcm::v3::NetworkId::Rococo)]), 1000000000000, 1_000_000_000),
|
foreign_asset_create_params.clone(),
|
||||||
bridging_to_asset_hub_rococo,
|
1000000000000,
|
||||||
|
|| {
|
||||||
|
// setup pool for paying fees to touch `SwapFirstAssetTrader`
|
||||||
|
setup_pool_for_paying_fees_with_foreign_assets(foreign_asset_create_params);
|
||||||
|
// staking pot account for collecting local native fees from `BuyExecution`
|
||||||
|
let _ = Balances::force_set_balance(RuntimeOrigin::root(), StakingPot::get().into(), ExistentialDeposit::get());
|
||||||
|
// prepare bridge configuration
|
||||||
|
bridging_to_asset_hub_rococo()
|
||||||
|
},
|
||||||
(
|
(
|
||||||
[PalletInstance(bp_bridge_hub_westend::WITH_BRIDGE_WESTEND_TO_ROCOCO_MESSAGES_PALLET_INDEX)].into(),
|
[PalletInstance(bp_bridge_hub_westend::WITH_BRIDGE_WESTEND_TO_ROCOCO_MESSAGES_PALLET_INDEX)].into(),
|
||||||
GlobalConsensus(Rococo),
|
GlobalConsensus(Rococo),
|
||||||
[Parachain(1000)].into()
|
[Parachain(1000)].into()
|
||||||
)
|
),
|
||||||
|
|| {
|
||||||
|
// check staking pot for ED
|
||||||
|
assert_eq!(Balances::free_balance(&staking_pot), ExistentialDeposit::get());
|
||||||
|
// check now foreign asset for staking pot
|
||||||
|
assert_eq!(
|
||||||
|
ForeignAssets::balance(
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
&staking_pot
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|| {
|
||||||
|
// `SwapFirstAssetTrader` - staking pot receives xcm fees in ROCs
|
||||||
|
assert!(
|
||||||
|
Balances::free_balance(&staking_pot) > ExistentialDeposit::get()
|
||||||
|
);
|
||||||
|
// staking pot receives no foreign assets
|
||||||
|
assert_eq!(
|
||||||
|
ForeignAssets::balance(
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
&staking_pot
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn receive_reserve_asset_deposited_roc_from_asset_hub_rococo_fees_paid_by_sufficient_asset_works() {
|
||||||
|
const BLOCK_AUTHOR_ACCOUNT: [u8; 32] = [13; 32];
|
||||||
|
let block_author_account = AccountId::from(BLOCK_AUTHOR_ACCOUNT);
|
||||||
|
let staking_pot = StakingPot::get();
|
||||||
|
|
||||||
|
let foreign_asset_id_location =
|
||||||
|
xcm::v3::Location::new(2, [xcm::v3::Junction::GlobalConsensus(xcm::v3::NetworkId::Rococo)]);
|
||||||
|
let foreign_asset_id_minimum_balance = 1_000_000_000;
|
||||||
|
// sovereign account as foreign asset owner (can be whoever for this scenario)
|
||||||
|
let foreign_asset_owner = LocationToAccountId::convert_location(&Location::parent()).unwrap();
|
||||||
|
let foreign_asset_create_params =
|
||||||
|
(foreign_asset_owner, foreign_asset_id_location, foreign_asset_id_minimum_balance);
|
||||||
|
|
||||||
|
asset_test_utils::test_cases_over_bridge::receive_reserve_asset_deposited_from_different_consensus_works::<
|
||||||
|
Runtime,
|
||||||
|
AllPalletsWithoutSystem,
|
||||||
|
XcmConfig,
|
||||||
|
ForeignAssetsInstance,
|
||||||
|
>(
|
||||||
|
collator_session_keys().add(collator_session_key(BLOCK_AUTHOR_ACCOUNT)),
|
||||||
|
ExistentialDeposit::get(),
|
||||||
|
AccountId::from([73; 32]),
|
||||||
|
block_author_account.clone(),
|
||||||
|
// receiving ROCs
|
||||||
|
foreign_asset_create_params,
|
||||||
|
1000000000000,
|
||||||
|
bridging_to_asset_hub_rococo,
|
||||||
|
(
|
||||||
|
[PalletInstance(bp_bridge_hub_westend::WITH_BRIDGE_WESTEND_TO_ROCOCO_MESSAGES_PALLET_INDEX)].into(),
|
||||||
|
GlobalConsensus(Rococo),
|
||||||
|
[Parachain(1000)].into()
|
||||||
|
),
|
||||||
|
|| {
|
||||||
|
// check block author before
|
||||||
|
assert_eq!(
|
||||||
|
ForeignAssets::balance(
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
&block_author_account
|
||||||
|
),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|| {
|
||||||
|
// `TakeFirstAssetTrader` puts fees to the block author
|
||||||
|
assert!(
|
||||||
|
ForeignAssets::balance(
|
||||||
|
foreign_asset_id_location.into(),
|
||||||
|
&block_author_account
|
||||||
|
) > 0
|
||||||
|
);
|
||||||
|
// `SwapFirstAssetTrader` did not work
|
||||||
|
assert_eq!(Balances::free_balance(&staking_pot), 0);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn report_bridge_status_from_xcm_bridge_router_for_rococo_works() {
|
fn report_bridge_status_from_xcm_bridge_router_for_rococo_works() {
|
||||||
asset_test_utils::test_cases_over_bridge::report_bridge_status_from_xcm_bridge_router_works::<
|
asset_test_utils::test_cases_over_bridge::report_bridge_status_from_xcm_bridge_router_works::<
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ codec = { package = "parity-scale-codec", version = "3.0.0", default-features =
|
|||||||
frame-support = { path = "../../../../../substrate/frame/support", default-features = false }
|
frame-support = { path = "../../../../../substrate/frame/support", default-features = false }
|
||||||
frame-system = { path = "../../../../../substrate/frame/system", default-features = false }
|
frame-system = { path = "../../../../../substrate/frame/system", default-features = false }
|
||||||
pallet-assets = { path = "../../../../../substrate/frame/assets", default-features = false }
|
pallet-assets = { path = "../../../../../substrate/frame/assets", default-features = false }
|
||||||
pallet-asset-conversion = { path = "../../../../../substrate/frame/asset-conversion", default-features = false }
|
|
||||||
pallet-balances = { path = "../../../../../substrate/frame/balances", default-features = false }
|
pallet-balances = { path = "../../../../../substrate/frame/balances", default-features = false }
|
||||||
pallet-session = { path = "../../../../../substrate/frame/session", default-features = false }
|
pallet-session = { path = "../../../../../substrate/frame/session", default-features = false }
|
||||||
sp-io = { path = "../../../../../substrate/primitives/io", default-features = false }
|
sp-io = { path = "../../../../../substrate/primitives/io", default-features = false }
|
||||||
@@ -56,7 +55,6 @@ std = [
|
|||||||
"cumulus-primitives-core/std",
|
"cumulus-primitives-core/std",
|
||||||
"frame-support/std",
|
"frame-support/std",
|
||||||
"frame-system/std",
|
"frame-system/std",
|
||||||
"pallet-asset-conversion/std",
|
|
||||||
"pallet-assets/std",
|
"pallet-assets/std",
|
||||||
"pallet-balances/std",
|
"pallet-balances/std",
|
||||||
"pallet-collator-selection/std",
|
"pallet-collator-selection/std",
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ use parachains_runtimes_test_utils::{
|
|||||||
SlotDurations, ValidatorIdOf, XcmReceivedFrom,
|
SlotDurations, ValidatorIdOf, XcmReceivedFrom,
|
||||||
};
|
};
|
||||||
use sp_runtime::{traits::StaticLookup, Saturating};
|
use sp_runtime::{traits::StaticLookup, Saturating};
|
||||||
use sp_std::ops::Mul;
|
|
||||||
use xcm::{latest::prelude::*, VersionedAssets};
|
use xcm::{latest::prelude::*, VersionedAssets};
|
||||||
use xcm_builder::{CreateMatcher, MatchXcm};
|
use xcm_builder::{CreateMatcher, MatchXcm};
|
||||||
use xcm_executor::{traits::ConvertLocation, XcmExecutor};
|
use xcm_executor::{traits::ConvertLocation, XcmExecutor};
|
||||||
@@ -323,20 +322,22 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
|||||||
Runtime,
|
Runtime,
|
||||||
AllPalletsWithoutSystem,
|
AllPalletsWithoutSystem,
|
||||||
XcmConfig,
|
XcmConfig,
|
||||||
LocationToAccountId,
|
|
||||||
ForeignAssetsPalletInstance,
|
ForeignAssetsPalletInstance,
|
||||||
>(
|
>(
|
||||||
collator_session_keys: CollatorSessionKeys<Runtime>,
|
collator_session_keys: CollatorSessionKeys<Runtime>,
|
||||||
existential_deposit: BalanceOf<Runtime>,
|
existential_deposit: BalanceOf<Runtime>,
|
||||||
target_account: AccountIdOf<Runtime>,
|
target_account: AccountIdOf<Runtime>,
|
||||||
block_author_account: AccountIdOf<Runtime>,
|
block_author_account: AccountIdOf<Runtime>,
|
||||||
(
|
(foreign_asset_owner, foreign_asset_id_location, foreign_asset_id_minimum_balance): (
|
||||||
foreign_asset_id_location,
|
AccountIdOf<Runtime>,
|
||||||
transfered_foreign_asset_id_amount,
|
xcm::v3::Location,
|
||||||
foreign_asset_id_minimum_balance,
|
u128,
|
||||||
): (xcm::v3::Location, u128, u128),
|
),
|
||||||
prepare_configuration: fn() -> TestBridgingConfig,
|
foreign_asset_id_amount_to_transfer: u128,
|
||||||
|
prepare_configuration: impl FnOnce() -> TestBridgingConfig,
|
||||||
(bridge_instance, universal_origin, descend_origin): (Junctions, Junction, Junctions), /* bridge adds origin manipulation on the way */
|
(bridge_instance, universal_origin, descend_origin): (Junctions, Junction, Junctions), /* bridge adds origin manipulation on the way */
|
||||||
|
additional_checks_before: impl FnOnce(),
|
||||||
|
additional_checks_after: impl FnOnce(),
|
||||||
) where
|
) where
|
||||||
Runtime: frame_system::Config
|
Runtime: frame_system::Config
|
||||||
+ pallet_balances::Config
|
+ pallet_balances::Config
|
||||||
@@ -346,15 +347,13 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
|||||||
+ pallet_collator_selection::Config
|
+ pallet_collator_selection::Config
|
||||||
+ cumulus_pallet_parachain_system::Config
|
+ cumulus_pallet_parachain_system::Config
|
||||||
+ cumulus_pallet_xcmp_queue::Config
|
+ cumulus_pallet_xcmp_queue::Config
|
||||||
+ pallet_assets::Config<ForeignAssetsPalletInstance>
|
+ pallet_assets::Config<ForeignAssetsPalletInstance>,
|
||||||
+ pallet_asset_conversion::Config,
|
|
||||||
AllPalletsWithoutSystem:
|
AllPalletsWithoutSystem:
|
||||||
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
|
OnInitialize<BlockNumberFor<Runtime>> + OnFinalize<BlockNumberFor<Runtime>>,
|
||||||
AccountIdOf<Runtime>: Into<[u8; 32]> + From<[u8; 32]>,
|
AccountIdOf<Runtime>: Into<[u8; 32]> + From<[u8; 32]>,
|
||||||
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
ValidatorIdOf<Runtime>: From<AccountIdOf<Runtime>>,
|
||||||
BalanceOf<Runtime>: From<Balance> + Into<Balance>,
|
BalanceOf<Runtime>: From<Balance> + Into<Balance>,
|
||||||
XcmConfig: xcm_executor::Config,
|
XcmConfig: xcm_executor::Config,
|
||||||
LocationToAccountId: ConvertLocation<AccountIdOf<Runtime>>,
|
|
||||||
<Runtime as pallet_assets::Config<ForeignAssetsPalletInstance>>::AssetId:
|
<Runtime as pallet_assets::Config<ForeignAssetsPalletInstance>>::AssetId:
|
||||||
From<xcm::v3::Location> + Into<xcm::v3::Location>,
|
From<xcm::v3::Location> + Into<xcm::v3::Location>,
|
||||||
<Runtime as pallet_assets::Config<ForeignAssetsPalletInstance>>::AssetIdParameter:
|
<Runtime as pallet_assets::Config<ForeignAssetsPalletInstance>>::AssetIdParameter:
|
||||||
@@ -365,9 +364,6 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
|||||||
+ Into<AccountId>,
|
+ Into<AccountId>,
|
||||||
<<Runtime as frame_system::Config>::Lookup as StaticLookup>::Source:
|
<<Runtime as frame_system::Config>::Lookup as StaticLookup>::Source:
|
||||||
From<<Runtime as frame_system::Config>::AccountId>,
|
From<<Runtime as frame_system::Config>::AccountId>,
|
||||||
<Runtime as pallet_asset_conversion::Config>::AssetKind:
|
|
||||||
From<xcm::v3::Location> + Into<xcm::v3::Location>,
|
|
||||||
<Runtime as pallet_asset_conversion::Config>::Balance: From<Balance>,
|
|
||||||
ForeignAssetsPalletInstance: 'static,
|
ForeignAssetsPalletInstance: 'static,
|
||||||
{
|
{
|
||||||
ExtBuilder::<Runtime>::default()
|
ExtBuilder::<Runtime>::default()
|
||||||
@@ -382,88 +378,31 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
|||||||
block_author_account.clone().into(),
|
block_author_account.clone().into(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// prepare bridge config
|
|
||||||
let TestBridgingConfig { local_bridge_hub_location, .. } = prepare_configuration();
|
|
||||||
|
|
||||||
// drip 'ED' user target account
|
// drip 'ED' user target account
|
||||||
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(
|
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(
|
||||||
&target_account,
|
&target_account,
|
||||||
existential_deposit,
|
existential_deposit,
|
||||||
);
|
);
|
||||||
|
|
||||||
// sovereign account as foreign asset owner (can be whoever for this scenario, doesnt
|
|
||||||
// matter)
|
|
||||||
let sovereign_account_as_owner_of_foreign_asset =
|
|
||||||
LocationToAccountId::convert_location(&Location::parent()).unwrap();
|
|
||||||
|
|
||||||
// staking pot account for collecting local native fees from `BuyExecution`
|
|
||||||
let staking_pot = <pallet_collator_selection::Pallet<Runtime>>::account_id();
|
|
||||||
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(
|
|
||||||
&staking_pot,
|
|
||||||
existential_deposit,
|
|
||||||
);
|
|
||||||
|
|
||||||
// create foreign asset for wrapped/derivated representation
|
// create foreign asset for wrapped/derivated representation
|
||||||
assert_ok!(
|
assert_ok!(
|
||||||
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::force_create(
|
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::force_create(
|
||||||
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::root_origin(),
|
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::root_origin(),
|
||||||
foreign_asset_id_location.into(),
|
foreign_asset_id_location.into(),
|
||||||
sovereign_account_as_owner_of_foreign_asset.clone().into(),
|
foreign_asset_owner.into(),
|
||||||
true, // is_sufficient=true
|
true, // is_sufficient=true
|
||||||
foreign_asset_id_minimum_balance.into()
|
foreign_asset_id_minimum_balance.into()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// setup a pool to pay fees with `foreign_asset_id_location` tokens
|
// prepare bridge config
|
||||||
let pool_owner: AccountIdOf<Runtime> = [1u8; 32].into();
|
let TestBridgingConfig { local_bridge_hub_location, .. } = prepare_configuration();
|
||||||
let native_asset = xcm::v3::Location::parent();
|
|
||||||
let pool_liquidity: u128 =
|
|
||||||
existential_deposit.into().max(foreign_asset_id_minimum_balance).mul(100_000);
|
|
||||||
|
|
||||||
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(
|
|
||||||
&pool_owner,
|
|
||||||
(existential_deposit.into() + pool_liquidity).mul(2).into(),
|
|
||||||
);
|
|
||||||
|
|
||||||
assert_ok!(<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::mint(
|
|
||||||
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::origin_of(
|
|
||||||
sovereign_account_as_owner_of_foreign_asset
|
|
||||||
),
|
|
||||||
foreign_asset_id_location.into(),
|
|
||||||
pool_owner.clone().into(),
|
|
||||||
(foreign_asset_id_minimum_balance + pool_liquidity).mul(2).into(),
|
|
||||||
));
|
|
||||||
|
|
||||||
assert_ok!(<pallet_asset_conversion::Pallet<Runtime>>::create_pool(
|
|
||||||
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::origin_of(pool_owner.clone()),
|
|
||||||
Box::new(native_asset.into()),
|
|
||||||
Box::new(foreign_asset_id_location.into())
|
|
||||||
));
|
|
||||||
|
|
||||||
assert_ok!(<pallet_asset_conversion::Pallet<Runtime>>::add_liquidity(
|
|
||||||
RuntimeHelper::<Runtime, AllPalletsWithoutSystem>::origin_of(pool_owner.clone()),
|
|
||||||
Box::new(native_asset.into()),
|
|
||||||
Box::new(foreign_asset_id_location.into()),
|
|
||||||
pool_liquidity.into(),
|
|
||||||
pool_liquidity.into(),
|
|
||||||
1.into(),
|
|
||||||
1.into(),
|
|
||||||
pool_owner,
|
|
||||||
));
|
|
||||||
|
|
||||||
// Balances before
|
// Balances before
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
<pallet_balances::Pallet<Runtime>>::free_balance(&target_account),
|
<pallet_balances::Pallet<Runtime>>::free_balance(&target_account),
|
||||||
existential_deposit.clone()
|
existential_deposit.clone()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
|
||||||
<pallet_balances::Pallet<Runtime>>::free_balance(&block_author_account),
|
|
||||||
0.into()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
<pallet_balances::Pallet<Runtime>>::free_balance(&staking_pot),
|
|
||||||
existential_deposit.clone()
|
|
||||||
);
|
|
||||||
|
|
||||||
// ForeignAssets balances before
|
// ForeignAssets balances before
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -473,27 +412,16 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
|||||||
),
|
),
|
||||||
0.into()
|
0.into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
|
||||||
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
|
// additional check before
|
||||||
foreign_asset_id_location.into(),
|
additional_checks_before();
|
||||||
&block_author_account
|
|
||||||
),
|
|
||||||
0.into()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
|
|
||||||
foreign_asset_id_location.into(),
|
|
||||||
&staking_pot
|
|
||||||
),
|
|
||||||
0.into()
|
|
||||||
);
|
|
||||||
|
|
||||||
let foreign_asset_id_location_latest: Location =
|
let foreign_asset_id_location_latest: Location =
|
||||||
foreign_asset_id_location.try_into().unwrap();
|
foreign_asset_id_location.try_into().unwrap();
|
||||||
|
|
||||||
let expected_assets = Assets::from(vec![Asset {
|
let expected_assets = Assets::from(vec![Asset {
|
||||||
id: AssetId(foreign_asset_id_location_latest.clone()),
|
id: AssetId(foreign_asset_id_location_latest.clone()),
|
||||||
fun: Fungible(transfered_foreign_asset_id_amount),
|
fun: Fungible(foreign_asset_id_amount_to_transfer),
|
||||||
}]);
|
}]);
|
||||||
let expected_beneficiary = Location::new(
|
let expected_beneficiary = Location::new(
|
||||||
0,
|
0,
|
||||||
@@ -510,7 +438,7 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
|||||||
BuyExecution {
|
BuyExecution {
|
||||||
fees: Asset {
|
fees: Asset {
|
||||||
id: AssetId(foreign_asset_id_location_latest.clone()),
|
id: AssetId(foreign_asset_id_location_latest.clone()),
|
||||||
fun: Fungible(transfered_foreign_asset_id_amount),
|
fun: Fungible(foreign_asset_id_amount_to_transfer),
|
||||||
},
|
},
|
||||||
weight_limit: Unlimited,
|
weight_limit: Unlimited,
|
||||||
},
|
},
|
||||||
@@ -544,19 +472,10 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
|||||||
assert_ok!(outcome.ensure_complete());
|
assert_ok!(outcome.ensure_complete());
|
||||||
|
|
||||||
// Balances after
|
// Balances after
|
||||||
// staking pot receives xcm fees in dot
|
|
||||||
assert!(
|
|
||||||
<pallet_balances::Pallet<Runtime>>::free_balance(&staking_pot) !=
|
|
||||||
existential_deposit
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
<pallet_balances::Pallet<Runtime>>::free_balance(&target_account),
|
<pallet_balances::Pallet<Runtime>>::free_balance(&target_account),
|
||||||
existential_deposit.clone()
|
existential_deposit.clone()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
|
||||||
<pallet_balances::Pallet<Runtime>>::free_balance(&block_author_account),
|
|
||||||
0.into()
|
|
||||||
);
|
|
||||||
|
|
||||||
// ForeignAssets balances after
|
// ForeignAssets balances after
|
||||||
assert!(
|
assert!(
|
||||||
@@ -565,20 +484,9 @@ pub fn receive_reserve_asset_deposited_from_different_consensus_works<
|
|||||||
&target_account
|
&target_account
|
||||||
) > 0.into()
|
) > 0.into()
|
||||||
);
|
);
|
||||||
assert_eq!(
|
|
||||||
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
|
// additional check after
|
||||||
foreign_asset_id_location.into(),
|
additional_checks_after();
|
||||||
&staking_pot
|
|
||||||
),
|
|
||||||
0.into()
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
<pallet_assets::Pallet<Runtime, ForeignAssetsPalletInstance>>::balance(
|
|
||||||
foreign_asset_id_location.into(),
|
|
||||||
&block_author_account
|
|
||||||
),
|
|
||||||
0.into()
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user