pub struct ValidatorBid { /* private fields */ }Expand description
An entry in the validator map.
Implementations§
Source§impl ValidatorBid
impl ValidatorBid
Sourcepub fn with_min_max_delegation_amount(
self,
maximum_delegation_amount: u64,
minimum_delegation_amount: u64,
) -> Self
pub fn with_min_max_delegation_amount( self, maximum_delegation_amount: u64, minimum_delegation_amount: u64, ) -> Self
Sets the maximum and minimum delegation amounts for a validators bid.
Source§impl ValidatorBid
impl ValidatorBid
Sourcepub fn locked(
validator_public_key: PublicKey,
bonding_purse: URef,
staked_amount: U512,
delegation_rate: DelegationRate,
release_timestamp_millis: u64,
minimum_delegation_amount: u64,
maximum_delegation_amount: u64,
reserved_slots: u32,
) -> Self
pub fn locked( validator_public_key: PublicKey, bonding_purse: URef, staked_amount: U512, delegation_rate: DelegationRate, release_timestamp_millis: u64, minimum_delegation_amount: u64, maximum_delegation_amount: u64, reserved_slots: u32, ) -> Self
Creates new instance of a bid with locked funds.
Sourcepub fn unlocked(
validator_public_key: PublicKey,
bonding_purse: URef,
staked_amount: U512,
delegation_rate: DelegationRate,
minimum_delegation_amount: u64,
maximum_delegation_amount: u64,
reserved_slots: u32,
) -> Self
pub fn unlocked( validator_public_key: PublicKey, bonding_purse: URef, staked_amount: U512, delegation_rate: DelegationRate, minimum_delegation_amount: u64, maximum_delegation_amount: u64, reserved_slots: u32, ) -> Self
Creates new instance of a bid with unlocked funds.
Sourcepub fn empty(validator_public_key: PublicKey, bonding_purse: URef) -> Self
pub fn empty(validator_public_key: PublicKey, bonding_purse: URef) -> Self
Creates a new inactive instance of a bid with 0 staked amount.
Sourcepub fn validator_public_key(&self) -> &PublicKey
pub fn validator_public_key(&self) -> &PublicKey
Gets the validator public key of the provided bid
Sourcepub fn bonding_purse(&self) -> &URef
pub fn bonding_purse(&self) -> &URef
Gets the bonding purse of the provided bid
Sourcepub fn is_locked(&self, timestamp_millis: u64) -> bool
pub fn is_locked(&self, timestamp_millis: u64) -> bool
Checks if a bid is still locked under a vesting schedule.
Returns true if a timestamp falls below the initial lockup period + 91 days release schedule, otherwise false.
Sourcepub fn is_locked_with_vesting_schedule(
&self,
timestamp_millis: u64,
vesting_schedule_period_millis: u64,
) -> bool
pub fn is_locked_with_vesting_schedule( &self, timestamp_millis: u64, vesting_schedule_period_millis: u64, ) -> bool
Checks if a bid is still locked under a vesting schedule.
Returns true if a timestamp falls below the initial lockup period + 91 days release schedule, otherwise false.
Sourcepub fn staked_amount(&self) -> U512
pub fn staked_amount(&self) -> U512
Gets the staked amount of the provided bid
Sourcepub fn staked_amount_mut(&mut self) -> &mut U512
pub fn staked_amount_mut(&mut self) -> &mut U512
Gets the staked amount of the provided bid
Sourcepub fn delegation_rate(&self) -> &DelegationRate
pub fn delegation_rate(&self) -> &DelegationRate
Gets the delegation rate of the provided bid
Sourcepub fn vesting_schedule(&self) -> Option<&VestingSchedule>
pub fn vesting_schedule(&self) -> Option<&VestingSchedule>
Returns a reference to the vesting schedule of the provided bid. None if a non-genesis
validator.
Sourcepub fn vesting_schedule_mut(&mut self) -> Option<&mut VestingSchedule>
pub fn vesting_schedule_mut(&mut self) -> Option<&mut VestingSchedule>
Returns a mutable reference to the vesting schedule of the provided bid. None if a
non-genesis validator.
Sourcepub fn reserved_slots(&self) -> u32
pub fn reserved_slots(&self) -> u32
Gets the reserved slots of the provided bid
Sourcepub fn decrease_stake(
&mut self,
amount: U512,
era_end_timestamp_millis: u64,
) -> Result<U512, Error>
pub fn decrease_stake( &mut self, amount: U512, era_end_timestamp_millis: u64, ) -> Result<U512, Error>
Decreases the stake of the provided bid
Sourcepub fn increase_stake(&mut self, amount: U512) -> Result<U512, Error>
pub fn increase_stake(&mut self, amount: U512) -> Result<U512, Error>
Increases the stake of the provided bid
Sourcepub fn with_delegation_rate(
&mut self,
delegation_rate: DelegationRate,
) -> &mut Self
pub fn with_delegation_rate( &mut self, delegation_rate: DelegationRate, ) -> &mut Self
Updates the delegation rate of the provided bid
Sourcepub fn with_reserved_slots(&mut self, reserved_slots: u32) -> &mut Self
pub fn with_reserved_slots(&mut self, reserved_slots: u32) -> &mut Self
Updates the reserved slots of the provided bid
Sourcepub fn deactivate(&mut self) -> bool
pub fn deactivate(&mut self) -> bool
Sets given bid’s inactive field to true
Sourcepub fn with_validator_public_key(
&mut self,
validator_public_key: PublicKey,
) -> &mut Self
pub fn with_validator_public_key( &mut self, validator_public_key: PublicKey, ) -> &mut Self
Sets validator public key
Sourcepub fn minimum_delegation_amount(&self) -> u64
pub fn minimum_delegation_amount(&self) -> u64
Returns minimum allowed delegation amount in motes.
Sourcepub fn maximum_delegation_amount(&self) -> u64
pub fn maximum_delegation_amount(&self) -> u64
Returns maximum allowed delegation amount in motes.
Sourcepub fn set_delegation_amount_boundaries(
&mut self,
minimum_delegation_amount: u64,
maximum_delegation_amount: u64,
)
pub fn set_delegation_amount_boundaries( &mut self, minimum_delegation_amount: u64, maximum_delegation_amount: u64, )
Sets minimum and maximum delegation amounts in motes.
Trait Implementations§
Source§impl Clone for ValidatorBid
impl Clone for ValidatorBid
Source§fn clone(&self) -> ValidatorBid
fn clone(&self) -> ValidatorBid
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataSize for ValidatorBid
impl DataSize for ValidatorBid
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 ValidatorBid
impl Debug for ValidatorBid
Source§impl<'de> Deserialize<'de> for ValidatorBid
impl<'de> Deserialize<'de> for ValidatorBid
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 From<Bid> for ValidatorBid
impl From<Bid> for ValidatorBid
Source§impl FromBytes for ValidatorBid
impl FromBytes for ValidatorBid
Source§impl JsonSchema for ValidatorBid
impl JsonSchema for ValidatorBid
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§impl PartialEq for ValidatorBid
impl PartialEq for ValidatorBid
Source§impl Serialize for ValidatorBid
impl Serialize for ValidatorBid
Source§impl ToBytes for ValidatorBid
impl ToBytes for ValidatorBid
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 ValidatorBid
impl StructuralPartialEq for ValidatorBid
Auto Trait Implementations§
impl Freeze for ValidatorBid
impl RefUnwindSafe for ValidatorBid
impl Send for ValidatorBid
impl Sync for ValidatorBid
impl Unpin for ValidatorBid
impl UnwindSafe for ValidatorBid
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§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