Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

burn 99% of fees, treasury gets 1% plus 100% of tips #43

Merged
merged 1 commit into from
Sep 18, 2021
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
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