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,
},
}
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
Fields
validator: Option<GenesisValidator>
If set, it will make this account a genesis validator.
Genesis account that will be created.
Delegator
Fields
validator_public_key: PublicKey
Validator’s public key that has to refer to other instance of
GenesisAccount::Account
with a validator
field set.
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.
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 GenesisAccount
impl DataSize for GenesisAccount
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 FromBytes for GenesisAccount
impl FromBytes for GenesisAccount
source§impl PartialEq for GenesisAccount
impl PartialEq for GenesisAccount
source§fn eq(&self, other: &GenesisAccount) -> bool
fn eq(&self, other: &GenesisAccount) -> bool
self
and other
values to be equal, and is used
by ==
.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 StructuralEq for GenesisAccount
impl StructuralPartialEq for GenesisAccount
Auto Trait Implementations§
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§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.§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.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>
§impl<T> Pipe for T
impl<T> Pipe for T
§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
§impl<T> PipeDeref for T
impl<T> PipeDeref for T
§impl<T> PipeRef for T
impl<T> PipeRef for T
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
§fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_dbg<F, R>(self, func: F) -> Self
fn tap_dbg<F, R>(self, func: F) -> Self
tap
in debug builds, and does nothing in release builds.§fn tap_mut_dbg<F, R>(self, func: F) -> Self
fn tap_mut_dbg<F, R>(self, func: F) -> Self
tap_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
§fn tap_ref_dbg<F, R>(self, func: F) -> Self
fn tap_ref_dbg<F, R>(self, func: F) -> Self
tap_ref
in debug builds, and does nothing in release builds.§fn tap_ref_mut<F, R>(self, func: F) -> Self
fn tap_ref_mut<F, R>(self, func: F) -> Self
§fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self
tap_ref_mut
in debug builds, and does nothing in release builds.§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
§fn tap_borrow<F, R>(self, func: F) -> Self
fn tap_borrow<F, R>(self, func: F) -> Self
§fn tap_borrow_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_dbg<F, R>(self, func: F) -> Self
tap_borrow
in debug builds, and does nothing in release builds.§fn tap_borrow_mut<F, R>(self, func: F) -> Self
fn tap_borrow_mut<F, R>(self, func: F) -> Self
§fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self
tap_borrow_mut
in debug builds, and does nothing in release
builds.§impl<T> TapDeref for T
impl<T> TapDeref for T
§fn tap_deref_dbg<F, R>(self, func: F) -> Self
fn tap_deref_dbg<F, R>(self, func: F) -> Self
tap_deref
in debug builds, and does nothing in release builds.§fn tap_deref_mut<F, R>(self, func: F) -> Self
fn tap_deref_mut<F, R>(self, func: F) -> Self
self
for modification.§fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self
tap_deref_mut
in debug builds, and does nothing in release
builds.