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.impl Eq for Bid
impl StructuralEq for Bid
impl StructuralPartialEq for Bid
Auto Trait Implementations§
impl RefUnwindSafe for Bid
impl Send for Bid
impl Sync for Bid
impl Unpin for Bid
impl UnwindSafe for Bid
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
§impl<T> Conv for T
impl<T> Conv for T
§impl<T> FmtForward for T
impl<T> FmtForward for T
§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where Self: Binary,
self to use its Binary implementation when Debug-formatted.§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where Self: Display,
self to use its Display implementation when
Debug-formatted.§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where Self: Octal,
self to use its Octal implementation when Debug-formatted.§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.§impl<T> Pipe for T
impl<T> Pipe for T
§impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
§impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
§impl<T> PipeDeref for T
impl<T> PipeDeref for T
§impl<T> PipeRef for T
impl<T> PipeRef for T
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere R: 'a,
§fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere R: 'a,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
§fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&Self) -> R,
tap in debug builds, and does nothing in release builds.§fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
§fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere F: FnOnce(&mut Self) -> R,
tap_mut in debug builds, and does nothing in release builds.§impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere U: ?Sized,
§fn tap_ref<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
§fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere Self: AsRef<T>, F: FnOnce(&T) -> R,
tap_ref in debug builds, and does nothing in release builds.§fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
§fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: AsMut<T>, F: FnOnce(&mut T) -> R,
tap_ref_mut in debug builds, and does nothing in release builds.§impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere U: ?Sized,
§fn tap_borrow<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
§fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere Self: Borrow<T>, F: FnOnce(&T) -> R,
tap_borrow in debug builds, and does nothing in release builds.§fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
§fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: BorrowMut<T>, F: FnOnce(&mut T) -> R,
tap_borrow_mut in debug builds, and does nothing in release
builds.§impl<T> TapDeref for T
impl<T> TapDeref for T
§fn tap_deref<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
self for inspection.§fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere Self: Deref, F: FnOnce(&Self::Target) -> R,
tap_deref in debug builds, and does nothing in release builds.§fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
self for modification.§fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere Self: DerefMut, F: FnOnce(&mut Self::Target) -> R,
tap_deref_mut in debug builds, and does nothing in release
builds.