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

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

Bonding auction contract interface

Provided methods

fn get_era_validators(&mut self) -> Result<EraValidators>[src]

Returns era_validators.

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

fn read_seigniorage_recipients(&mut self) -> Result<SeigniorageRecipients>[src]

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 PoS contract, because this data is necessary for distributing seigniorage.

fn add_bid(
    &mut self,
    public_key: PublicKey,
    delegation_rate: DelegationRate,
    amount: U512
) -> Result<U512>
[src]

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.

fn withdraw_bid(&mut self, public_key: PublicKey, amount: U512) -> Result<U512>[src]

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.

fn delegate(
    &mut self,
    delegator_public_key: PublicKey,
    validator_public_key: PublicKey,
    amount: U512
) -> Result<U512>
[src]

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.

fn undelegate(
    &mut self,
    delegator_public_key: PublicKey,
    validator_public_key: PublicKey,
    amount: U512
) -> Result<U512>
[src]

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.

fn slash(&mut self, validator_public_keys: Vec<PublicKey>) -> Result<()>[src]

Slashes each validator.

This can be only invoked through a system call.

fn run_auction(&mut self, era_end_timestamp_millis: u64) -> Result<()>[src]

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

fn distribute(&mut self, reward_factors: BTreeMap<PublicKey, u64>) -> Result<()>[src]

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

fn withdraw_delegator_reward(
    &mut self,
    validator_public_key: PublicKey,
    delegator_public_key: PublicKey
) -> Result<U512>
[src]

Allows delegators to withdraw the seigniorage rewards they have earned. Pays out the entire accumulated amount to the destination purse.

fn withdraw_validator_reward(
    &mut self,
    validator_public_key: PublicKey
) -> Result<U512>
[src]

Allows validators to withdraw the seigniorage rewards they have earned. Pays out the entire accumulated amount to the destination purse.

fn read_era_id(&mut self) -> Result<EraId>[src]

Reads current era id.

Loading content...

Implementors

Loading content...