Type Alias scrypto_test::prelude::ValidatorStateV1
source · pub type ValidatorStateV1 = ValidatorSubstate;
Aliased Type§
struct ValidatorStateV1 {Show 14 fields
pub sorted_key: Option<([u8; 2], Vec<u8>)>,
pub key: Secp256k1PublicKey,
pub is_registered: bool,
pub accepts_delegated_stake: bool,
pub validator_fee_factor: Decimal,
pub validator_fee_change_request: Option<ValidatorFeeChangeRequest>,
pub stake_unit_resource: ResourceAddress,
pub stake_xrd_vault_id: Own,
pub claim_nft: ResourceAddress,
pub pending_xrd_withdraw_vault_id: Own,
pub locked_owner_stake_unit_vault_id: Own,
pub pending_owner_stake_unit_unlock_vault_id: Own,
pub pending_owner_stake_unit_withdrawals: BTreeMap<Epoch, Decimal>,
pub already_unlocked_owner_stake_unit_amount: Decimal,
}
Fields§
§sorted_key: Option<([u8; 2], Vec<u8>)>
A key used internally for storage of registered validators sorted by their stake descending.
It is only useful when the validator is registered and has non-zero stake - hence, the field
is None
otherwise.
Note: in theory, this value could be always computed from the [is_registered
] status and
the amount stored in [stake_xrd_vault_id
]; we simply keep it cached to simplify certain
updates.
key: Secp256k1PublicKey
This validator’s public key.
is_registered: bool
Whether this validator is currently interested in participating in the consensus.
accepts_delegated_stake: bool
Whether this validator is currently accepting delegated stake or not
validator_fee_factor: Decimal
A fraction of the effective emission amount which gets transferred to the validator’s owner
(by staking it and depositing the stake units to the [locked_owner_stake_unit_vault_id
]).
Note: it is a decimal factor, not a percentage (i.e. 0.015
means “1.5%” here).
Note: it may be overridden by [validator_fee_change_request
], if it contains a change
which already became effective.
validator_fee_change_request: Option<ValidatorFeeChangeRequest>
The most recent request to change the [validator_fee_factor
] (which requires a delay).
Note: the value from this request will be used instead of [validator_fee_factor
] if the
request has already reached its effective epoch.
Note: when another change is requested, the value from this (previous) one is moved to the
[validator_fee_factor
] - provided that it became already effective. Otherwise, this
request is overwritten by the new one.
stake_unit_resource: ResourceAddress
A type of fungible resource representing stake units specific to this validator. Conceptually, “staking to validator A” means “contributing to the validator’s staking pool, and receiving the validator’s stake units which act as the pool units for the staking pool”.
stake_xrd_vault_id: Own
A vault holding the XRDs currently staked to this validator.
claim_nft: ResourceAddress
A type of non-fungible token used as a receipt for unstaked stake units.
Unstaking burns the SUs and inactivates the staked XRDs (i.e. moves it from the regular
[stake_xrd_vault_id
] to the [pending_xrd_withdraw_vault_id
]), and then requires to claim
the XRDs using this NFT after a delay (see [UnstakeData.claim_epoch
]).
pending_xrd_withdraw_vault_id: Own
A vault holding the XRDs that were unstaked (see the [unstake_nft
]) but not yet claimed.
locked_owner_stake_unit_vault_id: Own
A vault holding the SUs that this validator’s owner voluntarily decided to temporarily lock
here, as a public display of their confidence in this validator’s future reliability.
Withdrawing SUs from this vault is subject to a delay (which is configured separately from
the regular unstaking delay, see [ConsensusManagerConfigSubstate.num_owner_stake_units_unlock_epochs
]).
This vault is private to the owner (i.e. the owner’s badge is required for any interaction
with this vault).
pending_owner_stake_unit_unlock_vault_id: Own
A vault holding the SUs which the owner has decided to withdraw from their “public display”
vault (see [locked_owner_stake_unit_vault_id
]) but which have not yet been unlocked after
the mandatory delay (see [pending_owner_stake_unit_withdrawals
]).
pending_owner_stake_unit_withdrawals: BTreeMap<Epoch, Decimal>
All currently pending “delayed withdrawal” operations of the owner’s stake units vault (see
[locked_owner_stake_unit_vault_id
]).
This maps an epoch number to an amount of stake units that become unlocked at that epoch.
Note: because of performance considerations, a maximum size of this map is limited to
OWNER_STAKE_UNITS_PENDING_WITHDRAWALS_LIMIT
: starting another withdrawal will first
attempt to move any already-available amount to [already_unlocked_owner_stake_unit_amount
]
and only then will fail if the limit is exceeded.
already_unlocked_owner_stake_unit_amount: Decimal
An amount of owner’s stake units that has already waited for a sufficient number of epochs
in the [pending_owner_stake_unit_withdrawals
] and was automatically moved from there.
The very next [finish_unlock_owner_stake_units()
] operation will release this amount.