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§
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_length() -> (BlockNumber, BlockNumber)
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.
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.