rmrk-substrate
rmrk-substrate copied to clipboard
Auctions pallet design
Calls
The external dispatchable calls. i.e. The methods user can invoke by sending a transaction
Auctions pallet. Should extend NFT Core Should implement offchain worker to monitor auctions end time to conclude auction
-
create_auction(origin: OriginFor<T>, auction_info: AuctionInfoOf<T>)
- AuctionInfoOf consists of AccountId, BalanceOf, BlockNumber, CollectionId, NftId
- bid_value(origin: OriginFor<T>, id: T::AuctionId, value: BalanceOf<T>)
- delete_auction(origin: OriginFor<T>, id: T::AuctionId)
Storages
Defines how to access on-chain storage
Auctions
Stores on-going and future auctions. Closed auction are removed.
pub type Auctions<T: Config> = StorageMap<_,
Twox64Concat, T::AuctionId, AuctionInfoOf<T>, OptionQuery>;
AuctionEndTime
Index auctions by end time.
pub type AuctionEndTime<T: Config> = StorageDoubleMap<_,
Twox64Concat, T::BlockNumber, Twox64Concat, T::AuctionId, (), OptionQuery>;
AuctionOwnerById
Auction owner by ID
type AuctionOwnerById<T: Config> = StorageMap<_,
Twox64Concat, T::AuctionId, T::AccountId, ValueQuery>;
Types
Events
Defines the events that could be emitted by this pallet to indicate what happened
pub enum Event<T: Config> {
/// Auction created
AuctionCreated(T::AccountId, T::AuctionId),
/// A bid is placed
Bid(T::AuctionId, T::AccountId, BalanceOf<T>),
/// Auction ended
AuctionConcluded(T::AuctionId),
/// Auction removed
AuctionRemoved(T::AuctionId),
}