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),
}
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: PublicKey
Validator’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.
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
impl Distribution<GenesisAccount> for Standard
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<AdministratorAccount> for GenesisAccount
impl From<AdministratorAccount> for GenesisAccount
source§fn from(v: AdministratorAccount) -> Self
fn from(v: AdministratorAccount) -> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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