Struct casper_types::system::auction::Bid
source · pub struct Bid { /* private fields */ }
Expand description
An entry in the validator map.
Implementations§
source§impl Bid
impl Bid
sourcepub fn locked(
validator_public_key: PublicKey,
bonding_purse: URef,
staked_amount: U512,
delegation_rate: DelegationRate,
release_timestamp_millis: u64
) -> Self
pub fn locked( validator_public_key: PublicKey, bonding_purse: URef, staked_amount: U512, delegation_rate: DelegationRate, release_timestamp_millis: u64 ) -> 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
) -> Self
pub fn unlocked( validator_public_key: PublicKey, bonding_purse: URef, staked_amount: U512, delegation_rate: DelegationRate ) -> 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 delegators(&self) -> &BTreeMap<PublicKey, Delegator>
pub fn delegators(&self) -> &BTreeMap<PublicKey, Delegator>
Returns a reference to the delegators of the provided bid
sourcepub fn delegators_mut(&mut self) -> &mut BTreeMap<PublicKey, Delegator>
pub fn delegators_mut(&mut self) -> &mut BTreeMap<PublicKey, Delegator>
Returns a mutable reference to the delegators 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 process(&mut self, timestamp_millis: u64) -> bool
pub fn process(&mut self, timestamp_millis: u64) -> bool
Initializes the vesting schedule of provided bid if the provided timestamp is greater than or equal to the bid’s initial release timestamp and the bid is owned by a genesis validator. This method initializes with default 14 week vesting schedule.
Returns true
if the provided bid’s vesting schedule was initialized.
sourcepub fn process_with_vesting_schedule(
&mut self,
timestamp_millis: u64,
vesting_schedule_period_millis: u64
) -> bool
pub fn process_with_vesting_schedule( &mut self, timestamp_millis: u64, vesting_schedule_period_millis: u64 ) -> bool
Initializes the vesting schedule of provided bid if the provided timestamp is greater than or equal to the bid’s initial release timestamp and the bid is owned by a genesis validator.
Returns true
if the provided bid’s vesting schedule was initialized.
sourcepub fn deactivate(&mut self) -> bool
pub fn deactivate(&mut self) -> bool
Sets given bid’s inactive
field to true
sourcepub fn total_staked_amount(&self) -> Result<U512, Error>
pub fn total_staked_amount(&self) -> Result<U512, Error>
Returns the total staked amount of validator + all delegators
Trait Implementations§
source§impl<'de> Deserialize<'de> for Bid
impl<'de> Deserialize<'de> for Bid
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 SeigniorageRecipient
impl From<&Bid> for SeigniorageRecipient
source§impl From<Bid> for StoredValue
impl From<Bid> for StoredValue
source§fn from(bid: Bid) -> StoredValue
fn from(bid: Bid) -> StoredValue
source§impl ToBytes for Bid
impl ToBytes for Bid
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.