-
Notifications
You must be signed in to change notification settings - Fork 2
Revamp xcm for the reserver tranfer from substrate to Ethreum & Implement a custom exporter #160
Changes from 1 commit
d489756
6729e4b
046c9fb
e927ced
93f952e
88c31b1
a5a384c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -381,19 +381,15 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { | |
| let assethub_sovereign = BridgeHubRococo::sovereign_account_id_of(assethub_location); | ||
| let bridgehub_location = AssetHubRococo::sibling_location_of(BridgeHubRococo::para_id()); | ||
|
|
||
| AssetHubRococo::force_default_xcm_version(Some(XCM_VERSION)); | ||
| BridgeHubRococo::force_default_xcm_version(Some(XCM_VERSION)); | ||
| AssetHubRococo::force_xcm_version( | ||
| Location::new(2, [GlobalConsensus(Ethereum { chain_id: CHAIN_ID })]), | ||
| XCM_VERSION, | ||
| ); | ||
|
|
||
| BridgeHubRococo::fund_accounts(vec![(assethub_sovereign.clone(), INITIAL_FUND)]); | ||
|
|
||
| const WETH_AMOUNT: u128 = 1_000_000_000; | ||
| const FEE_AMOUNT: u128 = 2_750_872_500_000; | ||
| // To cover the delivery cost on BH | ||
| const LOCAL_FEE_AMOUNT: u128 = 1_000_000_000; | ||
| const LOCAL_FEE_AMOUNT: u128 = DefaultBridgeHubEthereumBaseFee::get() + 12_000_000; | ||
| // To cover the delivery cost on Ethereum | ||
| const REMOTE_FEE_AMOUNT: u128 = FEE_AMOUNT - LOCAL_FEE_AMOUNT; | ||
|
|
||
|
|
@@ -457,29 +453,36 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { | |
| BuyExecution { fees: local_fee_asset.clone(), weight_limit: Unlimited }, | ||
| DepositAsset { | ||
| assets: Wild(AllCounted(1)), | ||
| beneficiary: (AccountId32 { id: assethub_sovereign.into(), network: None },).into(), | ||
| beneficiary: | ||
| (AccountId32 { id: assethub_sovereign.clone().into(), network: None },).into(), | ||
| }, | ||
| ]); | ||
|
|
||
| let xcms = VersionedXcm::from(Xcm(vec![ | ||
| WithdrawAsset(assets.clone().into()), | ||
| SetFeesMode { jit_withdraw: true }, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why Also they want to deprecate
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fee asset(DOT) is already included in The
and check logs as follows for detail: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't the executor take fees from the holding register? DOT has already been transferred to the holding register after the execution of
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can but I don't see benefit for adding an extra Btw: polkadot-fellows/xcm-format#57 is closed so it won't impact and I expect more on polkadot-fellows/RFCs#105 which is another story. |
||
| InitiateTeleport { | ||
| assets: Definite(vec![local_fee_asset.clone()].into()), | ||
| xcm: teleport_xcm_on_bh, | ||
| dest: bridgehub_location, | ||
| }, | ||
| InitiateReserveWithdraw { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, this looks good, fairly simple 👍 Can you check what we would need for Polkadot-native assets? I suspect its
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Exactly.
Currently the destination is always
yrong marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| assets: Definite(vec![remote_fee_asset.clone(), weth_asset.clone()].into()), | ||
| // with reserve set to Ethereum destination, the ExportMessage will | ||
| // be appended to the front of the list by the SovereignPaidRemoteExporter | ||
| reserve: destination, | ||
| xcm: withdraw_xcm_on_bh, | ||
| }, | ||
| InitiateTeleport { | ||
| assets: Definite(vec![local_fee_asset.clone()].into()), | ||
| xcm: teleport_xcm_on_bh, | ||
| dest: bridgehub_location, | ||
| }, | ||
| ])); | ||
| let free_balance_before = <AssetHubRococo as AssetHubRococoPallet>::Balances::free_balance( | ||
| AssetHubRococoReceiver::get(), | ||
| ); | ||
| // Assert there is no balance left in the assethub_sovereign on BH | ||
| let free_balance_of_sovereign_on_bh_before = | ||
| <BridgeHubRococo as BridgeHubRococoPallet>::Balances::free_balance( | ||
| assethub_sovereign.clone(), | ||
| ); | ||
| assert_eq!(free_balance_of_sovereign_on_bh_before, 0); | ||
| <AssetHubRococo as AssetHubRococoPallet>::PolkadotXcm::execute( | ||
| RuntimeOrigin::signed(AssetHubRococoReceiver::get()), | ||
| bx!(xcms), | ||
|
|
@@ -504,6 +507,9 @@ fn send_weth_asset_from_asset_hub_to_ethereum() { | |
| RuntimeEvent::EthereumOutboundQueue(snowbridge_pallet_outbound_queue::Event::MessageQueued {..}) => {}, | ||
| ] | ||
| ); | ||
| let free_balance_of_sovereign_on_bh_after = | ||
| <BridgeHubRococo as BridgeHubRococoPallet>::Balances::free_balance(assethub_sovereign); | ||
| assert_eq!(free_balance_of_sovereign_on_bh_after, 955613334); | ||
|
||
| }); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should remove this initial fund as there is no need to fund the sovereign here any more.