Skip to content

Commit b51e3e0

Browse files
authored
burn 99% of fees, treasury gets 1% plus 100% of tips. tested successfully (#43)
tested successfully with `scripts/treasury-test.py`
1 parent 72e3f73 commit b51e3e0

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

runtime/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use frame_system::EnsureRoot;
4343

4444
/// added by SCS
4545
pub use pallet_teerex;
46-
use frame_support::traits::OnUnbalanced;
46+
use frame_support::traits::{OnUnbalanced, Imbalance};
4747

4848

4949
/// An index to a block.
@@ -165,16 +165,16 @@ impl OnUnbalanced<pallet_balances::NegativeImbalance<Runtime>> for DealWithFees
165165
mut fees_then_tips: impl Iterator<Item = pallet_balances::NegativeImbalance<Runtime>>,
166166
) {
167167
if let Some(fees) = fees_then_tips.next() {
168-
// for fees, 80% to treasury, 20% to author
169-
//let mut split = fees.ration(80, 20);
170-
/* if let Some(tips) = fees_then_tips.next() {
171-
// for tips, if any, 80% to treasury, 20% to author (though this can be anything)
172-
tips.ration_merge_into(80, 20, &mut split);
173-
}
174-
*/
175-
//everything to the Treasury
176-
Treasury::on_unbalanced(fees);
177-
// Author::on_unbalanced(split.1);
168+
// for fees, 1% to treasury, 99% burned
169+
// TODO: apply burning function based on cumulative number of extrinsics (#32)
170+
let mut split = fees.ration(1, 99);
171+
172+
// tips (voluntary extra fees) go to the treasury entirely. no burning
173+
if let Some(tips) = fees_then_tips.next() {
174+
tips.merge_into(&mut split.0);
175+
}
176+
Treasury::on_unbalanced(split.0);
177+
// burn remainder by not assigning imbalance to someone
178178
}
179179
}
180180
}

0 commit comments

Comments
 (0)