Skip to content

Commit

Permalink
".git/.scripts/commands/fmt/fmt.sh"
Browse files Browse the repository at this point in the history
  • Loading branch information
command-bot committed Oct 17, 2024
1 parent d110b31 commit 573f9ef
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ fn spend_roc_on_asset_hub() {
let native_asset = Location::parent();

let treasury_spend_call = RuntimeCall::Treasury(pallet_treasury::Call::<Runtime>::spend {
asset_kind: bx!(VersionedLocatableAsset::from((asset_hub_location.clone(), native_asset.into()))),
asset_kind: bx!(VersionedLocatableAsset::from((
asset_hub_location.clone(),
native_asset.into()
))),
amount: treasury_spend_balance,
beneficiary: bx!(VersionedLocation::from(alice_location)),
valid_from: None,
Expand Down Expand Up @@ -168,11 +171,12 @@ fn create_and_claim_treasury_spend_in_usdt() {
// treasury account on a sibling parachain.
let treasury_account =
ahr_xcm_config::LocationToAccountId::convert_location(&treasury_location).unwrap();
let asset_hub_location =
Location::new(0, Parachain(AssetHubRococo::para_id().into()));
let asset_hub_location = Location::new(0, Parachain(AssetHubRococo::para_id().into()));
let root = <Rococo as Chain>::RuntimeOrigin::root();
// asset kind to be spent from the treasury.
let asset_kind: VersionedLocatableAsset = (asset_hub_location, AssetId((PalletInstance(50), GeneralIndex(USDT_ID.into())).into())).into();
let asset_kind: VersionedLocatableAsset =
(asset_hub_location, AssetId((PalletInstance(50), GeneralIndex(USDT_ID.into())).into()))
.into();
// treasury spend beneficiary.
let alice: AccountId = Rococo::account_id_of(ALICE);
let bob: AccountId = Rococo::account_id_of(BOB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ fn create_and_claim_treasury_spend() {
let asset_hub_location = Location::new(1, [Parachain(AssetHubWestend::para_id().into())]);
let root = <CollectivesWestend as Chain>::RuntimeOrigin::root();
// asset kind to be spent from the treasury.
let asset_kind: VersionedLocatableAsset = (asset_hub_location, AssetId((PalletInstance(50), GeneralIndex(USDT_ID.into())).into())).into();
let asset_kind: VersionedLocatableAsset =
(asset_hub_location, AssetId((PalletInstance(50), GeneralIndex(USDT_ID.into())).into()))
.into();
// treasury spend beneficiary.
let alice: AccountId = Westend::account_id_of(ALICE);
let bob: AccountId = CollectivesWestend::account_id_of(BOB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ fn create_and_claim_treasury_spend() {
let asset_hub_location = Location::new(0, Parachain(AssetHubWestend::para_id().into()));
let root = <Westend as Chain>::RuntimeOrigin::root();
// asset kind to be spent from the treasury.
let asset_kind: VersionedLocatableAsset = (asset_hub_location, AssetId([PalletInstance(50), GeneralIndex(USDT_ID.into())].into())).into();
let asset_kind: VersionedLocatableAsset =
(asset_hub_location, AssetId([PalletInstance(50), GeneralIndex(USDT_ID.into())].into()))
.into();
// treasury spend beneficiary.
let alice: AccountId = Westend::account_id_of(ALICE);
let bob: AccountId = Westend::account_id_of(BOB);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ fn fellowship_treasury_spend() {
call: bx!(RuntimeCall::XcmPallet(pallet_xcm::Call::<Runtime>::teleport_assets {
dest: bx!(VersionedLocation::from(asset_hub_location.clone())),
beneficiary: bx!(VersionedLocation::from(treasury_location)),
assets: bx!(VersionedAssets::from(Assets::from(
Asset { id: native_asset.clone().into(), fun: treasury_balance.into() }
))),
assets: bx!(VersionedAssets::from(Assets::from(Asset {
id: native_asset.clone().into(),
fun: treasury_balance.into()
}))),
fee_asset_item: 0,
})),
});
Expand Down Expand Up @@ -101,7 +102,10 @@ fn fellowship_treasury_spend() {
let native_asset = Location::parent();

let treasury_spend_call = RuntimeCall::Treasury(pallet_treasury::Call::<Runtime>::spend {
asset_kind: bx!(VersionedLocatableAsset::from((asset_hub_location.clone(), native_asset.into()))),
asset_kind: bx!(VersionedLocatableAsset::from((
asset_hub_location.clone(),
native_asset.into()
))),
amount: fellowship_treasury_balance,
beneficiary: bx!(VersionedLocation::from(fellowship_treasury_location)),
valid_from: None,
Expand Down Expand Up @@ -176,7 +180,10 @@ fn fellowship_treasury_spend() {

let fellowship_treasury_spend_call =
RuntimeCall::FellowshipTreasury(pallet_treasury::Call::<Runtime, Instance1>::spend {
asset_kind: bx!(VersionedLocatableAsset::from((asset_hub_location, native_asset.into()))),
asset_kind: bx!(VersionedLocatableAsset::from((
asset_hub_location,
native_asset.into()
))),
amount: fellowship_spend_balance,
beneficiary: bx!(VersionedLocation::from(alice_location)),
valid_from: None,
Expand Down
33 changes: 10 additions & 23 deletions polkadot/runtime/common/src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,7 @@ pub enum VersionedLocatableAsset {
/// A conversion from latest xcm to `VersionedLocatableAsset`.
impl From<(xcm::latest::Location, xcm::latest::AssetId)> for VersionedLocatableAsset {
fn from(value: (xcm::latest::Location, xcm::latest::AssetId)) -> Self {
VersionedLocatableAsset::V5 {
location: value.0,
asset_id: value.1,
}
VersionedLocatableAsset::V5 { location: value.0, asset_id: value.1 }
}
}

Expand Down Expand Up @@ -253,12 +250,10 @@ pub mod benchmarks {
Location::new(0, [Parachain(seed)]),
AssetId(Location::new(
0,
[
PalletInstance(seed.try_into().unwrap()),
GeneralIndex(seed.into()),
],
))
).into()
[PalletInstance(seed.try_into().unwrap()), GeneralIndex(seed.into())],
)),
)
.into()
}
}

Expand All @@ -274,24 +269,16 @@ pub mod benchmarks {
{
fn create_asset_kind(seed: u32) -> VersionedLocatableAsset {
(
Location::new(
Parents::get(),
[Junction::Parachain(ParaId::get())],
),
Location::new(Parents::get(), [Junction::Parachain(ParaId::get())]),
AssetId(Location::new(
0,
[
PalletInstance(seed.try_into().unwrap()),
GeneralIndex(seed.into()),
],
[PalletInstance(seed.try_into().unwrap()), GeneralIndex(seed.into())],
)),
).into()
)
.into()
}
fn create_beneficiary(seed: [u8; 32]) -> VersionedLocation {
VersionedLocation::from(Location::new(
0,
[AccountId32 { network: None, id: seed }],
))
VersionedLocation::from(Location::new(0, [AccountId32 { network: None, id: seed }]))
}
}
}
Expand Down

0 comments on commit 573f9ef

Please sign in to comment.