Marketplace
Introduction
The Marketplace ADO is a smart contract that allows you to sell your NFTs in a marketplace. The seller sends their NFT to the Marketplace ADO and attaches the sale options such as the price and funds used to purchase the NFT. Once the NFT is sent, the sale will start at the time specified by the seller.
Purchasing the NFT can be customized to work with one of the following options:
Native: By specifying the denom of the chain in the StartSale message.
CW20: By specifying the contract address of the CW20 token to be used in the StartSale. The CW20 tokens allowed to be set as the purchasing token can be restricted by specifying
authorized_cw20_address
at instantiation. If this is not specified, then any CW20 token can be set.
Each sale is assigned an Id which starts at 1 and increments for each new sale.
Ado_type: marketplace
Version: 2.2.4
InstantiateMsg
authorized_cw20_address
Optional CW20 address to authorize to be used as the purchasing coin for the NFTs in the marketplace sale. If not specified, then any CW20 can be set as the purchasing coin.
authorized_token_addresses
Optional set of CW721 contract addresses to be allowed to send NFTs to the Marketplace ADO. If not specified, then any CW721 can send NFTs to the marketplace to be sold.
kernel_address
String
owner
Option<String>
Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified.
ExecuteMsg
ReceiveNft
Receives a token from a SendNft
and starts an auction based on the given parameters in the StartSale struct.
This message is not called by the user on this ADO, but is the case that handles receiving NFTs from a CW721 ADO.
Cw721ReceiveMsg
The msg
in the Cw721ReceiveMsg
should be a base64 encoded binary of a Cw721HookMsg
.
Start Sale
A CW721 hook message that starts a new sale with the given parameters.
price
Uint128
The price of the NFT, which is the amount of coin_denom
needed to buy the NFT.
coin_denom
The denom to be used to buy the NFT. Can be either a CW20 or native funds. For CW20, provide the contract address e.g. "andr1...". For native provide the denom e.g. "uandr".
start_time
duration
Optional duration for the sale in milliseconds from the start_time
. If not specified then the sale never expires.
uses_cw20
bool
Whether a CW20 token is used to purchase the NFT or not.
recipient
Optional address to receive the funds from the NFT sale. If not specified, then the funds will go to the sender of the NFT.
Receive
Receives tokens from a CW20 Send message to be used to buy an NFT.
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 buy and NFT using a CW20, you need to define the message of the Cw20ReceiveMsg
as a Cw721HookMsg
.
Buy (CW20)
Buys an NFT using the sent CW20 tokens.
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 Owner of the NFT is not allowed to buy it.
token_id
String
The token id of the NFT you want to buy.
token_address
String
The address of the NFT contract the NFT belongs to.
UpdateSale
Update the price and denom for the sale of the token.
Only available to the NFT owner.
token_id
String
The Id of the token to update the sale for.
token_address
String
The address of the cw721 contract that minted the token.
price
Uint128
The price of the NFT, which is the amount of coin_denom
needed to buy the NFT.
coin_denom
The denom to be used to buy the NFT. Can be either a CW20 or native funds. For CW20, provide the contract address e.g. "andr1...". For native provide the denom e.g. "uandr".
recipient
Optional address to receive the funds from the NFT sale. If not specified, then the funds will go to the sender of the NFT.
Buy
Buys the NFT that is for sale.
Dont forget to attach the required funds.
The Owner of the NFT is not allowed to buy it.
token_id
String
The Id of the NFT to buy.
token_address
String
The address of the cw721 that minted the NFT to buy.
AuthorizeContract
Authorize a CW721 or CW20 contract to send tokens to this ADO.
Only available to the contract owner.
CW721 is used to send NFTs to be sold, and CW20 is used to send tokens to be used in sales.
For CW721, the action should be specified as "send_nft".
For CW20, the action should be specified as "send_cw20".
action
The action to authorize the specified address to do.
addr
The contract address of the CW721 (NFT) contract to authorize.
expiration
An optional expiration for the permission.
PermissionAction
SendCw20: Used in case the ADO to authorize/deauthorize is a CW20 ADO.
SendNFT: Used in case the ADO to authorize/deauthorize is a CW721 ADO.
DeauthorizeContract
Removes authorization from a CW721 or CW20 contract to send tokens to this ADO.
Only available to the contract owner.
For CW721, the action should be specified as "send_nft".
For CW20, the action should be specified as "send_cw20".
action
The action to deauthorize the specified address to do.
addr
The contract address of the CW721 (NFT) contract to remove authorization for.
CancelSale
Cancels the sale for the specified NFT.
Only the NFT owner can cancel the sale.
token_id
String
The Id of the NFT to cancel the sale for.
token_address
String
The address of the cw721 that minted the NFT to cancel the sale for.
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
LatestSaleState
Gets the latest sale state for the given token. This will either be the current sale if there is one in progress or the last completed one.
token_id
String
The Id of the token to check.
token_address
String
The address of the cw721 that minted the NFT to check.
SaleStateResponse
sale_id
Uint128
The Id of the sale. The first sale has an Id of 1 and each sale after it increments the Id by 1.
coin_denom
String
The denom used in the sale.
price
Uint128
The price of the NFT.
status
Status
The status of the sale which can be one of the following options:
-Open
-Expired
-Executed
-Cancelled
start_time
The time the sale on the NFT will start.
end_time
The time the the sale on the NFT will end.
recipient
The address that will receive the funds from the sale of the NFT.
SaleState
Gets the sale state for the given sale Id.
sale_id
Uint128
The Id of the sale to check.
Returns a SaleStateResponse.
SaleIds
Queries the sale Ids of the specified token.
token_id
String
The Id of the token to check the sale for.
token_address
String
The address of the cw721 that minted the NFT.
Returns the Ids of the sales that have been conducted on the NFT.
SaleInfosForAddress
Get sale information on the provided CW721 token address.
token_address
String
The cw721 contract address to check the sales for.
start_after
Option<String>
Optional parameter to specify which SaleInfo
to start from. If none specified index 0
will be used.
limit
Option<u64>
Optional parameter to specify how many SaleInfo
to query. If none specified a default limit of 10 is used. The maximum limit is 30.
SaleInfo
A Vec<SaleInfo>
is returned.
sale_ids
Vec<Uint128>
The Ids of the sales conducted on the NFT.
token_address
String
The cw721 contract address.
token_id
String
The Id of the token.
AuthorizedAddresses
Gets all of the authorized ADO addresses for the specified action.
For CW721, the action should be specified as "send_nft".
For CW20, the action should be specified as "send_cw20".
action
The type of authorized addresses to fetch.
start_after
Option<String>
Optional parameter to specify which address
to start from.
limit
Option<u64>
Optional parameter to specify how many addresses to return. If none specified a default limit of 25 is used. The maximum limit is 50.
order_by
Whether to return the addresses in ascending or descending order. Defaults to ascending if not specified.
OrderBy
How the returned addresses are ordered.
AuthorizedAddressesResponse
addresses
Vec<String>
A vector containing the contract addresses of the authorized ADO for the specified action.
Base Queries
The rest of the query messages can be found in the ADO Base section.
Last updated