@@ -32,6 +32,11 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
3232mod weights;
3333pub mod xcm_config;
3434
35+ use assets_common:: {
36+ foreign_creators:: ForeignCreators ,
37+ matching:: FromSiblingParachain ,
38+ MultiLocationForAssetId ,
39+ } ;
3540use cumulus_pallet_parachain_system:: RelayNumberStrictlyIncreases ;
3641use cumulus_primitives_core:: { AggregateMessageOrigin , ParaId } ;
3742use frame_support:: {
@@ -70,7 +75,7 @@ use sp_std::prelude::*;
7075#[ cfg( feature = "std" ) ]
7176use sp_version:: NativeVersion ;
7277use sp_version:: RuntimeVersion ;
73- use xcm_config:: { AssetsToBlockAuthor , XcmOriginToTransactDispatchOrigin } ;
78+ use xcm_config:: { AssetsToBlockAuthor , ForeignCreatorsSovereignAccountOf , XcmOriginToTransactDispatchOrigin } ;
7479
7580#[ cfg( any( feature = "std" , test) ) ]
7681pub use sp_runtime:: BuildStorage ;
@@ -457,6 +462,49 @@ impl pallet_assets::Config<pallet_assets::Instance1> for Runtime {
457462 type BenchmarkHelper = ( ) ;
458463}
459464
465+
466+ parameter_types ! {
467+ // we just reuse the same deposits
468+ pub const ForeignAssetsAssetDeposit : Balance = AssetDeposit :: get( ) ;
469+ pub const ForeignAssetsAssetAccountDeposit : Balance = AssetAccountDeposit :: get( ) ;
470+ pub const ForeignAssetsApprovalDeposit : Balance = ApprovalDeposit :: get( ) ;
471+ pub const ForeignAssetsAssetsStringLimit : u32 = AssetsStringLimit :: get( ) ;
472+ pub const ForeignAssetsMetadataDepositBase : Balance = MetadataDepositBase :: get( ) ;
473+ pub const ForeignAssetsMetadataDepositPerByte : Balance = MetadataDepositPerByte :: get( ) ;
474+ }
475+
476+ /// We allow root to execute privileged asset operations.
477+ pub type AssetsForceOrigin = EnsureRoot < AccountId > ;
478+
479+ /// Another pallet assets instance to store foreign assets from bridgehub.
480+ pub type ForeignAssetsInstance = pallet_assets:: Instance2 ;
481+ impl pallet_assets:: Config < ForeignAssetsInstance > for Runtime {
482+ type RuntimeEvent = RuntimeEvent ;
483+ type Balance = Balance ;
484+ type AssetId = MultiLocationForAssetId ;
485+ type AssetIdParameter = MultiLocationForAssetId ;
486+ type Currency = Balances ;
487+ type CreateOrigin = ForeignCreators <
488+ ( FromSiblingParachain < parachain_info:: Pallet < Runtime > > , ) ,
489+ ForeignCreatorsSovereignAccountOf ,
490+ AccountId ,
491+ > ;
492+ type ForceOrigin = AssetsForceOrigin ;
493+ type AssetDeposit = ForeignAssetsAssetDeposit ;
494+ type MetadataDepositBase = ForeignAssetsMetadataDepositBase ;
495+ type MetadataDepositPerByte = ForeignAssetsMetadataDepositPerByte ;
496+ type ApprovalDeposit = ForeignAssetsApprovalDeposit ;
497+ type StringLimit = ForeignAssetsAssetsStringLimit ;
498+ type Freezer = ( ) ;
499+ type Extra = ( ) ;
500+ type WeightInfo = pallet_assets:: weights:: SubstrateWeight < Runtime > ;
501+ type CallbackHandle = ( ) ;
502+ type AssetAccountDeposit = ForeignAssetsAssetAccountDeposit ;
503+ type RemoveItemsLimit = frame_support:: traits:: ConstU32 < 1000 > ;
504+ #[ cfg( feature = "runtime-benchmarks" ) ]
505+ type BenchmarkHelper = xcm_config:: XcmBenchmarkHelper ;
506+ }
507+
460508parameter_types ! {
461509 pub const ReservedXcmpWeight : Weight = MAXIMUM_BLOCK_WEIGHT . saturating_div( 4 ) ;
462510 pub const ReservedDmpWeight : Weight = MAXIMUM_BLOCK_WEIGHT . saturating_div( 4 ) ;
@@ -625,6 +673,7 @@ construct_runtime!(
625673
626674 // The main stage.
627675 Assets : pallet_assets:: <Instance1 >:: { Pallet , Call , Storage , Event <T >} = 50 ,
676+ ForeignAssets : pallet_assets:: <Instance2 >:: { Pallet , Call , Storage , Event <T >} = 51 ,
628677
629678 Sudo : pallet_sudo:: { Pallet , Call , Storage , Event <T >, Config <T >} = 255 ,
630679 }
0 commit comments