pub enum GenesisAccount {
System,
Account {
public_key: PublicKey,
balance: Motes,
validator: Option<GenesisValidator>,
},
Delegator {
validator_public_key: PublicKey,
delegator_public_key: PublicKey,
balance: Motes,
delegated_amount: Motes,
},
Administrator(AdministratorAccount),
}std only.Expand description
This enum represents possible states of a genesis account.
Variants§
System
This variant is for internal use only - genesis process will create a virtual system account and use it to call system contracts.
Account
Genesis account that will be created.
Fields
validator: Option<GenesisValidator>If set, it will make this account a genesis validator.
Delegator
The genesis delegator is a special account that will be created as a delegator. It does not have any stake of its own, but will create a real account in the system which will delegate to a genesis validator.
Fields
validator_public_key: PublicKeyValidator’s public key that has to refer to other instance of
GenesisAccount::Account with a validator field set.
Administrator(AdministratorAccount)
An administrative account in the genesis process.
This variant makes sense for some private chains.
Implementations§
Source§impl GenesisAccount
impl GenesisAccount
Sourcepub fn account(
public_key: PublicKey,
balance: Motes,
validator: Option<GenesisValidator>,
) -> Self
pub fn account( public_key: PublicKey, balance: Motes, validator: Option<GenesisValidator>, ) -> Self
Create a standard account variant.
Sourcepub fn delegator(
validator_public_key: PublicKey,
delegator_public_key: PublicKey,
balance: Motes,
delegated_amount: Motes,
) -> Self
pub fn delegator( validator_public_key: PublicKey, delegator_public_key: PublicKey, balance: Motes, delegated_amount: Motes, ) -> Self
Create a delegator account variant.
Sourcepub fn public_key(&self) -> PublicKey
pub fn public_key(&self) -> PublicKey
The public key (if any) associated with the account.
Sourcepub fn account_hash(&self) -> AccountHash
pub fn account_hash(&self) -> AccountHash
The account hash for the account.
Sourcepub fn staked_amount(&self) -> Motes
pub fn staked_amount(&self) -> Motes
How many motes are to be staked.
Staked accounts are either validators with some amount of bonded stake or delgators with some amount of delegated stake.
Sourcepub fn delegation_rate(&self) -> DelegationRate
pub fn delegation_rate(&self) -> DelegationRate
What is the delegation rate of a validator.
Sourcepub fn is_system_account(&self) -> bool
pub fn is_system_account(&self) -> bool
Is this a virtual system account.
Sourcepub fn is_validator(&self) -> bool
pub fn is_validator(&self) -> bool
Is this a validator account.
Sourcepub fn validator(&self) -> Option<&GenesisValidator>
pub fn validator(&self) -> Option<&GenesisValidator>
Details about the genesis validator.
Sourcepub fn is_delegator(&self) -> bool
pub fn is_delegator(&self) -> bool
Is this a delegator account.
Sourcepub fn as_delegator(&self) -> Option<(&PublicKey, &PublicKey, &Motes, &Motes)>
pub fn as_delegator(&self) -> Option<(&PublicKey, &PublicKey, &Motes, &Motes)>
Details about the genesis delegator.
Sourcepub fn as_administrator_account(&self) -> Option<&AdministratorAccount>
pub fn as_administrator_account(&self) -> Option<&AdministratorAccount>
Gets the administrator account variant.
Sourcepub fn try_set_validator(&mut self, genesis_validator: GenesisValidator) -> bool
pub fn try_set_validator(&mut self, genesis_validator: GenesisValidator) -> bool
Set validator.
Trait Implementations§
Source§impl Clone for GenesisAccount
impl Clone for GenesisAccount
Source§fn clone(&self) -> GenesisAccount
fn clone(&self) -> GenesisAccount
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataSize for GenesisAccountwhere
AdministratorAccount: DataSize,
impl DataSize for GenesisAccountwhere
AdministratorAccount: DataSize,
Source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
IS_DYNAMIC is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Source§impl Debug for GenesisAccount
impl Debug for GenesisAccount
Source§impl<'de> Deserialize<'de> for GenesisAccount
impl<'de> Deserialize<'de> for GenesisAccount
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Distribution<GenesisAccount> for Standard
Available on crate feature testing only.
impl Distribution<GenesisAccount> for Standard
testing only.Source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> GenesisAccount
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> GenesisAccount
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl From<AccountConfig> for GenesisAccount
impl From<AccountConfig> for GenesisAccount
Source§fn from(account_config: AccountConfig) -> Self
fn from(account_config: AccountConfig) -> Self
Source§impl From<AdministratorAccount> for GenesisAccount
impl From<AdministratorAccount> for GenesisAccount
Source§fn from(v: AdministratorAccount) -> Self
fn from(v: AdministratorAccount) -> Self
Source§impl From<DelegatorConfig> for GenesisAccount
impl From<DelegatorConfig> for GenesisAccount
Source§fn from(delegator_config: DelegatorConfig) -> Self
fn from(delegator_config: DelegatorConfig) -> Self
Source§impl FromBytes for GenesisAccount
impl FromBytes for GenesisAccount
Source§impl PartialEq for GenesisAccount
impl PartialEq for GenesisAccount
Source§impl Serialize for GenesisAccount
impl Serialize for GenesisAccount
Source§impl ToBytes for GenesisAccount
impl ToBytes for GenesisAccount
Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Vec<u8> which would be returned from a successful call to
to_bytes() or into_bytes(). The data is not actually serialized, so this call is
relatively cheap.impl Eq for GenesisAccount
impl StructuralPartialEq for GenesisAccount
Auto Trait Implementations§
impl Freeze for GenesisAccount
impl RefUnwindSafe for GenesisAccount
impl Send for GenesisAccount
impl Sync for GenesisAccount
impl Unpin for GenesisAccount
impl UnwindSafe for GenesisAccount
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more