Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Alistair/send fees with xcm #25

Merged
merged 5 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ use sp_core::H256;
const INITIAL_FUND: u128 = 5_000_000_000 * ROCOCO_ED;
const CHAIN_ID: u64 = 15;
const DEST_PARA_ID: u32 = 1000;
const SNOWBRIDGE_SOVEREIGN: [u8; 32] =
hex!("da4d66c3651dc151264eee5460493210338e41a7bbfca91a520e438daf180bf5");
const TREASURY_ACCOUNT: [u8; 32] =
hex!("6d6f646c70792f74727372790000000000000000000000000000000000000000");
const WETH: [u8; 20] = hex!("87d1f7fdfEe7f651FaBc8bFCB6E086C278b77A7d");
Expand Down Expand Up @@ -177,12 +175,6 @@ fn register_token() {
INITIAL_FUND,
)]);

// Fund ethereum sovereign in asset hub
AssetHubRococo::fund_accounts(vec![(
SNOWBRIDGE_SOVEREIGN.into(),
5_000_000_000_000 * ROCOCO_ED,
)]);

let message_id_: H256 = [1; 32].into();

BridgeHubRococo::execute_with(|| {
Expand All @@ -193,7 +185,7 @@ fn register_token() {
chain_id: CHAIN_ID,
command: Command::RegisterToken { token: WETH.into() },
});
let xcm = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, DEST_PARA_ID.into()).unwrap();

assert_expected_events!(
Expand Down Expand Up @@ -231,7 +223,6 @@ fn send_token() {

// Fund ethereum sovereign in asset hub
AssetHubRococo::fund_accounts(vec![
(SNOWBRIDGE_SOVEREIGN.into(), INITIAL_FUND),
(ASSETHUB_SOVEREIGN.into(), INITIAL_FUND),
(AssetHubRococoReceiver::get(), INITIAL_FUND),
]);
Expand All @@ -246,7 +237,7 @@ fn send_token() {
chain_id: CHAIN_ID,
command: Command::RegisterToken { token: WETH.into() },
});
let xcm = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, DEST_PARA_ID.into()).unwrap();
let message = VersionedMessage::V1(MessageV1 {
chain_id: CHAIN_ID,
Expand All @@ -256,7 +247,7 @@ fn send_token() {
amount: 1_000_000_000,
},
});
let xcm = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, DEST_PARA_ID.into()).unwrap();

assert_expected_events!(
Expand Down Expand Up @@ -294,7 +285,6 @@ fn reserve_transfer_token() {

// Fund ethereum sovereign in asset hub
AssetHubRococo::fund_accounts(vec![
(SNOWBRIDGE_SOVEREIGN.into(), INITIAL_FUND),
(ASSETHUB_SOVEREIGN.into(), INITIAL_FUND),
(AssetHubRococoReceiver::get(), INITIAL_FUND),
]);
Expand All @@ -310,7 +300,7 @@ fn reserve_transfer_token() {
chain_id: CHAIN_ID,
command: Command::RegisterToken { token: WETH.into() },
});
let xcm = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, DEST_PARA_ID.into()).unwrap();
let message = VersionedMessage::V1(MessageV1 {
chain_id: CHAIN_ID,
Expand All @@ -320,7 +310,7 @@ fn reserve_transfer_token() {
amount: WETH_AMOUNT,
},
});
let xcm = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let (xcm, _) = EthereumInboundQueue::do_convert(message_id_, message).unwrap();
let _ = EthereumInboundQueue::send_xcm(xcm, DEST_PARA_ID.into()).unwrap();

assert_expected_events!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

use crate::{
bridge_hub_rococo_config::BridgeRefundBridgeHubWococoMessages,
bridge_hub_wococo_config::BridgeRefundBridgeHubRococoMessages,
xcm_config::XcmRouter,
bridge_hub_wococo_config::BridgeRefundBridgeHubRococoMessages, xcm_config::XcmRouter,
};
use parachains_common::{
impls::DealWithFees,
Expand Down Expand Up @@ -503,7 +502,8 @@ parameter_types! {
pub const GatewayAddress: H160 = H160(hex_literal::hex!("EDa338E4dC46038493b885327842fD3E301CaB39"));
pub const CreateAssetCall: [u8;2] = [53, 0];
pub const CreateAssetExecutionFee: u128 = 2_000_000_000;
pub const SendTokenExecutionFee: u128 = 1_000_000_000;
pub const CreateAssetDeposit: u128 = (UNITS / 10) + EXISTENTIAL_DEPOSIT;
pub const SendTokenExecutionFee: u128 = 2_000_000_000;
}

#[cfg(feature = "runtime-benchmarks")]
Expand All @@ -526,8 +526,14 @@ impl snowbridge_inbound_queue::Config for Runtime {
type GatewayAddress = GatewayAddress;
#[cfg(feature = "runtime-benchmarks")]
type Helper = Runtime;
type MessageConverter =
MessageToXcm<CreateAssetCall, CreateAssetExecutionFee, SendTokenExecutionFee>;
type MessageConverter = MessageToXcm<
CreateAssetCall,
CreateAssetExecutionFee,
CreateAssetDeposit,
SendTokenExecutionFee,
AccountId,
Balance,
>;
type WeightToFee = WeightToFee;
}

Expand Down
Loading