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

Commit

Permalink
Deposit any left over fees back into the pre-funded account
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed May 3, 2024
1 parent 2f30d46 commit ee6bdc5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 1 addition & 2 deletions bridges/snowbridge/pallets/inbound-queue/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,8 @@ fn test_convert_transact() {
)
.unwrap();
let instructions = xcm.into_inner();
assert_eq!(instructions.len(), 7);
assert_eq!(dest_fee, 0);
let transact = instructions.get(5).unwrap().clone();
let transact = instructions.get(6).unwrap().clone();
let expected =
Transact { origin_kind, require_weight_at_most: weight_at_most, call: payload.into() };
assert_eq!(transact, expected);
Expand Down
16 changes: 14 additions & 2 deletions bridges/snowbridge/primitives/router/src/inbound/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,21 @@ where
WithdrawAsset(xcm_fee.clone().into()),
// Pay for execution.
BuyExecution { fees: xcm_fee, weight_limit: Unlimited },
SetAppendix(Xcm(vec![
RefundSurplus,
DepositAsset {
assets: Wild(AllCounted(1)),
beneficiary: Location::new(
0,
[
GlobalConsensus(Ethereum { chain_id }),
AccountKey20 { network: None, key: sender.into() },
],
),
},
SetTopic(message_id.into()),
])),
Transact { origin_kind, require_weight_at_most: weight_at_most, call: payload.into() },
// Forward message id
SetTopic(message_id.into()),
];
Ok((message.into(), Balance::zero()))
}
Expand Down

0 comments on commit ee6bdc5

Please sign in to comment.