Trait casper_types::system::auction::Auction[][src]

pub trait Auction: StorageProvider + RuntimeProvider + MintProvider + AccountProvider + Sized {
    fn get_era_validators(&mut self) -> Result<EraValidators, Error> { ... }
fn read_seigniorage_recipients(
        &mut self
    ) -> Result<SeigniorageRecipients, Error> { ... }
fn add_bid(
        &mut self,
        public_key: PublicKey,
        delegation_rate: DelegationRate,
        amount: U512
    ) -> Result<U512, Error> { ... }
fn withdraw_bid(
        &mut self,
        public_key: PublicKey,
        amount: U512
    ) -> Result<U512, Error> { ... }
fn delegate(
        &mut self,
        delegator_public_key: PublicKey,
        validator_public_key: PublicKey,
        amount: U512
    ) -> Result<U512, Error> { ... }
fn undelegate(
        &mut self,
        delegator_public_key: PublicKey,
        validator_public_key: PublicKey,
        amount: U512
    ) -> Result<U512, Error> { ... }
fn slash(
        &mut self,
        validator_public_keys: Vec<PublicKey>
    ) -> Result<(), Error> { ... }
fn run_auction(
        &mut self,
        era_end_timestamp_millis: u64,
        evicted_validators: Vec<PublicKey>
    ) -> Result<(), Error> { ... }
fn distribute(
        &mut self,
        reward_factors: BTreeMap<PublicKey, u64>
    ) -> Result<(), Error> { ... }
fn read_era_id(&mut self) -> Result<EraId, Error> { ... }
fn activate_bid(
        &mut self,
        validator_public_key: PublicKey
    ) -> Result<(), Error> { ... } }
Expand description

Bonding auction contract interface

Provided methods

Returns era_validators.

Publicly accessible, but intended for periodic use by the Handle Payment contract to update its own internal data structures recording current and past winners.

Returns validators in era_validators, mapped to their bids or founding stakes, delegation rates and lists of delegators together with their delegated quantities from delegators. This function is publicly accessible, but intended for system use by the Handle Payment contract, because this data is necessary for distributing seigniorage.

For a non-founder validator, this adds, or modifies, an entry in the bids collection and calls bond in the Mint contract to create (or top off) a bid purse. It also adjusts the delegation rate.

For a non-founder validator, implements essentially the same logic as add_bid, but reducing the number of tokens and calling unbond in lieu of bond.

For a founding validator, this function first checks whether they are released, and fails if they are not.

The function returns a the new amount of motes remaining in the bid. If the target bid does not exist, the function call returns an error.

Adds a new delegator to delegators, or tops off a current one. If the target validator is not in founders, the function call returns an error and does nothing.

The function calls bond in the Mint contract to transfer motes to the validator’s purse and returns a tuple of that purse and the amount of motes contained in it after the transfer.

Removes an amount of motes (or the entry altogether, if the remaining amount is 0) from the entry in delegators and calls unbond in the Mint contract to create a new unbonding purse.

The arguments are the delegator’s key, the validator key and quantity of motes and returns a tuple of the unbonding purse along with the remaining bid amount.

Slashes each validator.

This can be only invoked through a system call.

Takes active_bids and delegators to construct a list of validators’ total bids (their own added to their delegators’) ordered by size from largest to smallest, then takes the top N (number of auction slots) bidders and replaces era_validators with these.

Accessed by: node

Mint and distribute seigniorage rewards to validators and their delegators, according to reward_factors returned by the consensus component.

Reads current era id.

Activates a given validator’s bid. To be used when a validator has been marked as inactive by consensus (aka “evicted”).

Implementors