Skip to content

Commit

Permalink
Burn 20% of fees in shibuya (same as shiden)
Browse files Browse the repository at this point in the history
  • Loading branch information
akru committed Nov 22, 2021
1 parent 2b6f3e0 commit 86babdc
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use codec::{Decode, Encode};
use frame_support::{
construct_runtime, parameter_types,
traits::{Contains, Currency, FindAuthor, Imbalance, OnUnbalanced},
traits::{Contains, Currency, FindAuthor, Imbalance, OnUnbalanced, SameOrOther},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, WEIGHT_PER_SECOND},
DispatchClass, Weight, WeightToFeeCoefficient, WeightToFeeCoefficients,
Expand Down Expand Up @@ -528,8 +528,17 @@ impl OnUnbalanced<NegativeImbalance> for DealWithFees {
if let Some(tips) = fees_then_tips.next() {
tips.merge_into(&mut fees);
}
let (to_burn, collators) = fees.ration(20, 80);

// burn part of fees
let burned = Balances::burn(to_burn.peek());
assert!(
matches!(burned.offset(to_burn), SameOrOther::None),
"fees burn check"
);

// pay fees to collators
<ToStakingPot as OnUnbalanced<_>>::on_unbalanced(fees);
<ToStakingPot as OnUnbalanced<_>>::on_unbalanced(collators);
}
}
}
Expand Down

0 comments on commit 86babdc

Please sign in to comment.