pub struct Bid { /* private fields */ }Expand description
An entry in the validator map.
Implementations§
Source§impl Bid
impl Bid
pub fn from_non_unified( validator_bid: ValidatorBid, delegators: BTreeMap<DelegatorKind, DelegatorBid>, ) -> Self
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 DataSize for Bid
impl DataSize for Bid
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<'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 SeigniorageRecipientV1
impl From<&Bid> for SeigniorageRecipientV1
Source§impl From<&Bid> for SeigniorageRecipientV2
impl From<&Bid> for SeigniorageRecipientV2
Source§impl From<Bid> for StoredValue
impl From<Bid> for StoredValue
Source§fn from(bid: Bid) -> StoredValue
fn from(bid: Bid) -> StoredValue
Source§impl From<Bid> for ValidatorBid
impl From<Bid> for ValidatorBid
Source§impl JsonSchema for Bid
impl JsonSchema for Bid
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(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moreSource§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.Source§impl TryFrom<StoredValue> for Bid
impl TryFrom<StoredValue> for Bid
Source§type Error = TypeMismatch
type Error = TypeMismatch
impl Eq for Bid
impl StructuralPartialEq for Bid
Auto Trait Implementations§
impl Freeze for Bid
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
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