mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-19 22:45:40 +00:00
XCMv4 (#1230)
# Note for reviewer
Most changes are just syntax changes necessary for the new version.
Most important files should be the ones under the `xcm` folder.
# Description
Added XCMv4.
## Removed `Multi` prefix
The following types have been renamed:
- MultiLocation -> Location
- MultiAsset -> Asset
- MultiAssets -> Assets
- InteriorMultiLocation -> InteriorLocation
- MultiAssetFilter -> AssetFilter
- VersionedMultiAsset -> VersionedAsset
- WildMultiAsset -> WildAsset
- VersionedMultiLocation -> VersionedLocation
In order to fix a name conflict, the `Assets` in `xcm-executor` were
renamed to `HoldingAssets`, as they represent assets in holding.
## Removed `Abstract` asset id
It was not being used anywhere and this simplifies the code.
Now assets are just constructed as follows:
```rust
let asset: Asset = (AssetId(Location::new(1, Here)), 100u128).into();
```
No need for specifying `Concrete` anymore.
## Outcome is now a named fields struct
Instead of
```rust
pub enum Outcome {
Complete(Weight),
Incomplete(Weight, Error),
Error(Error),
}
```
we now have
```rust
pub enum Outcome {
Complete { used: Weight },
Incomplete { used: Weight, error: Error },
Error { error: Error },
}
```
## Added Reanchorable trait
Now both locations and assets implement this trait, making it easier to
reanchor both.
## New syntax for building locations and junctions
Now junctions are built using the following methods:
```rust
let location = Location {
parents: 1,
interior: [Parachain(1000), PalletInstance(50), GeneralIndex(1984)].into()
};
```
or
```rust
let location = Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)]);
```
And they are matched like so:
```rust
match location.unpack() {
(1, [Parachain(id)]) => ...
(0, Here) => ...,
(1, [_]) => ...,
}
```
This syntax is mandatory in v4, and has been also implemented for v2 and
v3 for easier migration.
This was needed to make all sizes smaller.
# TODO
- [x] Scaffold v4
- [x] Port github.com/paritytech/polkadot/pull/7236
- [x] Remove `Multi` prefix
- [x] Remove `Abstract` asset id
---------
Co-authored-by: command-bot <>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ec7bfae00a
commit
8428f678fe
@@ -45,7 +45,7 @@ fn create_default_asset<T: Config<I>, I: 'static>(
|
||||
let root = SystemOrigin::Root.into();
|
||||
assert!(Assets::<T, I>::force_create(
|
||||
root,
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
caller_lookup.clone(),
|
||||
is_sufficient,
|
||||
1u32.into(),
|
||||
@@ -64,7 +64,7 @@ pub fn create_default_minted_asset<T: Config<I>, I: 'static>(
|
||||
}
|
||||
assert!(Assets::<T, I>::mint(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
caller_lookup.clone(),
|
||||
amount,
|
||||
)
|
||||
@@ -91,7 +91,7 @@ fn add_sufficients<T: Config<I>, I: 'static>(minter: T::AccountId, n: u32) {
|
||||
let target_lookup = T::Lookup::unlookup(target);
|
||||
assert!(Assets::<T, I>::mint(
|
||||
origin.clone().into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
target_lookup,
|
||||
100u32.into()
|
||||
)
|
||||
@@ -108,8 +108,13 @@ fn add_approvals<T: Config<I>, I: 'static>(minter: T::AccountId, n: u32) {
|
||||
);
|
||||
let minter_lookup = T::Lookup::unlookup(minter.clone());
|
||||
let origin = SystemOrigin::Signed(minter);
|
||||
Assets::<T, I>::mint(origin.clone().into(), asset_id, minter_lookup, (100 * (n + 1)).into())
|
||||
.unwrap();
|
||||
Assets::<T, I>::mint(
|
||||
origin.clone().into(),
|
||||
asset_id.clone(),
|
||||
minter_lookup,
|
||||
(100 * (n + 1)).into(),
|
||||
)
|
||||
.unwrap();
|
||||
let enough = T::Currency::minimum_balance();
|
||||
for i in 0..n {
|
||||
let target = account("approval", i, SEED);
|
||||
@@ -117,7 +122,7 @@ fn add_approvals<T: Config<I>, I: 'static>(minter: T::AccountId, n: u32) {
|
||||
let target_lookup = T::Lookup::unlookup(target);
|
||||
Assets::<T, I>::approve_transfer(
|
||||
origin.clone().into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
target_lookup,
|
||||
100u32.into(),
|
||||
)
|
||||
@@ -136,12 +141,12 @@ fn assert_event<T: Config<I>, I: 'static>(generic_event: <T as Config<I>>::Runti
|
||||
benchmarks_instance_pallet! {
|
||||
create {
|
||||
let asset_id = default_asset_id::<T, I>();
|
||||
let origin = T::CreateOrigin::try_successful_origin(&asset_id.into())
|
||||
let origin = T::CreateOrigin::try_successful_origin(&asset_id.clone().into())
|
||||
.map_err(|_| BenchmarkError::Weightless)?;
|
||||
let caller = T::CreateOrigin::ensure_origin(origin.clone(), &asset_id.into()).unwrap();
|
||||
let caller = T::CreateOrigin::ensure_origin(origin.clone(), &asset_id.clone().into()).unwrap();
|
||||
let caller_lookup = T::Lookup::unlookup(caller.clone());
|
||||
T::Currency::make_free_balance_be(&caller, DepositBalanceOf::<T, I>::max_value());
|
||||
}: _<T::RuntimeOrigin>(origin, asset_id, caller_lookup, 1u32.into())
|
||||
}: _<T::RuntimeOrigin>(origin, asset_id.clone(), caller_lookup, 1u32.into())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Created { asset_id: asset_id.into(), creator: caller.clone(), owner: caller }.into());
|
||||
}
|
||||
@@ -150,7 +155,7 @@ benchmarks_instance_pallet! {
|
||||
let asset_id = default_asset_id::<T, I>();
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let caller_lookup = T::Lookup::unlookup(caller.clone());
|
||||
}: _(SystemOrigin::Root, asset_id, caller_lookup, true, 1u32.into())
|
||||
}: _(SystemOrigin::Root, asset_id.clone(), caller_lookup, true, 1u32.into())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::ForceCreated { asset_id: asset_id.into(), owner: caller }.into());
|
||||
}
|
||||
@@ -159,9 +164,9 @@ benchmarks_instance_pallet! {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, 100u32.into());
|
||||
Assets::<T, I>::freeze_asset(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
)?;
|
||||
}:_(SystemOrigin::Signed(caller), asset_id)
|
||||
}:_(SystemOrigin::Signed(caller), asset_id.clone())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::DestructionStarted { asset_id: asset_id.into() }.into());
|
||||
}
|
||||
@@ -172,10 +177,10 @@ benchmarks_instance_pallet! {
|
||||
add_sufficients::<T, I>(caller.clone(), c);
|
||||
Assets::<T, I>::freeze_asset(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
)?;
|
||||
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id)?;
|
||||
}:_(SystemOrigin::Signed(caller), asset_id)
|
||||
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id.clone())?;
|
||||
}:_(SystemOrigin::Signed(caller), asset_id.clone())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::AccountsDestroyed {
|
||||
asset_id: asset_id.into(),
|
||||
@@ -190,10 +195,10 @@ benchmarks_instance_pallet! {
|
||||
add_approvals::<T, I>(caller.clone(), a);
|
||||
Assets::<T, I>::freeze_asset(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
)?;
|
||||
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id)?;
|
||||
}:_(SystemOrigin::Signed(caller), asset_id)
|
||||
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id.clone())?;
|
||||
}:_(SystemOrigin::Signed(caller), asset_id.clone())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::ApprovalsDestroyed {
|
||||
asset_id: asset_id.into(),
|
||||
@@ -206,10 +211,10 @@ benchmarks_instance_pallet! {
|
||||
let (asset_id, caller, caller_lookup) = create_default_asset::<T, I>(true);
|
||||
Assets::<T, I>::freeze_asset(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
)?;
|
||||
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id)?;
|
||||
}:_(SystemOrigin::Signed(caller), asset_id)
|
||||
Assets::<T,I>::start_destroy(SystemOrigin::Signed(caller.clone()).into(), asset_id.clone())?;
|
||||
}:_(SystemOrigin::Signed(caller), asset_id.clone())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Destroyed {
|
||||
asset_id: asset_id.into(),
|
||||
@@ -220,7 +225,7 @@ benchmarks_instance_pallet! {
|
||||
mint {
|
||||
let (asset_id, caller, caller_lookup) = create_default_asset::<T, I>(true);
|
||||
let amount = T::Balance::from(100u32);
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, amount)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), caller_lookup, amount)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Issued { asset_id: asset_id.into(), owner: caller, amount }.into());
|
||||
}
|
||||
@@ -228,7 +233,7 @@ benchmarks_instance_pallet! {
|
||||
burn {
|
||||
let amount = T::Balance::from(100u32);
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, amount);
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, amount)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), caller_lookup, amount)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Burned { asset_id: asset_id.into(), owner: caller, balance: amount }.into());
|
||||
}
|
||||
@@ -238,7 +243,7 @@ benchmarks_instance_pallet! {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, amount);
|
||||
let target: T::AccountId = account("target", 0, SEED);
|
||||
let target_lookup = T::Lookup::unlookup(target.clone());
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, target_lookup, amount)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), target_lookup, amount)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Transferred { asset_id: asset_id.into(), from: caller, to: target, amount }.into());
|
||||
}
|
||||
@@ -249,7 +254,7 @@ benchmarks_instance_pallet! {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, mint_amount);
|
||||
let target: T::AccountId = account("target", 0, SEED);
|
||||
let target_lookup = T::Lookup::unlookup(target.clone());
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, target_lookup, amount)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), target_lookup, amount)
|
||||
verify {
|
||||
assert!(frame_system::Pallet::<T>::account_exists(&caller));
|
||||
assert_last_event::<T, I>(Event::Transferred { asset_id: asset_id.into(), from: caller, to: target, amount }.into());
|
||||
@@ -260,7 +265,7 @@ benchmarks_instance_pallet! {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, amount);
|
||||
let target: T::AccountId = account("target", 0, SEED);
|
||||
let target_lookup = T::Lookup::unlookup(target.clone());
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, target_lookup, amount)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), caller_lookup, target_lookup, amount)
|
||||
verify {
|
||||
assert_last_event::<T, I>(
|
||||
Event::Transferred { asset_id: asset_id.into(), from: caller, to: target, amount }.into()
|
||||
@@ -269,7 +274,7 @@ benchmarks_instance_pallet! {
|
||||
|
||||
freeze {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, 100u32.into());
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), caller_lookup)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Frozen { asset_id: asset_id.into(), who: caller }.into());
|
||||
}
|
||||
@@ -278,17 +283,17 @@ benchmarks_instance_pallet! {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, 100u32.into());
|
||||
Assets::<T, I>::freeze(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
caller_lookup.clone(),
|
||||
)?;
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), caller_lookup)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Thawed { asset_id: asset_id.into(), who: caller }.into());
|
||||
}
|
||||
|
||||
freeze_asset {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, 100u32.into());
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::AssetFrozen { asset_id: asset_id.into() }.into());
|
||||
}
|
||||
@@ -297,9 +302,9 @@ benchmarks_instance_pallet! {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, 100u32.into());
|
||||
Assets::<T, I>::freeze_asset(
|
||||
SystemOrigin::Signed(caller.clone()).into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
)?;
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::AssetThawed { asset_id: asset_id.into() }.into());
|
||||
}
|
||||
@@ -308,7 +313,7 @@ benchmarks_instance_pallet! {
|
||||
let (asset_id, caller, _) = create_default_asset::<T, I>(true);
|
||||
let target: T::AccountId = account("target", 0, SEED);
|
||||
let target_lookup = T::Lookup::unlookup(target.clone());
|
||||
}: _(SystemOrigin::Signed(caller), asset_id, target_lookup)
|
||||
}: _(SystemOrigin::Signed(caller), asset_id.clone(), target_lookup)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::OwnerChanged { asset_id: asset_id.into(), owner: target }.into());
|
||||
}
|
||||
@@ -318,7 +323,7 @@ benchmarks_instance_pallet! {
|
||||
let target0 = T::Lookup::unlookup(account("target", 0, SEED));
|
||||
let target1 = T::Lookup::unlookup(account("target", 1, SEED));
|
||||
let target2 = T::Lookup::unlookup(account("target", 2, SEED));
|
||||
}: _(SystemOrigin::Signed(caller), asset_id, target0, target1, target2)
|
||||
}: _(SystemOrigin::Signed(caller), asset_id.clone(), target0, target1, target2)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::TeamChanged {
|
||||
asset_id: asset_id.into(),
|
||||
@@ -338,7 +343,7 @@ benchmarks_instance_pallet! {
|
||||
|
||||
let (asset_id, caller, _) = create_default_asset::<T, I>(true);
|
||||
T::Currency::make_free_balance_be(&caller, DepositBalanceOf::<T, I>::max_value());
|
||||
}: _(SystemOrigin::Signed(caller), asset_id, name.clone(), symbol.clone(), decimals)
|
||||
}: _(SystemOrigin::Signed(caller), asset_id.clone(), name.clone(), symbol.clone(), decimals)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::MetadataSet { asset_id: asset_id.into(), name, symbol, decimals, is_frozen: false }.into());
|
||||
}
|
||||
@@ -348,8 +353,8 @@ benchmarks_instance_pallet! {
|
||||
T::Currency::make_free_balance_be(&caller, DepositBalanceOf::<T, I>::max_value());
|
||||
let dummy = vec![0u8; T::StringLimit::get() as usize];
|
||||
let origin = SystemOrigin::Signed(caller.clone()).into();
|
||||
Assets::<T, I>::set_metadata(origin, asset_id, dummy.clone(), dummy, 12)?;
|
||||
}: _(SystemOrigin::Signed(caller), asset_id)
|
||||
Assets::<T, I>::set_metadata(origin, asset_id.clone(), dummy.clone(), dummy, 12)?;
|
||||
}: _(SystemOrigin::Signed(caller), asset_id.clone())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::MetadataCleared { asset_id: asset_id.into() }.into());
|
||||
}
|
||||
@@ -367,7 +372,7 @@ benchmarks_instance_pallet! {
|
||||
let origin =
|
||||
T::ForceOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
let call = Call::<T, I>::force_set_metadata {
|
||||
id: asset_id,
|
||||
id: asset_id.clone(),
|
||||
name: name.clone(),
|
||||
symbol: symbol.clone(),
|
||||
decimals,
|
||||
@@ -383,11 +388,11 @@ benchmarks_instance_pallet! {
|
||||
T::Currency::make_free_balance_be(&caller, DepositBalanceOf::<T, I>::max_value());
|
||||
let dummy = vec![0u8; T::StringLimit::get() as usize];
|
||||
let origin = SystemOrigin::Signed(caller).into();
|
||||
Assets::<T, I>::set_metadata(origin, asset_id, dummy.clone(), dummy, 12)?;
|
||||
Assets::<T, I>::set_metadata(origin, asset_id.clone(), dummy.clone(), dummy, 12)?;
|
||||
|
||||
let origin =
|
||||
T::ForceOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
let call = Call::<T, I>::force_clear_metadata { id: asset_id };
|
||||
let call = Call::<T, I>::force_clear_metadata { id: asset_id.clone() };
|
||||
}: { call.dispatch_bypass_filter(origin)? }
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::MetadataCleared { asset_id: asset_id.into() }.into());
|
||||
@@ -399,7 +404,7 @@ benchmarks_instance_pallet! {
|
||||
let origin =
|
||||
T::ForceOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;
|
||||
let call = Call::<T, I>::force_asset_status {
|
||||
id: asset_id,
|
||||
id: asset_id.clone(),
|
||||
owner: caller_lookup.clone(),
|
||||
issuer: caller_lookup.clone(),
|
||||
admin: caller_lookup.clone(),
|
||||
@@ -420,7 +425,7 @@ benchmarks_instance_pallet! {
|
||||
let delegate: T::AccountId = account("delegate", 0, SEED);
|
||||
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
|
||||
let amount = 100u32.into();
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, delegate_lookup, amount)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), delegate_lookup, amount)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::ApprovedTransfer { asset_id: asset_id.into(), source: caller, delegate, amount }.into());
|
||||
}
|
||||
@@ -434,11 +439,11 @@ benchmarks_instance_pallet! {
|
||||
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
|
||||
let amount = 100u32.into();
|
||||
let origin = SystemOrigin::Signed(owner.clone()).into();
|
||||
Assets::<T, I>::approve_transfer(origin, asset_id, delegate_lookup, amount)?;
|
||||
Assets::<T, I>::approve_transfer(origin, asset_id.clone(), delegate_lookup, amount)?;
|
||||
|
||||
let dest: T::AccountId = account("dest", 0, SEED);
|
||||
let dest_lookup = T::Lookup::unlookup(dest.clone());
|
||||
}: _(SystemOrigin::Signed(delegate.clone()), asset_id, owner_lookup, dest_lookup, amount)
|
||||
}: _(SystemOrigin::Signed(delegate.clone()), asset_id.clone(), owner_lookup, dest_lookup, amount)
|
||||
verify {
|
||||
assert!(T::Currency::reserved_balance(&owner).is_zero());
|
||||
assert_event::<T, I>(Event::Transferred { asset_id: asset_id.into(), from: owner, to: dest, amount }.into());
|
||||
@@ -452,8 +457,8 @@ benchmarks_instance_pallet! {
|
||||
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
|
||||
let amount = 100u32.into();
|
||||
let origin = SystemOrigin::Signed(caller.clone()).into();
|
||||
Assets::<T, I>::approve_transfer(origin, asset_id, delegate_lookup.clone(), amount)?;
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, delegate_lookup)
|
||||
Assets::<T, I>::approve_transfer(origin, asset_id.clone(), delegate_lookup.clone(), amount)?;
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), delegate_lookup)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::ApprovalCancelled { asset_id: asset_id.into(), owner: caller, delegate }.into());
|
||||
}
|
||||
@@ -466,15 +471,15 @@ benchmarks_instance_pallet! {
|
||||
let delegate_lookup = T::Lookup::unlookup(delegate.clone());
|
||||
let amount = 100u32.into();
|
||||
let origin = SystemOrigin::Signed(caller.clone()).into();
|
||||
Assets::<T, I>::approve_transfer(origin, asset_id, delegate_lookup.clone(), amount)?;
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup, delegate_lookup)
|
||||
Assets::<T, I>::approve_transfer(origin, asset_id.clone(), delegate_lookup.clone(), amount)?;
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), caller_lookup, delegate_lookup)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::ApprovalCancelled { asset_id: asset_id.into(), owner: caller, delegate }.into());
|
||||
}
|
||||
|
||||
set_min_balance {
|
||||
let (asset_id, caller, caller_lookup) = create_default_asset::<T, I>(false);
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, 50u32.into())
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), 50u32.into())
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::AssetMinBalanceChanged { asset_id: asset_id.into(), new_min_balance: 50u32.into() }.into());
|
||||
}
|
||||
@@ -484,8 +489,8 @@ benchmarks_instance_pallet! {
|
||||
let new_account: T::AccountId = account("newaccount", 1, SEED);
|
||||
T::Currency::make_free_balance_be(&new_account, DepositBalanceOf::<T, I>::max_value());
|
||||
assert_ne!(asset_owner, new_account);
|
||||
assert!(!Account::<T, I>::contains_key(asset_id.into(), &new_account));
|
||||
}: _(SystemOrigin::Signed(new_account.clone()), asset_id)
|
||||
assert!(!Account::<T, I>::contains_key(asset_id.clone().into(), &new_account));
|
||||
}: _(SystemOrigin::Signed(new_account.clone()), asset_id.clone())
|
||||
verify {
|
||||
assert!(Account::<T, I>::contains_key(asset_id.into(), &new_account));
|
||||
}
|
||||
@@ -496,8 +501,8 @@ benchmarks_instance_pallet! {
|
||||
let new_account_lookup = T::Lookup::unlookup(new_account.clone());
|
||||
T::Currency::make_free_balance_be(&asset_owner, DepositBalanceOf::<T, I>::max_value());
|
||||
assert_ne!(asset_owner, new_account);
|
||||
assert!(!Account::<T, I>::contains_key(asset_id.into(), &new_account));
|
||||
}: _(SystemOrigin::Signed(asset_owner.clone()), asset_id, new_account_lookup)
|
||||
assert!(!Account::<T, I>::contains_key(asset_id.clone().into(), &new_account));
|
||||
}: _(SystemOrigin::Signed(asset_owner.clone()), asset_id.clone(), new_account_lookup)
|
||||
verify {
|
||||
assert!(Account::<T, I>::contains_key(asset_id.into(), &new_account));
|
||||
}
|
||||
@@ -509,12 +514,12 @@ benchmarks_instance_pallet! {
|
||||
assert_ne!(asset_owner, new_account);
|
||||
assert!(Assets::<T, I>::touch(
|
||||
SystemOrigin::Signed(new_account.clone()).into(),
|
||||
asset_id
|
||||
asset_id.clone()
|
||||
).is_ok());
|
||||
// `touch` should reserve balance of the caller according to the `AssetAccountDeposit` amount...
|
||||
assert_eq!(T::Currency::reserved_balance(&new_account), T::AssetAccountDeposit::get());
|
||||
// ...and also create an `Account` entry.
|
||||
assert!(Account::<T, I>::contains_key(asset_id.into(), &new_account));
|
||||
assert!(Account::<T, I>::contains_key(asset_id.clone().into(), &new_account));
|
||||
}: _(SystemOrigin::Signed(new_account.clone()), asset_id, true)
|
||||
verify {
|
||||
// `refund`ing should of course repatriate the reserve
|
||||
@@ -529,12 +534,12 @@ benchmarks_instance_pallet! {
|
||||
assert_ne!(asset_owner, new_account);
|
||||
assert!(Assets::<T, I>::touch_other(
|
||||
SystemOrigin::Signed(asset_owner.clone()).into(),
|
||||
asset_id,
|
||||
asset_id.clone(),
|
||||
new_account_lookup.clone()
|
||||
).is_ok());
|
||||
// `touch` should reserve balance of the caller according to the `AssetAccountDeposit` amount...
|
||||
assert_eq!(T::Currency::reserved_balance(&asset_owner), T::AssetAccountDeposit::get());
|
||||
assert!(Account::<T, I>::contains_key(asset_id.into(), &new_account));
|
||||
assert!(Account::<T, I>::contains_key(asset_id.clone().into(), &new_account));
|
||||
}: _(SystemOrigin::Signed(asset_owner.clone()), asset_id, new_account_lookup.clone())
|
||||
verify {
|
||||
// this should repatriate the reserved balance of the freezer
|
||||
@@ -543,7 +548,7 @@ benchmarks_instance_pallet! {
|
||||
|
||||
block {
|
||||
let (asset_id, caller, caller_lookup) = create_default_minted_asset::<T, I>(true, 100u32.into());
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id, caller_lookup)
|
||||
}: _(SystemOrigin::Signed(caller.clone()), asset_id.clone(), caller_lookup)
|
||||
verify {
|
||||
assert_last_event::<T, I>(Event::Blocked { asset_id: asset_id.into(), who: caller }.into());
|
||||
}
|
||||
|
||||
@@ -259,11 +259,7 @@ pub mod pallet {
|
||||
/// This type includes the `From<Self::AssetId>` bound, since tightly coupled pallets may
|
||||
/// want to convert an `AssetId` into a parameter for calling dispatchable functions
|
||||
/// directly.
|
||||
type AssetIdParameter: Parameter
|
||||
+ Copy
|
||||
+ From<Self::AssetId>
|
||||
+ Into<Self::AssetId>
|
||||
+ MaxEncodedLen;
|
||||
type AssetIdParameter: Parameter + From<Self::AssetId> + Into<Self::AssetId> + MaxEncodedLen;
|
||||
|
||||
/// The currency mechanism.
|
||||
type Currency: ReservableCurrency<Self::AccountId>;
|
||||
|
||||
@@ -24,7 +24,7 @@ mod tests;
|
||||
|
||||
use crate::primitives::{AccountId, UNITS};
|
||||
use sp_runtime::BuildStorage;
|
||||
use xcm::latest::{prelude::*, MultiLocation};
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::traits::ConvertLocation;
|
||||
use xcm_simulator::{decl_test_network, decl_test_parachain, decl_test_relay_chain, TestExt};
|
||||
|
||||
@@ -67,12 +67,12 @@ decl_test_network! {
|
||||
}
|
||||
|
||||
pub fn relay_sovereign_account_id() -> AccountId {
|
||||
let location: MultiLocation = (Parent,).into();
|
||||
let location: Location = (Parent,).into();
|
||||
parachain::SovereignAccountOf::convert_location(&location).unwrap()
|
||||
}
|
||||
|
||||
pub fn parachain_sovereign_account_id(para: u32) -> AccountId {
|
||||
let location: MultiLocation = (Parachain(para),).into();
|
||||
let location: Location = (Parachain(para),).into();
|
||||
relay_chain::SovereignAccountOf::convert_location(&location).unwrap()
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ pub fn parachain_account_sovereign_account_id(
|
||||
para: u32,
|
||||
who: sp_runtime::AccountId32,
|
||||
) -> AccountId {
|
||||
let location: MultiLocation = (
|
||||
let location: Location = (
|
||||
Parachain(para),
|
||||
AccountId32 { network: Some(relay_chain::RelayNetwork::get()), id: who.into() },
|
||||
)
|
||||
|
||||
@@ -96,16 +96,23 @@ pub mod pallet {
|
||||
max_weight: Weight,
|
||||
) -> Result<Weight, XcmError> {
|
||||
let hash = Encode::using_encoded(&xcm, T::Hashing::hash);
|
||||
let message_hash = Encode::using_encoded(&xcm, sp_io::hashing::blake2_256);
|
||||
let mut message_hash = Encode::using_encoded(&xcm, sp_io::hashing::blake2_256);
|
||||
let (result, event) = match Xcm::<T::RuntimeCall>::try_from(xcm) {
|
||||
Ok(xcm) => {
|
||||
let location = (Parent, Parachain(sender.into()));
|
||||
match T::XcmExecutor::execute_xcm(location, xcm, message_hash, max_weight) {
|
||||
Outcome::Error(e) => (Err(e), Event::Fail(Some(hash), e)),
|
||||
Outcome::Complete(w) => (Ok(w), Event::Success(Some(hash))),
|
||||
match T::XcmExecutor::prepare_and_execute(
|
||||
location,
|
||||
xcm,
|
||||
&mut message_hash,
|
||||
max_weight,
|
||||
Weight::zero(),
|
||||
) {
|
||||
Outcome::Error { error } => (Err(error), Event::Fail(Some(hash), error)),
|
||||
Outcome::Complete { used } => (Ok(used), Event::Success(Some(hash))),
|
||||
// As far as the caller is concerned, this was dispatched without error, so
|
||||
// we just report the weight used.
|
||||
Outcome::Incomplete(w, e) => (Ok(w), Event::Fail(Some(hash), e)),
|
||||
Outcome::Incomplete { used, error } =>
|
||||
(Ok(used), Event::Fail(Some(hash), error)),
|
||||
}
|
||||
},
|
||||
Err(()) => (Err(XcmError::UnhandledXcmVersion), Event::BadVersion(Some(hash))),
|
||||
@@ -146,7 +153,7 @@ pub mod pallet {
|
||||
limit: Weight,
|
||||
) -> Weight {
|
||||
for (_i, (_sent_at, data)) in iter.enumerate() {
|
||||
let id = sp_io::hashing::blake2_256(&data[..]);
|
||||
let mut id = sp_io::hashing::blake2_256(&data[..]);
|
||||
let maybe_versioned = VersionedXcm::<T::RuntimeCall>::decode(&mut &data[..]);
|
||||
match maybe_versioned {
|
||||
Err(_) => {
|
||||
@@ -155,7 +162,13 @@ pub mod pallet {
|
||||
Ok(versioned) => match Xcm::try_from(versioned) {
|
||||
Err(()) => Self::deposit_event(Event::UnsupportedVersion(id)),
|
||||
Ok(x) => {
|
||||
let outcome = T::XcmExecutor::execute_xcm(Parent, x.clone(), id, limit);
|
||||
let outcome = T::XcmExecutor::prepare_and_execute(
|
||||
Parent,
|
||||
x.clone(),
|
||||
&mut id,
|
||||
limit,
|
||||
Weight::zero(),
|
||||
);
|
||||
<ReceivedDmp<T>>::append(x);
|
||||
Self::deposit_event(Event::ExecutedDownward(id, outcome));
|
||||
},
|
||||
|
||||
@@ -143,10 +143,10 @@ parameter_types! {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const KsmLocation: MultiLocation = MultiLocation::parent();
|
||||
pub const TokenLocation: MultiLocation = Here.into_location();
|
||||
pub const KsmLocation: Location = Location::parent();
|
||||
pub const TokenLocation: Location = Here.into_location();
|
||||
pub const RelayNetwork: NetworkId = ByGenesis([0; 32]);
|
||||
pub UniversalLocation: InteriorMultiLocation = Parachain(MsgQueue::parachain_id().into()).into();
|
||||
pub UniversalLocation: InteriorLocation = Parachain(MsgQueue::parachain_id().into()).into();
|
||||
}
|
||||
|
||||
pub type XcmOriginToCallOrigin = (
|
||||
@@ -158,13 +158,13 @@ pub type XcmOriginToCallOrigin = (
|
||||
|
||||
parameter_types! {
|
||||
pub const XcmInstructionWeight: Weight = Weight::from_parts(1_000, 1_000);
|
||||
pub TokensPerSecondPerMegabyte: (AssetId, u128, u128) = (Concrete(Parent.into()), 1_000_000_000_000, 1024 * 1024);
|
||||
pub TokensPerSecondPerMegabyte: (AssetId, u128, u128) = (AssetId(Parent.into()), 1_000_000_000_000, 1024 * 1024);
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
pub ForeignPrefix: MultiLocation = (Parent,).into();
|
||||
pub ForeignPrefix: Location = (Parent,).into();
|
||||
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
|
||||
pub TrustedLockPairs: (MultiLocation, MultiAssetFilter) =
|
||||
(Parent.into(), Wild(AllOf { id: Concrete(Parent.into()), fun: WildFungible }));
|
||||
pub TrustedLockPairs: (Location, AssetFilter) =
|
||||
(Parent.into(), Wild(AllOf { id: AssetId(Parent.into()), fun: WildFungible }));
|
||||
}
|
||||
|
||||
pub fn estimate_message_fee(number_of_instructions: u64) -> u128 {
|
||||
@@ -188,20 +188,19 @@ pub fn estimate_fee_for_weight(weight: Weight) -> u128 {
|
||||
pub type LocalBalancesTransactor =
|
||||
XcmCurrencyAdapter<Balances, IsConcrete<TokenLocation>, SovereignAccountOf, AccountId, ()>;
|
||||
|
||||
pub struct FromMultiLocationToAsset<MultiLocation, AssetId>(PhantomData<(MultiLocation, AssetId)>);
|
||||
impl MaybeEquivalence<MultiLocation, AssetIdForAssets>
|
||||
for FromMultiLocationToAsset<MultiLocation, AssetIdForAssets>
|
||||
pub struct FromLocationToAsset<Location, AssetId>(PhantomData<(Location, AssetId)>);
|
||||
impl MaybeEquivalence<Location, AssetIdForAssets>
|
||||
for FromLocationToAsset<Location, AssetIdForAssets>
|
||||
{
|
||||
fn convert(value: &MultiLocation) -> Option<AssetIdForAssets> {
|
||||
match *value {
|
||||
MultiLocation { parents: 1, interior: Here } => Some(0 as AssetIdForAssets),
|
||||
MultiLocation { parents: 1, interior: X1(Parachain(para_id)) } =>
|
||||
Some(para_id as AssetIdForAssets),
|
||||
fn convert(value: &Location) -> Option<AssetIdForAssets> {
|
||||
match value.unpack() {
|
||||
(1, []) => Some(0 as AssetIdForAssets),
|
||||
(1, [Parachain(para_id)]) => Some(*para_id as AssetIdForAssets),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn convert_back(_id: &AssetIdForAssets) -> Option<MultiLocation> {
|
||||
fn convert_back(_id: &AssetIdForAssets) -> Option<Location> {
|
||||
None
|
||||
}
|
||||
}
|
||||
@@ -211,7 +210,7 @@ pub type ForeignAssetsTransactor = FungiblesAdapter<
|
||||
ConvertedConcreteId<
|
||||
AssetIdForAssets,
|
||||
Balance,
|
||||
FromMultiLocationToAsset<MultiLocation, AssetIdForAssets>,
|
||||
FromLocationToAsset<Location, AssetIdForAssets>,
|
||||
JustTry,
|
||||
>,
|
||||
SovereignAccountOf,
|
||||
@@ -224,18 +223,15 @@ pub type ForeignAssetsTransactor = FungiblesAdapter<
|
||||
pub type AssetTransactors = (LocalBalancesTransactor, ForeignAssetsTransactor);
|
||||
|
||||
pub struct ParentRelay;
|
||||
impl Contains<MultiLocation> for ParentRelay {
|
||||
fn contains(location: &MultiLocation) -> bool {
|
||||
impl Contains<Location> for ParentRelay {
|
||||
fn contains(location: &Location) -> bool {
|
||||
location.contains_parents_only(1)
|
||||
}
|
||||
}
|
||||
pub struct ThisParachain;
|
||||
impl Contains<MultiLocation> for ThisParachain {
|
||||
fn contains(location: &MultiLocation) -> bool {
|
||||
matches!(
|
||||
location,
|
||||
MultiLocation { parents: 0, interior: Junctions::X1(Junction::AccountId32 { .. }) }
|
||||
)
|
||||
impl Contains<Location> for ThisParachain {
|
||||
fn contains(location: &Location) -> bool {
|
||||
matches!(location.unpack(), (0, [Junction::AccountId32 { .. }]))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,12 +247,12 @@ pub type Barrier = (
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub NftCollectionOne: MultiAssetFilter
|
||||
= Wild(AllOf { fun: WildNonFungible, id: Concrete((Parent, GeneralIndex(1)).into()) });
|
||||
pub NftCollectionOneForRelay: (MultiAssetFilter, MultiLocation)
|
||||
pub NftCollectionOne: AssetFilter
|
||||
= Wild(AllOf { fun: WildNonFungible, id: AssetId((Parent, GeneralIndex(1)).into()) });
|
||||
pub NftCollectionOneForRelay: (AssetFilter, Location)
|
||||
= (NftCollectionOne::get(), Parent.into());
|
||||
pub RelayNativeAsset: MultiAssetFilter = Wild(AllOf { fun: WildFungible, id: Concrete((Parent, Here).into()) });
|
||||
pub RelayNativeAssetForRelay: (MultiAssetFilter, MultiLocation) = (RelayNativeAsset::get(), Parent.into());
|
||||
pub RelayNativeAsset: AssetFilter = Wild(AllOf { fun: WildFungible, id: AssetId((Parent, Here).into()) });
|
||||
pub RelayNativeAssetForRelay: (AssetFilter, Location) = (RelayNativeAsset::get(), Parent.into());
|
||||
}
|
||||
pub type TrustedTeleporters =
|
||||
(xcm_builder::Case<NftCollectionOneForRelay>, xcm_builder::Case<RelayNativeAssetForRelay>);
|
||||
@@ -298,10 +294,8 @@ impl mock_msg_queue::Config for Runtime {
|
||||
pub type LocalOriginToLocation = SignedToAccountId32<RuntimeOrigin, AccountId, RelayNetwork>;
|
||||
|
||||
pub struct TrustedLockerCase<T>(PhantomData<T>);
|
||||
impl<T: Get<(MultiLocation, MultiAssetFilter)>> ContainsPair<MultiLocation, MultiAsset>
|
||||
for TrustedLockerCase<T>
|
||||
{
|
||||
fn contains(origin: &MultiLocation, asset: &MultiAsset) -> bool {
|
||||
impl<T: Get<(Location, AssetFilter)>> ContainsPair<Location, Asset> for TrustedLockerCase<T> {
|
||||
fn contains(origin: &Location, asset: &Asset) -> bool {
|
||||
let (o, a) = T::get();
|
||||
a.matches(asset) && &o == origin
|
||||
}
|
||||
|
||||
@@ -107,8 +107,8 @@ impl configuration::Config for Runtime {
|
||||
|
||||
parameter_types! {
|
||||
pub RelayNetwork: NetworkId = ByGenesis([0; 32]);
|
||||
pub const TokenLocation: MultiLocation = Here.into_location();
|
||||
pub UniversalLocation: InteriorMultiLocation = Here;
|
||||
pub const TokenLocation: Location = Here.into_location();
|
||||
pub UniversalLocation: InteriorLocation = Here;
|
||||
pub UnitWeightCost: u64 = 1_000;
|
||||
}
|
||||
|
||||
@@ -134,15 +134,15 @@ type LocalOriginConverter = (
|
||||
parameter_types! {
|
||||
pub const XcmInstructionWeight: Weight = Weight::from_parts(1_000, 1_000);
|
||||
pub TokensPerSecondPerMegabyte: (AssetId, u128, u128) =
|
||||
(Concrete(TokenLocation::get()), 1_000_000_000_000, 1024 * 1024);
|
||||
(AssetId(TokenLocation::get()), 1_000_000_000_000, 1024 * 1024);
|
||||
pub const MaxInstructions: u32 = 100;
|
||||
pub const MaxAssetsIntoHolding: u32 = 64;
|
||||
}
|
||||
|
||||
pub struct ChildrenParachains;
|
||||
impl Contains<MultiLocation> for ChildrenParachains {
|
||||
fn contains(location: &MultiLocation) -> bool {
|
||||
matches!(location, MultiLocation { parents: 0, interior: X1(Parachain(_)) })
|
||||
impl Contains<Location> for ChildrenParachains {
|
||||
fn contains(location: &Location) -> bool {
|
||||
matches!(location.unpack(), (0, [Parachain(_)]))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ use frame_support::{
|
||||
use pallet_balances::{BalanceLock, Reasons};
|
||||
use pallet_contracts::{Code, CollectEvents, DebugInfo, Determinism};
|
||||
use pallet_contracts_fixtures::compile_module;
|
||||
use xcm::{v3::prelude::*, VersionedMultiLocation, VersionedXcm};
|
||||
use xcm::{v4::prelude::*, VersionedLocation, VersionedXcm};
|
||||
use xcm_simulator::TestExt;
|
||||
|
||||
type ParachainContracts = pallet_contracts::Pallet<parachain::Runtime>;
|
||||
@@ -82,7 +82,7 @@ fn test_xcm_execute() {
|
||||
let amount: u128 = 10 * CENTS;
|
||||
|
||||
// The XCM used to transfer funds to Bob.
|
||||
let message: xcm_simulator::Xcm<()> = Xcm(vec![
|
||||
let message: Xcm<()> = Xcm(vec![
|
||||
WithdrawAsset(vec![(Here, amount).into()].into()),
|
||||
DepositAsset {
|
||||
assets: All.into(),
|
||||
@@ -96,7 +96,7 @@ fn test_xcm_execute() {
|
||||
0,
|
||||
Weight::MAX,
|
||||
None,
|
||||
VersionedXcm::V3(message).encode(),
|
||||
VersionedXcm::V4(message).encode(),
|
||||
DebugInfo::UnsafeDebug,
|
||||
CollectEvents::UnsafeCollect,
|
||||
Determinism::Enforced,
|
||||
@@ -106,7 +106,7 @@ fn test_xcm_execute() {
|
||||
|
||||
let mut data = &result.data[..];
|
||||
let outcome = Outcome::decode(&mut data).expect("Failed to decode xcm_execute Outcome");
|
||||
assert_matches!(outcome, Outcome::Complete(_));
|
||||
assert_matches!(outcome, Outcome::Complete { .. });
|
||||
|
||||
// Check if the funds are subtracted from the account of Alice and added to the account of
|
||||
// Bob.
|
||||
@@ -137,7 +137,7 @@ fn test_xcm_execute_filtered_call() {
|
||||
0,
|
||||
Weight::MAX,
|
||||
None,
|
||||
VersionedXcm::V3(message).encode(),
|
||||
VersionedXcm::V4(message).encode(),
|
||||
DebugInfo::UnsafeDebug,
|
||||
CollectEvents::UnsafeCollect,
|
||||
Determinism::Enforced,
|
||||
@@ -178,7 +178,7 @@ fn test_xcm_execute_reentrant_call() {
|
||||
0,
|
||||
Weight::MAX,
|
||||
None,
|
||||
VersionedXcm::V3(message).encode(),
|
||||
VersionedXcm::V4(message).encode(),
|
||||
DebugInfo::UnsafeDebug,
|
||||
CollectEvents::UnsafeCollect,
|
||||
Determinism::Enforced,
|
||||
@@ -188,7 +188,10 @@ fn test_xcm_execute_reentrant_call() {
|
||||
|
||||
let mut data = &result.data[..];
|
||||
let outcome = Outcome::decode(&mut data).expect("Failed to decode xcm_execute Outcome");
|
||||
assert_matches!(outcome, Outcome::Incomplete(_, XcmError::ExpectationFalse));
|
||||
assert_matches!(
|
||||
outcome,
|
||||
Outcome::Incomplete { used: _, error: XcmError::ExpectationFalse }
|
||||
);
|
||||
|
||||
// Funds should not change hands as the XCM transact failed.
|
||||
assert_eq!(ParachainBalances::free_balance(BOB), INITIAL_BALANCE);
|
||||
@@ -203,15 +206,15 @@ fn test_xcm_send() {
|
||||
|
||||
// Send XCM instructions through the contract, to lock some funds on the relay chain.
|
||||
ParaA::execute_with(|| {
|
||||
let dest = MultiLocation::from(Parent);
|
||||
let dest = VersionedMultiLocation::V3(dest);
|
||||
let dest = Location::from(Parent);
|
||||
let dest = VersionedLocation::V4(dest);
|
||||
|
||||
let message: xcm_simulator::Xcm<()> = Xcm(vec![
|
||||
let message: Xcm<()> = Xcm(vec![
|
||||
WithdrawAsset((Here, fee).into()),
|
||||
BuyExecution { fees: (Here, fee).into(), weight_limit: WeightLimit::Unlimited },
|
||||
LockAsset { asset: (Here, 5 * CENTS).into(), unlocker: (Parachain(1)).into() },
|
||||
]);
|
||||
let message = VersionedXcm::V3(message);
|
||||
let message = VersionedXcm::V4(message);
|
||||
let exec = ParachainContracts::bare_call(
|
||||
ALICE,
|
||||
contract_addr.clone(),
|
||||
|
||||
@@ -2169,11 +2169,11 @@ pub mod env {
|
||||
msg_len: u32,
|
||||
output_ptr: u32,
|
||||
) -> Result<ReturnErrorCode, TrapReason> {
|
||||
use xcm::{VersionedMultiLocation, VersionedXcm};
|
||||
use xcm::{VersionedLocation, VersionedXcm};
|
||||
use xcm_builder::{SendController, SendControllerWeightInfo};
|
||||
|
||||
ctx.charge_gas(RuntimeCosts::CopyFromContract(msg_len))?;
|
||||
let dest: VersionedMultiLocation = ctx.read_sandbox_memory_as(memory, dest_ptr)?;
|
||||
let dest: VersionedLocation = ctx.read_sandbox_memory_as(memory, dest_ptr)?;
|
||||
|
||||
let message: VersionedXcm<()> =
|
||||
ctx.read_sandbox_memory_as_unbounded(memory, msg_ptr, msg_len)?;
|
||||
|
||||
@@ -26,7 +26,7 @@ use sp_std::fmt::Debug;
|
||||
use super::{fungible, fungibles, Balance, Preservation::Expendable};
|
||||
|
||||
/// Can be implemented by `PayFromAccount` using a `fungible` impl, but can also be implemented with
|
||||
/// XCM/MultiAsset and made generic over assets.
|
||||
/// XCM/Asset and made generic over assets.
|
||||
pub trait Pay {
|
||||
/// The type by which we measure units of the currency in which we make payments.
|
||||
type Balance: Balance;
|
||||
|
||||
Reference in New Issue
Block a user