Auction
Introduction
The Auction ADO is a smart contract that allows performing custom auctions on NFTs. NFTs can be sent to this contract with the required messages to start an auction on it. Once the auction has started, users can place bids on the token until the auction expires. The highest bid will win the auction, sending the funds to the seller and receiving the token in return.
There are multiple ways to customize this ADO:
Authorized: Only the NFT contracts sepcified at instantiation are allowed to send NFTs to this Auction ADO.
Open: This means that any NFT contract is allowed to send an NFT to this ADO to be auctioned. To have the Auction ADO be open, do not specify
authorized_token_addresses
in instantiation.
Bidding on the NFT can also be customized to work with one of the following options:
Native: By specifying the denom of the chain in the StartAuction message.
CW20: By specifying the contract address of the CW20 token to be used in the StartAuction. The CW20 tokens allowed to be set as the bidding token can be restricted by specifying
authorized_cw20_address
at instantiation. If this is not specified, then any CW20 token can be set.
This ADO allows creating English Auctions.
Ado_type: auction
Version: 2.0.2-beta.1
InstantiateMsg
ExecuteMsg
ReceiveNft
Receives a token from a SendNft
and starts an auction based on the given parameters in the StartAuction
struct.
The auction information can be modified before it has started but is immutable after that.
Only the NFT owner can send the NFT and start the auction.
This message is not called by the user on this ADO, but is the case that handles receiving NFTs from a CW721 ADO.
In order to start an auction you need to define the message of the Cw721ReceiveMsg
as a Cw721HookMsg
.
StartAuction
Starts an auction sale on the sent NFT.
You need to get the base64 encoded representation of the JSON message and attach it as the msg
when sending.
start_time
should not be a time in the past.
Receive
Receives tokens from a CW20 Send message to be used as a bid on the NFT auction.
This message is not called by the user on this ADO, but is the case that handles receiving CW20 tokens from a CW20 ADO.
In order to bid on an auction using a CW20, you need to define the message of the Cw20ReceiveMsg
as a Cw721HookMsg
.
PlaceBid (CW20)
You need to get the base64 encoded representation of the JSON message and attach it as the msg
field for the CW20 Send message.
The following criteria must be met for the bid to be placed:
The NFT is currently under auction
The sender's bid is higher than the highest bid
The sender does not currently hold the highest bid
The sender is not the token owner
AuthorizeTokenContract
Authorize a CW721 contract to send NFTs to this ADO.
Only available to the contract owner.
DeauthorizeTokenContract
Removes authorization from a CW721 contract to send NFTs to the auction.
Only available to the contract owner.
UpdateAuction
Updates the information of an auction.
Only the owner of the auction can execute UpdateAuction
.
An auction can be updated only if it has not started yet.
start_time
should not be a time in the past.
CancelAuction
Only the owner of the auction can execute CancelAuction
.
Cancels the auction of a token.
PlaceBid
Places a bid for the auction for the given NFT Id. The bid must be sent as native funds along with this message. The previous largest bid gets automatically sent back to the bidder when they are outbid.
The following criteria must be met for the bid to be placed:
The NFT is currently under auction
The sender's bid is higher than the highest bid
The sender does not currently hold the highest bid
The sender is not the token owner
Claim
Sends the winner of the auction the NFT and the funds to the NFT owner when the auction has finished. Anyone is allowed to execute this message.
Can only be done when the end_time
has been passed. If there were no bids placed, the original owner retains the token.
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
LatestAuctionState
Queries the most recent auction for the given token (either ongoing, complete, or not started yet).
AuctionStateResponse
AuctionState
Gets the auction state for a particular auction_id
.
Each Auction has an auction_id which starts at 1 and increments every new auction.
To get the auction_id of a particular token, use LatestAuctionState.
Response
See AuctionStateResponse.
Bids
Gets the bids for a given auction.
BidsResponse
Bid
The state for a particular bid is stored in a basic struct.
AuctionIds
Queries the auction Ids for a given token.
AuctionIdsResponse
AuctionInfosForAddress
Gets all of the auction infos for a given token address.
AuctionInfosForAddressResponse
Returns a vector of AuctionInfo defined below.
IsCancelled
Checks if the specified auction was cancelled.
Returns a true if the auction has been cancelled and false otherwise.
IsClosed
Checks if the specified auction has been closes. Returns true only if the auction has been cancelled, the token has been claimed, or the end time has expired.
Returns a true if the auction has been cancelled and false otherwise.
IsClaimed
Checks if the NFT has been claimed after the auction has concluded.
Returns a true if the NFT has been claimed and false otherwise.
AuthorizedAddresses
Gets all of the authorized CW721 addresses for the auction.
OrderBy
How the returned addresses are ordered.
Base Queries
The rest of the query messages can be found in the ADO Base section.