From 86babdc3bd1ad777786e871f5c89e2f7bee927e9 Mon Sep 17 00:00:00 2001 From: Alexander Krupenkin Date: Mon, 22 Nov 2021 08:22:23 +0300 Subject: [PATCH] Burn 20% of fees in shibuya (same as shiden) --- runtime/shibuya/src/lib.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs index 471fff9f10..5aece520b4 100644 --- a/runtime/shibuya/src/lib.rs +++ b/runtime/shibuya/src/lib.rs @@ -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, @@ -528,8 +528,17 @@ impl OnUnbalanced 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 - >::on_unbalanced(fees); + >::on_unbalanced(collators); } } }