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_index(
block: BlockNumber
) -> Option<(Self::LeasePeriod, bool)>;
fn has_won_an_auction(para: ParaId, bidder: &Self::AccountId) -> bool;
}Required Associated Types§
sourcetype LeasePeriod
type LeasePeriod
The measurement type for counting lease periods (generally the same as BlockNumber).
Required Methods§
sourcefn new_auction(
duration: BlockNumber,
lease_period_index: Self::LeasePeriod
) -> DispatchResult
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.
sourcefn auction_status(now: BlockNumber) -> AuctionStatus<BlockNumber>
fn auction_status(now: BlockNumber) -> AuctionStatus<BlockNumber>
Given the current block number, return the current auction status.
sourcefn 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 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.
sourcefn lease_period_index(block: BlockNumber) -> Option<(Self::LeasePeriod, bool)>
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.
sourcefn has_won_an_auction(para: ParaId, bidder: &Self::AccountId) -> bool
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.