Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix send_weth_asset_from_asset_hub_to_ethereum test asserts #8

Merged
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 @@ -503,6 +503,11 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
);
});

// check treasury account balance on BH before
let treasury_account_before = BridgeHubKusama::execute_with(|| {
<<BridgeHubKusama as BridgeHubKusamaPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into())
});

AssetHubKusama::execute_with(|| {
type RuntimeEvent = <AssetHubKusama as Chain>::RuntimeEvent;
type RuntimeOrigin = <AssetHubKusama as Chain>::RuntimeOrigin;
Expand Down Expand Up @@ -566,13 +571,18 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
RuntimeEvent::EthereumOutboundQueue(snowbridge_pallet_outbound_queue::Event::MessageQueued {..}) => {},
]
);

// check treasury account balance on BH after (should receive some fees)
let treasury_account_after = <<BridgeHubKusama as BridgeHubKusamaPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into());
let local_fee = treasury_account_after - treasury_account_before;

let events = BridgeHubKusama::events();
// Check that the local fee was credited to the Snowbridge sovereign account
assert!(
events.iter().any(|event| matches!(
event,
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount })
if *who == TREASURY_ACCOUNT.into() && *amount == 169033333
if *who == TREASURY_ACCOUNT.into() && *amount == local_fee
)),
"Snowbridge sovereign takes local fee."
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
);
});

// check treasury account balance on BH before
let treasury_account_before = BridgeHubPolkadot::execute_with(|| {
<<BridgeHubPolkadot as BridgeHubPolkadotPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into())
});

AssetHubPolkadot::execute_with(|| {
type RuntimeEvent = <AssetHubPolkadot as Chain>::RuntimeEvent;
type RuntimeOrigin = <AssetHubPolkadot as Chain>::RuntimeOrigin;
Expand Down Expand Up @@ -570,13 +575,18 @@ fn send_weth_asset_from_asset_hub_to_ethereum() {
RuntimeEvent::EthereumOutboundQueue(snowbridge_pallet_outbound_queue::Event::MessageQueued {..}) => {},
]
);

// check treasury account balance on BH after (should receive some fees)
let treasury_account_after = <<BridgeHubPolkadot as BridgeHubPolkadotPallet>::Balances as frame_support::traits::fungible::Inspect<_>>::balance(&TREASURY_ACCOUNT.into());
let local_fee = treasury_account_after - treasury_account_before;

let events = BridgeHubPolkadot::events();
// Check that the local fee was credited to the Snowbridge sovereign account
assert!(
events.iter().any(|event| matches!(
event,
RuntimeEvent::Balances(pallet_balances::Event::Minted { who, amount })
if *who == TREASURY_ACCOUNT.into() && *amount == 50710000
if *who == TREASURY_ACCOUNT.into() && *amount == local_fee
)),
"Snowbridge sovereign takes local fee."
);
Expand Down
Loading