Skip to content

Commit

Permalink
Shiden - burn only fee, not the tip (#817)
Browse files Browse the repository at this point in the history
* Shiden - burn only fee, not the tip

* Remove double burn

* Adjust Astar & Shibuya
  • Loading branch information
Dinonard authored Jan 9, 2023
1 parent 5422c87 commit 55e4148
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion runtime/astar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ impl OnUnbalanced<NegativeImbalance> for DealWithFees {
let (to_burn, collators) = fees.ration(20, 80);

// burn part of fees
let _ = Balances::burn(to_burn.peek());
drop(to_burn);

// pay fees to collators
<ToStakingPot as OnUnbalanced<_>>::on_unbalanced(collators);
Expand Down
2 changes: 1 addition & 1 deletion runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ impl OnUnbalanced<NegativeImbalance> for DealWithFees {
let (to_burn, collators) = fees.ration(20, 80);

// burn part of fees
let _ = Balances::burn(to_burn.peek());
drop(to_burn);

// pay fees to collators
<ToStakingPot as OnUnbalanced<_>>::on_unbalanced(collators);
Expand Down
12 changes: 10 additions & 2 deletions runtime/shiden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,8 +656,16 @@ impl WeightToFeePolynomial for WeightToFee {

pub struct BurnFees;
impl OnUnbalanced<NegativeImbalance> for BurnFees {
fn on_unbalanceds<B>(_: impl Iterator<Item = NegativeImbalance>) {
// burns the fees
/// Payout tips but burn all the fees
fn on_unbalanceds<B>(mut fees_then_tips: impl Iterator<Item = NegativeImbalance>) {
if let Some(fees_to_burn) = fees_then_tips.next() {
if let Some(tips) = fees_then_tips.next() {
<ToStakingPot as OnUnbalanced<_>>::on_unbalanced(tips);
}

// burn fees
drop(fees_to_burn);
}
}
}

Expand Down

0 comments on commit 55e4148

Please sign in to comment.