13
13
// See the License for the specific language governing permissions and
14
14
// limitations under the License.
15
15
use crate :: { imports:: * , tests:: penpal_emulated_chain:: penpal_runtime} ;
16
- use asset_hub_westend_runtime:: xcm_config:: bridging:: to_ethereum:: DefaultBridgeHubEthereumBaseFee ;
16
+ use asset_hub_westend_runtime:: xcm_config:: {
17
+ bridging:: to_ethereum:: DefaultBridgeHubEthereumBaseFee ,
18
+ UniversalLocation as AssetHubWestendUniversalLocation ,
19
+ } ;
17
20
use bridge_hub_westend_runtime:: {
18
21
bridge_to_ethereum_config:: EthereumGatewayAddress , EthereumBeaconClient , EthereumInboundQueue ,
19
22
} ;
@@ -24,9 +27,7 @@ use hex_literal::hex;
24
27
use rococo_westend_system_emulated_network:: asset_hub_westend_emulated_chain:: genesis:: AssetHubWestendAssetOwner ;
25
28
use snowbridge_core:: { inbound:: InboundQueueFixture , AssetMetadata , TokenIdOf } ;
26
29
use snowbridge_pallet_inbound_queue_fixtures:: send_native_eth:: make_send_native_eth_message;
27
- use snowbridge_router_primitives:: inbound:: {
28
- Command , Destination , EthereumLocationsConverterFor , MessageV1 , VersionedMessage ,
29
- } ;
30
+ use snowbridge_router_primitives:: inbound:: { Command , Destination , MessageV1 , VersionedMessage } ;
30
31
use sp_core:: H256 ;
31
32
use testnet_parachains_constants:: westend:: snowbridge:: EthereumNetwork ;
32
33
use xcm_executor:: traits:: ConvertLocation ;
@@ -161,8 +162,13 @@ fn register_weth_token_from_ethereum_to_asset_hub() {
161
162
fn send_weth_token_from_ethereum_to_asset_hub ( ) {
162
163
let ethereum_network: NetworkId = EthereumNetwork :: get ( ) . into ( ) ;
163
164
let origin_location = Location :: new ( 2 , ethereum_network) ;
164
- let ethereum_sovereign: AccountId =
165
- EthereumLocationsConverterFor :: < AccountId > :: convert_location ( & origin_location) . unwrap ( ) ;
165
+ let ethereum_sovereign: AccountId = AssetHubWestend :: execute_with ( || {
166
+ ExternalConsensusLocationsConverterFor :: <
167
+ AssetHubWestendUniversalLocation ,
168
+ AccountId ,
169
+ > :: convert_location ( & origin_location)
170
+ . unwrap ( )
171
+ } ) ;
166
172
167
173
BridgeHubWestend :: fund_para_sovereign ( AssetHubWestend :: para_id ( ) . into ( ) , INITIAL_FUND ) ;
168
174
@@ -280,8 +286,13 @@ fn send_weth_from_ethereum_to_penpal() {
280
286
let origin_location = ( Parent , Parent , ethereum_network_v5) . into ( ) ;
281
287
282
288
// Fund ethereum sovereign on AssetHub
283
- let ethereum_sovereign: AccountId =
284
- EthereumLocationsConverterFor :: < AccountId > :: convert_location ( & origin_location) . unwrap ( ) ;
289
+ let ethereum_sovereign: AccountId = AssetHubWestend :: execute_with ( || {
290
+ ExternalConsensusLocationsConverterFor :: <
291
+ AssetHubWestendUniversalLocation ,
292
+ AccountId ,
293
+ > :: convert_location ( & origin_location)
294
+ . unwrap ( )
295
+ } ) ;
285
296
AssetHubWestend :: fund_accounts ( vec ! [ ( ethereum_sovereign. clone( ) , INITIAL_FUND ) ] ) ;
286
297
287
298
// Create asset on the Penpal parachain.
@@ -387,8 +398,13 @@ fn send_eth_asset_from_asset_hub_to_ethereum_and_back() {
387
398
use asset_hub_westend_runtime:: xcm_config:: bridging:: to_ethereum:: DefaultBridgeHubEthereumBaseFee ;
388
399
let assethub_location = BridgeHubWestend :: sibling_location_of ( AssetHubWestend :: para_id ( ) ) ;
389
400
let assethub_sovereign = BridgeHubWestend :: sovereign_account_id_of ( assethub_location) ;
390
- let ethereum_sovereign: AccountId =
391
- EthereumLocationsConverterFor :: < AccountId > :: convert_location ( & origin_location) . unwrap ( ) ;
401
+ let ethereum_sovereign: AccountId = AssetHubWestend :: execute_with ( || {
402
+ ExternalConsensusLocationsConverterFor :: <
403
+ AssetHubWestendUniversalLocation ,
404
+ AccountId ,
405
+ > :: convert_location ( & origin_location)
406
+ . unwrap ( )
407
+ } ) ;
392
408
393
409
AssetHubWestend :: force_default_xcm_version ( Some ( XCM_VERSION ) ) ;
394
410
BridgeHubWestend :: force_default_xcm_version ( Some ( XCM_VERSION ) ) ;
@@ -934,13 +950,17 @@ fn transfer_relay_token() {
934
950
935
951
let expected_token_id = TokenIdOf :: convert_location ( & expected_asset_id) . unwrap ( ) ;
936
952
937
- let ethereum_sovereign: AccountId =
938
- EthereumLocationsConverterFor :: < [ u8 ; 32 ] > :: convert_location ( & Location :: new (
953
+ let ethereum_sovereign: AccountId = AssetHubWestend :: execute_with ( || {
954
+ ExternalConsensusLocationsConverterFor :: <
955
+ AssetHubWestendUniversalLocation ,
956
+ [ u8 ; 32 ] ,
957
+ > :: convert_location ( & Location :: new (
939
958
2 ,
940
959
[ GlobalConsensus ( EthereumNetwork :: get ( ) ) ] ,
941
960
) )
942
961
. unwrap ( )
943
- . into ( ) ;
962
+ . into ( )
963
+ } ) ;
944
964
945
965
// Register token
946
966
BridgeHubWestend :: execute_with ( || {
@@ -1082,10 +1102,14 @@ fn transfer_ah_token() {
1082
1102
1083
1103
let ethereum_destination = Location :: new ( 2 , [ GlobalConsensus ( Ethereum { chain_id : CHAIN_ID } ) ] ) ;
1084
1104
1085
- let ethereum_sovereign: AccountId =
1086
- EthereumLocationsConverterFor :: < [ u8 ; 32 ] > :: convert_location ( & ethereum_destination)
1087
- . unwrap ( )
1088
- . into ( ) ;
1105
+ let ethereum_sovereign: AccountId = AssetHubWestend :: execute_with ( || {
1106
+ ExternalConsensusLocationsConverterFor :: <
1107
+ AssetHubWestendUniversalLocation ,
1108
+ [ u8 ; 32 ] ,
1109
+ > :: convert_location ( & ethereum_destination)
1110
+ . unwrap ( )
1111
+ . into ( )
1112
+ } ) ;
1089
1113
AssetHubWestend :: fund_accounts ( vec ! [ ( ethereum_sovereign. clone( ) , INITIAL_FUND ) ] ) ;
1090
1114
1091
1115
let asset_id: Location =
0 commit comments