Trait frame_support::traits::CurrencyToVote [−][src]
pub trait CurrencyToVote<B> { fn to_vote(value: B, issuance: B) -> u64; fn to_currency(value: u128, issuance: B) -> B; }
Expand description
A trait similar to Convert
to convert values from B
an abstract balance type
into u64 and back from u128. (This conversion is used in election and other places where complex
calculation over balance type is needed)
Total issuance of the currency is passed in, but an implementation of this trait may or may not use it.
WARNING
the total issuance being passed in implies that the implementation must be aware of the fact that its values can affect the outcome. This implies that if the vote value is dependent on the total issuance, it should never ber written to storage for later re-use.
Required methods
fn to_currency(value: u128, issuance: B) -> B
fn to_currency(value: u128, issuance: B) -> B
Convert u128 to balance.
Implementors
impl<B: UniqueSaturatedInto<u64> + UniqueSaturatedFrom<u128>> CurrencyToVote<B> for SaturatingCurrencyToVote