Skip to content

Commit

Permalink
Burn 20% of fees in shibuya (same as shiden) (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
akru authored Nov 23, 2021
1 parent 0bbb23f commit 8324d79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 8 additions & 3 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 @@ -85,7 +85,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shibuya"),
impl_name: create_runtime_str!("shibuya"),
authoring_version: 1,
spec_version: 19,
spec_version: 20,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -528,8 +528,13 @@ 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 _ = Balances::burn(to_burn.peek());

// pay fees to collators
<ToStakingPot as OnUnbalanced<_>>::on_unbalanced(fees);
<ToStakingPot as OnUnbalanced<_>>::on_unbalanced(collators);
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions runtime/shiden/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("shiden"),
impl_name: create_runtime_str!("shiden"),
authoring_version: 1,
spec_version: 29,
spec_version: 30,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down Expand Up @@ -530,11 +530,7 @@ impl OnUnbalanced<NegativeImbalance> for DealWithFees {
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"
);
let _ = Balances::burn(to_burn.peek());

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

0 comments on commit 8324d79

Please sign in to comment.