Struct scrypto_test::prelude::ValidatorSubstate
source · pub struct ValidatorSubstate {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.
Trait Implementations§
source§impl Clone for ValidatorSubstate
impl Clone for ValidatorSubstate
source§fn clone(&self) -> ValidatorSubstate
fn clone(&self) -> ValidatorSubstate
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ValidatorSubstate
impl Debug for ValidatorSubstate
source§impl<D> Decode<ScryptoCustomValueKind, D> for ValidatorSubstatewhere
D: Decoder<ScryptoCustomValueKind>,
impl<D> Decode<ScryptoCustomValueKind, D> for ValidatorSubstatewhere
D: Decoder<ScryptoCustomValueKind>,
source§fn decode_body_with_value_kind(
decoder: &mut D,
value_kind: ValueKind<ScryptoCustomValueKind>
) -> Result<ValidatorSubstate, DecodeError>
fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<ScryptoCustomValueKind> ) -> Result<ValidatorSubstate, DecodeError>
source§impl Describe<ScryptoCustomTypeKind> for ValidatorSubstate
impl Describe<ScryptoCustomTypeKind> for ValidatorSubstate
source§const TYPE_ID: RustTypeId = _
const TYPE_ID: RustTypeId = _
TYPE_ID
should give a unique identifier for its SBOR schema type.
An SBOR schema type capture details about the SBOR payload, how it should be interpreted, validated and displayed. Read moresource§fn type_data() -> TypeData<ScryptoCustomTypeKind, RustTypeId>
fn type_data() -> TypeData<ScryptoCustomTypeKind, RustTypeId>
source§fn add_all_dependencies(aggregator: &mut TypeAggregator<ScryptoCustomTypeKind>)
fn add_all_dependencies(aggregator: &mut TypeAggregator<ScryptoCustomTypeKind>)
get_local_type_data
, we need to ensure that the type and all of its own references
get added to the aggregator. Read moresource§impl<E> Encode<ScryptoCustomValueKind, E> for ValidatorSubstatewhere
E: Encoder<ScryptoCustomValueKind>,
impl<E> Encode<ScryptoCustomValueKind, E> for ValidatorSubstatewhere
E: Encoder<ScryptoCustomValueKind>,
source§fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
source§fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
source§impl FieldContentSource<ValidatorStateFieldPayload> for ValidatorSubstate
impl FieldContentSource<ValidatorStateFieldPayload> for ValidatorSubstate
fn into_content(self) -> VersionedValidatorState
fn into_payload(self) -> Payload
fn into_locked_substate(self) -> FieldSubstate<Payload>
fn into_unlocked_substate(self) -> FieldSubstate<Payload>
source§impl From<ValidatorSubstate> for VersionedValidatorState
impl From<ValidatorSubstate> for VersionedValidatorState
source§fn from(value: ValidatorSubstate) -> VersionedValidatorState
fn from(value: ValidatorSubstate) -> VersionedValidatorState
source§impl PartialEq for ValidatorSubstate
impl PartialEq for ValidatorSubstate
source§fn eq(&self, other: &ValidatorSubstate) -> bool
fn eq(&self, other: &ValidatorSubstate) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl SborTuple<ScryptoCustomValueKind> for ValidatorSubstate
impl SborTuple<ScryptoCustomValueKind> for ValidatorSubstate
fn get_length(&self) -> usize
source§impl VersionedValidatorStateVersion for ValidatorSubstate
impl VersionedValidatorStateVersion for ValidatorSubstate
type Versioned = VersionedValidatorState
fn into_versioned( self ) -> <ValidatorSubstate as VersionedValidatorStateVersion>::Versioned
impl Eq for ValidatorSubstate
impl StructuralPartialEq for ValidatorSubstate
Auto Trait Implementations§
impl RefUnwindSafe for ValidatorSubstate
impl Send for ValidatorSubstate
impl Sync for ValidatorSubstate
impl Unpin for ValidatorSubstate
impl UnwindSafe for ValidatorSubstate
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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> 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
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<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
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<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.