referrerpolicy=no-referrer-when-downgrade

Trait polkadot_runtime_common::traits::Auctioneer

source ·
pub trait Auctioneer<BlockNumber> {
    type AccountId;
    type LeasePeriod;
    type Currency: ReservableCurrency<Self::AccountId>;

    // Required methods
    fn new_auction(
        duration: BlockNumber,
        lease_period_index: Self::LeasePeriod,
    ) -> DispatchResult;
    fn auction_status(now: BlockNumber) -> AuctionStatus<BlockNumber>;
    fn place_bid(
        bidder: Self::AccountId,
        para: ParaId,
        first_slot: Self::LeasePeriod,
        last_slot: Self::LeasePeriod,
        amount: <Self::Currency as Currency<Self::AccountId>>::Balance,
    ) -> DispatchResult;
    fn lease_period_length() -> (BlockNumber, BlockNumber);
    fn lease_period_index(
        block: BlockNumber,
    ) -> Option<(Self::LeasePeriod, bool)>;
    fn has_won_an_auction(para: ParaId, bidder: &Self::AccountId) -> bool;
}

Required Associated Types§

source

type AccountId

An account identifier for a leaser.

source

type LeasePeriod

The measurement type for counting lease periods (generally the same as BlockNumber).

source

type Currency: ReservableCurrency<Self::AccountId>

The currency type in which the lease is taken.

Required Methods§

source

fn new_auction( duration: BlockNumber, lease_period_index: Self::LeasePeriod, ) -> DispatchResult

Create a new auction.

This can only happen when there isn’t already an auction in progress. Accepts the duration of this auction and the lease_period_index of the initial lease period of the four that are to be auctioned.

source

fn auction_status(now: BlockNumber) -> AuctionStatus<BlockNumber>

Given the current block number, return the current auction status.

source

fn place_bid( bidder: Self::AccountId, para: ParaId, first_slot: Self::LeasePeriod, last_slot: Self::LeasePeriod, amount: <Self::Currency as Currency<Self::AccountId>>::Balance, ) -> DispatchResult

Place a bid in the current auction.

  • bidder: The account that will be funding this bid.
  • para: The para to bid for.
  • first_slot: The first lease period index of the range to be bid on.
  • last_slot: The last lease period index of the range to be bid on (inclusive).
  • amount: The total amount to be the bid for deposit over the range.

The account Bidder must have at least amount available as a free balance in Currency. The implementation MUST remove or reserve amount funds from bidder and those funds should be returned or freed once the bid is rejected or lease has ended.

source

fn lease_period_length() -> (BlockNumber, BlockNumber)

The length of a lease period, and any offset which may be introduced. This is only used in benchmarking to automate certain calls.

source

fn lease_period_index(block: BlockNumber) -> Option<(Self::LeasePeriod, bool)>

Returns the lease period at block, and if this is the first block of a new lease period.

Will return None if the first lease period has not started yet, for example when an offset is placed.

source

fn has_won_an_auction(para: ParaId, bidder: &Self::AccountId) -> bool

Check if the para and user combination has won an auction in the past.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Config> Auctioneer<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>

§

type AccountId = <T as Config>::AccountId

§

type LeasePeriod = <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number

§

type Currency = <<T as Config>::Leaser as Leaser<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>>::Currency