Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
burn 99% of fees, treasury gets 1% plus 100% of tips. tested successf…
…ully
  • Loading branch information
brenzi committed Sep 18, 2021
commit a36c34392fb349e9a9958d6ad428ff6024db4498
22 changes: 11 additions & 11 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -165,16 +165,16 @@ impl OnUnbalanced<pallet_balances::NegativeImbalance<Runtime>> for DealWithFees
mut fees_then_tips: impl Iterator<Item = pallet_balances::NegativeImbalance<Runtime>>,
) {
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
}
}
}
Expand Down