mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 22:51:13 +00:00
Companion for substrate/pull/6896 (#1610)
* make polkadot work again, * Fix build * "Update Substrate" Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
//! Auxillary struct/enums for polkadot runtime.
|
||||
|
||||
use sp_runtime::traits::Convert;
|
||||
use frame_support::traits::{OnUnbalanced, Imbalance, Currency};
|
||||
use crate::NegativeImbalance;
|
||||
|
||||
@@ -41,33 +40,3 @@ where
|
||||
<frame_system::Module<R>>::deposit_event(pallet_balances::RawEvent::Deposit(author, numeric_amount));
|
||||
}
|
||||
}
|
||||
|
||||
/// Converter for currencies to votes.
|
||||
pub struct CurrencyToVoteHandler<R>(sp_std::marker::PhantomData<R>);
|
||||
|
||||
impl<R> CurrencyToVoteHandler<R>
|
||||
where
|
||||
R: pallet_balances::Trait,
|
||||
R::Balance: Into<u128>,
|
||||
{
|
||||
fn factor() -> u128 {
|
||||
let issuance: u128 = <pallet_balances::Module<R>>::total_issuance().into();
|
||||
(issuance / u64::max_value() as u128).max(1)
|
||||
}
|
||||
}
|
||||
|
||||
impl<R> Convert<u128, u64> for CurrencyToVoteHandler<R>
|
||||
where
|
||||
R: pallet_balances::Trait,
|
||||
R::Balance: Into<u128>,
|
||||
{
|
||||
fn convert(x: u128) -> u64 { (x / Self::factor()) as u64 }
|
||||
}
|
||||
|
||||
impl<R> Convert<u128, u128> for CurrencyToVoteHandler<R>
|
||||
where
|
||||
R: pallet_balances::Trait,
|
||||
R::Balance: Into<u128>,
|
||||
{
|
||||
fn convert(x: u128) -> u128 { x * Self::factor() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user