From a36c34392fb349e9a9958d6ad428ff6024db4498 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Sat, 18 Sep 2021 15:43:58 +0200 Subject: [PATCH] burn 99% of fees, treasury gets 1% plus 100% of tips. tested successfully --- runtime/src/lib.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 9915477..cee9b13 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -43,7 +43,7 @@ use frame_system::EnsureRoot; /// added by SCS pub use pallet_teerex; -use frame_support::traits::OnUnbalanced; +use frame_support::traits::{OnUnbalanced, Imbalance}; /// An index to a block. @@ -165,16 +165,16 @@ impl OnUnbalanced> for DealWithFees mut fees_then_tips: impl Iterator>, ) { if let Some(fees) = fees_then_tips.next() { - // for fees, 80% to treasury, 20% to author - //let mut split = fees.ration(80, 20); - /* if let Some(tips) = fees_then_tips.next() { - // for tips, if any, 80% to treasury, 20% to author (though this can be anything) - tips.ration_merge_into(80, 20, &mut split); - } - */ - //everything to the Treasury - Treasury::on_unbalanced(fees); -// Author::on_unbalanced(split.1); + // for fees, 1% to treasury, 99% burned + // TODO: apply burning function based on cumulative number of extrinsics (#32) + let mut split = fees.ration(1, 99); + + // tips (voluntary extra fees) go to the treasury entirely. no burning + if let Some(tips) = fees_then_tips.next() { + tips.merge_into(&mut split.0); + } + Treasury::on_unbalanced(split.0); + // burn remainder by not assigning imbalance to someone } } }