11use sp_core:: { bounded:: BoundedVec , ConstU32 } ;
22use xcm:: v5:: prelude:: * ;
33
4+ pub const ASSET_HUB_ID : u32 = 1000 ;
5+
46pub trait Parse {
57 /// Returns the "chain" location part. It could be parent, sibling
68 /// parachain, or child parachain.
@@ -18,8 +20,8 @@ impl Parse for Location {
1820 match ( self . parents , self . first_interior ( ) ) {
1921 // sibling parachain
2022 ( 1 , Some ( Parachain ( id) ) ) => Some ( Location :: new ( 1 , [ Parachain ( * id) ] ) ) ,
21- // parent
22- ( 1 , _) => Some ( Location :: parent ( ) ) ,
23+ // parent -> assethub
24+ ( 1 , _) => Some ( Location :: new ( 1 , Parachain ( ASSET_HUB_ID ) ) ) ,
2325 // children parachain
2426 ( 0 , Some ( Parachain ( id) ) ) => Some ( Location :: new ( 0 , [ Parachain ( * id) ] ) ) ,
2527 _ => None ,
@@ -95,11 +97,11 @@ mod tests {
9597 fn parent_as_reserve_chain ( ) {
9698 assert_eq ! (
9799 AbsoluteReserveProvider :: reserve( & concrete_fungible( Location :: new( 1 , [ GENERAL_INDEX ] ) ) ) ,
98- Some ( Location :: parent ( ) )
100+ Some ( Location :: new ( 1 , Parachain ( ASSET_HUB_ID ) ) )
99101 ) ;
100102 assert_eq ! (
101103 RelativeReserveProvider :: reserve( & concrete_fungible( Location :: new( 1 , [ GENERAL_INDEX ] ) ) ) ,
102- Some ( Location :: parent ( ) )
104+ Some ( Location :: new ( 1 , Parachain ( ASSET_HUB_ID ) ) )
103105 ) ;
104106 }
105107
0 commit comments