mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 14:01:02 +00:00
update substrate reference (#244)
* port polkadot_runtime and polkadot_validation * update storages build (#245) * all tests pass * rebuild wasm
This commit is contained in:
committed by
GitHub
parent
e42019e1dc
commit
a65be1b2df
@@ -90,7 +90,7 @@ use client::{
|
||||
use sr_primitives::{
|
||||
ApplyResult, generic, transaction_validity::TransactionValidity,
|
||||
traits::{
|
||||
BlakeTwo256, Block as BlockT, DigestFor, StaticLookup, CurrencyToVoteHandler, AuthorityIdFor
|
||||
BlakeTwo256, Block as BlockT, DigestFor, StaticLookup, Convert, AuthorityIdFor
|
||||
}
|
||||
};
|
||||
use version::RuntimeVersion;
|
||||
@@ -188,6 +188,22 @@ impl session::Trait for Runtime {
|
||||
type Event = Event;
|
||||
}
|
||||
|
||||
/// Converter for currencies to votes.
|
||||
pub struct CurrencyToVoteHandler;
|
||||
|
||||
impl CurrencyToVoteHandler {
|
||||
fn factor() -> u128 { (Balances::total_issuance() / u64::max_value() as u128).max(1) }
|
||||
}
|
||||
|
||||
impl Convert<u128, u64> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u64 { (x / Self::factor()) as u64 }
|
||||
}
|
||||
|
||||
impl Convert<u128, u128> for CurrencyToVoteHandler {
|
||||
fn convert(x: u128) -> u128 { x * Self::factor() }
|
||||
}
|
||||
|
||||
|
||||
impl staking::Trait for Runtime {
|
||||
type OnRewardMinted = Treasury;
|
||||
type CurrencyToVote = CurrencyToVoteHandler;
|
||||
|
||||
Reference in New Issue
Block a user