pub struct Bid { /* private fields */ }
Expand description

An entry in the validator map.

Implementations§

source§

impl Bid

source

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.

source

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.

source

pub fn empty(validator_public_key: PublicKey, bonding_purse: URef) -> Self

Creates a new inactive instance of a bid with 0 staked amount.

source

pub fn validator_public_key(&self) -> &PublicKey

Gets the validator public key of the provided bid

source

pub fn bonding_purse(&self) -> &URef

Gets the bonding purse of the provided bid

source

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.

source

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.

source

pub fn staked_amount(&self) -> &U512

Gets the staked amount of the provided bid

source

pub fn staked_amount_mut(&mut self) -> &mut U512

Gets the staked amount of the provided bid

source

pub fn delegation_rate(&self) -> &DelegationRate

Gets the delegation rate of the provided bid

source

pub fn vesting_schedule(&self) -> Option<&VestingSchedule>

Returns a reference to the vesting schedule of the provided bid. None if a non-genesis validator.

source

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.

source

pub fn delegators(&self) -> &BTreeMap<PublicKey, Delegator>

Returns a reference to the delegators of the provided bid

source

pub fn delegators_mut(&mut self) -> &mut BTreeMap<PublicKey, Delegator>

Returns a mutable reference to the delegators of the provided bid

source

pub fn inactive(&self) -> bool

Returns true if validator is inactive

source

pub fn decrease_stake( &mut self, amount: U512, era_end_timestamp_millis: u64 ) -> Result<U512, Error>

Decreases the stake of the provided bid

source

pub fn increase_stake(&mut self, amount: U512) -> Result<U512, Error>

Increases the stake of the provided bid

source

pub fn with_delegation_rate( &mut self, delegation_rate: DelegationRate ) -> &mut Self

Updates the delegation rate of the provided bid

source

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.

source

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.

source

pub fn activate(&mut self) -> bool

Sets given bid’s inactive field to false

source

pub fn deactivate(&mut self) -> bool

Sets given bid’s inactive field to true

source

pub fn total_staked_amount(&self) -> Result<U512, Error>

Returns the total staked amount of validator + all delegators

Trait Implementations§

source§

impl CLTyped for Bid

source§

fn cl_type() -> CLType

The CLType of Self.
source§

impl Clone for Bid

source§

fn clone(&self) -> Bid

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Bid

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Bid

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl From<&Bid> for SeigniorageRecipient

source§

fn from(bid: &Bid) -> Self

Converts to this type from the input type.
source§

impl From<Bid> for StoredValue

source§

fn from(bid: Bid) -> StoredValue

Converts to this type from the input type.
source§

impl FromBytes for Bid

source§

fn from_bytes(bytes: &[u8]) -> Result<(Self, &[u8]), Error>

Deserializes the slice into Self.
source§

fn from_vec(bytes: Vec<u8>) -> Result<(Self, Vec<u8>), Error>

Deserializes the Vec<u8> into Self.
source§

impl PartialEq for Bid

source§

fn eq(&self, other: &Bid) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Bid

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl ToBytes for Bid

source§

fn to_bytes(&self) -> Result<Vec<u8>, Error>

Serializes &self to a Vec<u8>.
source§

fn serialized_length(&self) -> usize

Returns the length of the 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§

fn write_bytes(&self, writer: &mut Vec<u8>) -> Result<(), Error>

Writes &self into a mutable writer.
source§

fn into_bytes(self) -> Result<Vec<u8>, Error>where Self: Sized,

Consumes self and serializes to a Vec<u8>.
source§

impl Eq for Bid

source§

impl StructuralEq for Bid

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,