Expand description
Proof of Stake system.
Re-exports§
pub use parameters::OwnedPosParams;pub use parameters::PosParams;pub use types::GenesisValidator;
Modules§
- epoched
EpochedandEpochedDeltaare structures for data that is set for future (and possibly past) epochs.- event
- Proof of Stake events.
- lazy_
map - Lazy map.
- lazy_
set - Lazy set.
- lazy_
vec - Lazy dynamically-sized vector.
- parameters
- Proof-of-Stake system parameters
- queries
- Queriezzz
- rewards
- PoS rewards distribution.
- slashing
- Slashing tingzzzz
- storage
- PoS functions for reading and writing to storage and lazy collection handles
associated with given
storage_keys. - storage_
key - Proof-of-Stake storage keys and storage integration.
- types
- Proof of Stake data types
- validator_
set_ update - Validator set updates
- vp
- Proof-of-Stake native validity predicate.
Structs§
- Become
Validator - Arguments to
become_validator. - Dec
- A 256 bit number with
POS_DECIMAL_PRECISIONnumber of Dec places. - Epoch
- Epoch identifier. Epochs are identified by consecutive numbers.
- Key
- A storage key is made of storage key segments
DbKeySeg, separated byKEY_SEGMENT_SEPARATOR. - LazyMap
- Lazy map.
- LazySet
- A lazy set.
- LazyVec
- Lazy dynamically-sized vector.
- Store
- PoS storage
Keys/Read/Writeimplementation
Enums§
- Become
Validator Error - Bond
Error - Commission
Rate Change Error - Consensus
KeyChange Error - Deactivation
Error - Error
- Genesis
Error - Inflation
Error - Metadata
Error - Reactivation
Error - Redelegation
Error - Slash
Error - Unbond
Error - Unjail
Validator Error - Validator
Meta Data Error
Constants§
- ADDRESS
- Address of the PoS account implemented as a native VP
- CLAIM_
REWARDS_ EVENT_ DESC - Event descriptor for claim-rewards token transfer
- SLASH_
POOL_ ADDRESS - Address of the PoS slash pool account
Traits§
- Collectable
- Trait used to facilitate collection of lazy maps into eager maps
- KeySeg
- Represents a segment in a path that may be used as a database key
- Lazy
Collection - A lazy collection of storage values.
- Option
Ext - An extension to
Optionto allow turningNonecase to an Error from a static string (handy for WASM). - Read
- Abstract PoS storage read interface
- Result
Ext - Result extension to easily wrap custom errors into
Error. - Storage
Read - Common storage read interface
- Storage
Write - Common storage write interface
Functions§
- become_
validator - Initialize data for a new validator.
- bond_
amount - Get the total bond amount, including slashes, for a given bond ID and epoch. Returns the bond amount after slashing. For future epochs, the value is subject to change.
- bond_
amounts_ for_ rewards - Get bond amounts within the
claim_start..=claim_endepoch range for claiming rewards for a given bond ID. - bond_
tokens - Self-bond tokens to a validator when
sourceisNoneor equal to thevalidatoraddress, or delegate tokens from thesourceto thevalidator. - change_
consensus_ key - Consensus key change for a validator
- change_
validator_ commission_ rate - Change the commission rate of a validator
- change_
validator_ metadata - Change validator’s metadata. In addition to changing any of the data from
ValidatorMetaData, the validator’s commission rate can be changed within here as well. - claim_
reward_ tokens - Claim available rewards, triggering an immediate transfer of tokens from the PoS account to the source address.
- compute_
and_ store_ total_ consensus_ stake - Compute and then store the total consensus stake
- copy_
genesis_ validator_ sets - Copies the validator sets into all epochs up through the pipeline epoch at genesis.
- deactivate_
validator - Deactivate a validator by removing it from any validator sets. A validator can only be deactivated if it is not jailed or already inactive.
- finalize_
block - Apply PoS updates for a block
- genesis_
validator_ set_ tendermint - Get the genesis consensus validators stake and consensus key for Tendermint,
converted from
ValidatorSetUpdates using the given function. - get_
total_ consensus_ stake - Find the total amount of tokens staked at the given
epoch, belonging to the set of consensus validators. - init_
genesis - Init genesis. Requires that the governance parameters are initialized.
- is_
delegator - Check if the provided address is a delegator address, optionally at a
particular epoch. Returns
falseif the address is a validator. - is_
validator - Check if the provided address is a validator address
- is_
validator_ frozen - Check if a validator is frozen.
- iter_
prefix_ bytes - Iterate items matching the given prefix, ordered by the storage keys.
- jail_
for_ liveness - Jail validators who failed to match the liveness threshold
- jail_
validator - Jail a validator by removing it from and updating the validator sets and
changing a its state to
Jailed. Validators are jailed for liveness and for misbehaving. - prune_
liveness_ data - Remove liveness data from storage for all validators that are not in the current consensus validator set.
- query_
reward_ tokens - Query the amount of available reward tokens for a given bond.
- raw_
bond_ amount - Get the total bond amount, without applying slashes, for a given bond ID and epoch. For future epochs, the value is subject to change.
- reactivate_
validator - Re-activate an inactive validator
- record_
liveness_ data - Record the liveness data of the consensus validators
- redelegate_
tokens - Redelegate bonded tokens from a source validator to a destination validator
- staking_
token_ address - Address of the staking token (i.e. the native token)
- unbond_
tokens - Unbond tokens that are bonded between a validator and a source (self or delegator).
- unjail_
validator - Unjail a validator that is currently jailed.
- withdraw_
tokens - Withdraw tokens from those that have been unbonded from proof-of-stake