diff --git a/orml b/orml index 8d0763728..61e7e2792 160000 --- a/orml +++ b/orml @@ -1 +1 @@ -Subproject commit 8d076372849a4dced5468f0f14db96b7145160ee +Subproject commit 61e7e27923e3d9e5bfdf19438be9f30e6d653994 diff --git a/runtime/acala/src/lib.rs b/runtime/acala/src/lib.rs index ac642c964..898c7579f 100644 --- a/runtime/acala/src/lib.rs +++ b/runtime/acala/src/lib.rs @@ -63,7 +63,7 @@ use orml_traits::{ use pallet_transaction_payment::RuntimeDispatchInfo; pub use cumulus_primitives_core::ParaId; -pub use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; +pub use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; pub use polkadot_parachain::primitives::Sibling; pub use xcm::latest::prelude::*; @@ -1618,6 +1618,7 @@ pub type LocalAssetTransactor = MultiCurrencyAdapter< LocationToAccountId, CurrencyId, CurrencyIdConvert, + DepositToAlternative, >; //TODO: use token registry currency type encoding diff --git a/runtime/integration-tests/src/relaychain/kusama_cross_chain_transfer.rs b/runtime/integration-tests/src/relaychain/kusama_cross_chain_transfer.rs index 4110f8091..b800d6cb5 100644 --- a/runtime/integration-tests/src/relaychain/kusama_cross_chain_transfer.rs +++ b/runtime/integration-tests/src/relaychain/kusama_cross_chain_transfer.rs @@ -157,6 +157,34 @@ fn transfer_to_sibling() { }); } +#[test] +fn transfer_from_relay_chain_deposit_to_treasury_if_below_ed() { + KusamaNet::execute_with(|| { + assert_ok!(kusama_runtime::XcmPallet::reserve_transfer_assets( + kusama_runtime::Origin::signed(ALICE.into()), + Box::new(Parachain(2000).into().into()), + Box::new( + Junction::AccountId32 { + id: BOB, + network: NetworkId::Any + } + .into() + .into() + ), + Box::new((Here, 128_000_111).into()), + 0 + )); + }); + + Karura::execute_with(|| { + assert_eq!(Tokens::free_balance(KSM, &AccountId::from(BOB)), 0); + assert_eq!( + Tokens::free_balance(KSM, &karura_runtime::KaruraTreasuryAccount::get()), + 1_000_128_000_111 + ); + }); +} + #[test] fn xcm_transfer_execution_barrier_trader_works() { let expect_weight_limit = 600_000_000; @@ -637,7 +665,7 @@ fn trap_assets_larger_than_ed_works() { .any(|r| matches!(r.event, Event::PolkadotXcm(pallet_xcm::Event::AssetsTrapped(_, _, _))))); assert_eq!( - trader_weight_to_treasury, + trader_weight_to_treasury + dollar(KSM), Currencies::free_balance(KSM, &KaruraTreasuryAccount::get()) ); assert_eq!( @@ -693,7 +721,7 @@ fn trap_assets_lower_than_ed_works() { ); assert_eq!( - ksm_asset_amount, + ksm_asset_amount + dollar(KSM), Currencies::free_balance(KSM, &KaruraTreasuryAccount::get()) ); assert_eq!( diff --git a/runtime/integration-tests/src/relaychain/kusama_test_net.rs b/runtime/integration-tests/src/relaychain/kusama_test_net.rs index 3ff38e63c..ffd063186 100644 --- a/runtime/integration-tests/src/relaychain/kusama_test_net.rs +++ b/runtime/integration-tests/src/relaychain/kusama_test_net.rs @@ -136,7 +136,10 @@ pub fn kusama_ext() -> sp_io::TestExternalities { pub fn para_ext(parachain_id: u32) -> sp_io::TestExternalities { ExtBuilder::default() - .balances(vec![(AccountId::from(ALICE), KSM, 10 * dollar(KSM))]) + .balances(vec![ + (AccountId::from(ALICE), KSM, 10 * dollar(KSM)), + (karura_runtime::KaruraTreasuryAccount::get(), KSM, dollar(KSM)), + ]) .parachain_id(parachain_id) .build() } diff --git a/runtime/karura/src/lib.rs b/runtime/karura/src/lib.rs index 3d48cbd93..afa7c6af3 100644 --- a/runtime/karura/src/lib.rs +++ b/runtime/karura/src/lib.rs @@ -64,7 +64,7 @@ use orml_traits::{ use pallet_transaction_payment::RuntimeDispatchInfo; pub use cumulus_primitives_core::ParaId; -pub use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; +pub use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; pub use polkadot_parachain::primitives::Sibling; pub use xcm::latest::prelude::*; @@ -1737,6 +1737,7 @@ pub type LocalAssetTransactor = MultiCurrencyAdapter< LocationToAccountId, CurrencyId, CurrencyIdConvert, + DepositToAlternative, >; //TODO: use token registry currency type encoding diff --git a/runtime/mandala/src/lib.rs b/runtime/mandala/src/lib.rs index 9079268ba..1d2b1a5a6 100644 --- a/runtime/mandala/src/lib.rs +++ b/runtime/mandala/src/lib.rs @@ -83,7 +83,7 @@ use sp_version::NativeVersion; use sp_version::RuntimeVersion; pub use cumulus_primitives_core::ParaId; -pub use orml_xcm_support::{IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; +pub use orml_xcm_support::{DepositToAlternative, IsNativeConcrete, MultiCurrencyAdapter, MultiNativeAsset}; use pallet_xcm::XcmPassthrough; pub use polkadot_parachain::primitives::Sibling; pub use xcm::latest::prelude::*; @@ -1720,6 +1720,7 @@ pub type LocalAssetTransactor = MultiCurrencyAdapter< LocationToAccountId, CurrencyId, CurrencyIdConvert, + DepositToAlternative, >; //TODO: use token registry currency type encoding