mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
Initial mechanics for 80:20 fee split (#2912)
* Initial mechanics for 80:20 fee split Also: - Introduce extra functions for Imbalance manipulation; - Store treasury pot in an account, letting total issuance account for it. * Fix some tests * Fix some tests * Minor cleanups * Update parity-codec version (#2855) * Update parity-codec version * Update grandpa, rhododendron and trie-bench * Use primitive-types from crates.io * Bump impl version * Fix trie-bench version * Fix lock files * Fix versions * Update codec to 4.1 * merge fix * Revert merge * More reversions * Remove accidental code * Update locks * Bump runtime * Update locks * Tweaks and label TODO * Update srml/treasury/src/lib.rs Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com> * Update issue number * Update core/sr-primitives/src/traits.rs Co-Authored-By: Robert Habermeier <rphmeier@gmail.com> * Fix wasm build * Fix subkey build
This commit is contained in:
@@ -21,7 +21,9 @@
|
||||
#![recursion_limit="256"]
|
||||
|
||||
use rstd::prelude::*;
|
||||
use support::{construct_runtime, parameter_types};
|
||||
use support::{
|
||||
construct_runtime, parameter_types, traits::{SplitTwoWays, Currency, OnUnbalanced}
|
||||
};
|
||||
use substrate_primitives::u32_trait::{_1, _2, _3, _4};
|
||||
use node_primitives::{
|
||||
AccountId, AccountIndex, Balance, BlockNumber, Hash, Index, Signature, AuraId
|
||||
@@ -58,8 +60,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
|
||||
spec_name: create_runtime_str!("node"),
|
||||
impl_name: create_runtime_str!("substrate-node"),
|
||||
authoring_version: 10,
|
||||
spec_version: 99,
|
||||
impl_version: 106,
|
||||
spec_version: 100,
|
||||
impl_version: 100,
|
||||
apis: RUNTIME_API_VERSIONS,
|
||||
};
|
||||
|
||||
@@ -72,6 +74,23 @@ pub fn native_version() -> NativeVersion {
|
||||
}
|
||||
}
|
||||
|
||||
type NegativeImbalance = <Balances as Currency<AccountId>>::NegativeImbalance;
|
||||
|
||||
pub struct Author;
|
||||
|
||||
impl OnUnbalanced<NegativeImbalance> for Author {
|
||||
fn on_unbalanced(amount: NegativeImbalance) {
|
||||
Balances::resolve_creating(&Authorship::author(), amount);
|
||||
}
|
||||
}
|
||||
|
||||
pub type DealWithFees = SplitTwoWays<
|
||||
Balance,
|
||||
NegativeImbalance,
|
||||
_4, Treasury, // 4 parts (80%) goes to the treasury.
|
||||
_1, Author, // 1 part (20%) goes to the block author.
|
||||
>;
|
||||
|
||||
pub struct CurrencyToVoteHandler;
|
||||
|
||||
impl CurrencyToVoteHandler {
|
||||
@@ -115,7 +134,7 @@ impl balances::Trait for Runtime {
|
||||
type OnFreeBalanceZero = ((Staking, Contracts), Session);
|
||||
type OnNewAccount = Indices;
|
||||
type Event = Event;
|
||||
type TransactionPayment = ();
|
||||
type TransactionPayment = DealWithFees;
|
||||
type DustRemoval = ();
|
||||
type TransferPayment = ();
|
||||
}
|
||||
@@ -125,6 +144,18 @@ impl timestamp::Trait for Runtime {
|
||||
type OnTimestampSet = Aura;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const UncleGenerations: u64 = 0;
|
||||
}
|
||||
|
||||
// TODO: #2986 implement this properly
|
||||
impl authorship::Trait for Runtime {
|
||||
type FindAuthor = ();
|
||||
type UncleGenerations = UncleGenerations;
|
||||
type FilterUncle = ();
|
||||
type EventHandler = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Period: BlockNumber = 10 * MINUTES;
|
||||
pub const Offset: BlockNumber = 0;
|
||||
@@ -250,6 +281,7 @@ construct_runtime!(
|
||||
System: system::{Module, Call, Storage, Config, Event},
|
||||
Aura: aura::{Module, Config<T>, Inherent(Timestamp)},
|
||||
Timestamp: timestamp::{Module, Call, Storage, Config<T>, Inherent},
|
||||
Authorship: authorship::{Module, Call, Storage},
|
||||
Indices: indices,
|
||||
Balances: balances,
|
||||
Session: session::{Module, Call, Storage, Event, Config<T>},
|
||||
|
||||
Reference in New Issue
Block a user