Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Vstam1/nonfungibles adapter v2 #7344

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
443 changes: 252 additions & 191 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions runtime/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,10 @@ fn karura_liquid_staking_xcm_has_sane_weight_upper_limt() {

// should be [WithdrawAsset, BuyExecution, Transact, RefundSurplus, DepositAsset]
let blob = hex_literal::hex!("02140004000000000700e40b540213000000000700e40b54020006010700c817a804341801000006010b00c490bf4302140d010003ffffffff000100411f");
let Ok(VersionedXcm::V2(old_xcm)) =
VersionedXcm::<super::RuntimeCall>::decode(&mut &blob[..]) else { panic!("can't decode XCM blob") };
let Ok(VersionedXcm::V2(old_xcm)) = VersionedXcm::<super::RuntimeCall>::decode(&mut &blob[..])
else {
panic!("can't decode XCM blob")
};
vstam1 marked this conversation as resolved.
Show resolved Hide resolved
let mut xcm: Xcm<super::RuntimeCall> =
old_xcm.try_into().expect("conversion from v2 to v3 failed");
let weight = <XcmConfig as xcm_executor::Config>::Weigher::weight(&mut xcm)
Expand All @@ -444,9 +446,10 @@ fn karura_liquid_staking_xcm_has_sane_weight_upper_limt() {
assert!(weight.all_lte(Weight::from_parts(30_313_281_000, 72_722)));

let Some(Transact { require_weight_at_most, call, .. }) =
xcm.inner_mut().into_iter().find(|inst| matches!(inst, Transact { .. })) else {
panic!("no Transact instruction found")
};
xcm.inner_mut().into_iter().find(|inst| matches!(inst, Transact { .. }))
else {
panic!("no Transact instruction found")
};
vstam1 marked this conversation as resolved.
Show resolved Hide resolved
// should be pallet_utility.as_derivative { index: 0, call: pallet_staking::bond_extra { max_additional: 2490000000000 } }
let message_call = call.take_decoded().expect("can't decode Transact call");
let call_weight = message_call.get_dispatch_info().weight;
Expand Down
6 changes: 6 additions & 0 deletions xcm/xcm-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ pub use nonfungibles_adapter::{
NonFungiblesAdapter, NonFungiblesMutateAdapter, NonFungiblesTransferAdapter,
};

mod nonfungibles_v2_adapter;
pub use nonfungibles_v2_adapter::{
MultiLocationCollectionId, NonFungiblesV2Adapter, NonFungiblesV2MutateAdapter,
NonFungiblesV2TransferAdapter,
};

mod weight;
pub use weight::{
FixedRateOfFungible, FixedWeightBounds, TakeRevenue, UsingComponents, WeightInfoBounds,
Expand Down
2 changes: 1 addition & 1 deletion xcm/xcm-builder/src/nonfungibles_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

//! Adapters to work with `frame_support::traits::tokens::fungibles` through XCM.
//! Adapters to work with `frame_support::traits::tokens::nonfungibles` through XCM.

use crate::{AssetChecking, MintLocation};
use frame_support::{
Expand Down
Loading