Marketplace
The Marketplace ADO is a smart contract that allows you to sell your NFTs in a marketplace. The seller sends their NFT to the ADO with a custom price and denomination to be used to buy the NFT. Once the NFT is sent, it is up for sale and buyers can pay the price to buy the NFT.
Each sale is assigned an Id which starts at 1 and increments for each new sale.
Ado_type: marketplace
Rust
JSON
pub struct InstantiateMsg {
pub modules: Option<Vec<Module>>,
}
{
"modules":[
{
"module_type":"address-list",
"address":{
"identifier":"andr1..."
},
"is_mutable": true
}
]
}
Name | Type | Description |
---|---|---|
modules | Option<Vec<Module>> |
Receives a token from a
SendNft
and starts an auction based on the given parameters in the StartSale struct. Rust
pub enum ExecuteMsg {
ReceiveNft(Cw721ReceiveMsg)
}
pub struct Cw721ReceiveMsg {
pub sender: String,
pub token_id: String,
pub msg: Binary,
}
The
msg
in the Cw721ReceiveMsg
should be a base64 encoded binary of a Cw721HookMsg
.Starts a new sale with the given parameters.
pub enum Cw721HookMsg {
StartSale { price: Uint128, coin_denom: String },
}
Name | Type | Description |
---|---|---|
price | Uint128 | The price of the NFT. |
coin_denom | String | The denom to pay the price with. |
Update the price and denom for the sale of the token.
Only available to the NFT owner.
Rust
JSON
pub enum ExecuteMsg {
UpdateSale {
token_id: String,
token_address: String,
price: Uint128,
coin_denom: String,
}
}
{
"update_sale":{
"token_id":"1",
"token_address":"andr1...",
"price":"100",
"coin_denom":"uandr"
}
}
Name | Type | Description |
---|---|---|
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. |
coin_denom | String | The denomination used to buy the NFT. |
Buys the NFT that is for sale.
Dont forget to attach the required funds.
Rust
JSON
pub enum ExecuteMsg {
Buy {
token_id: String,
token_address: String,
}
}
{
"buy":{
"token_id":"1",
"token_address":"andr1..."
}
}
Name | Type | Description |
---|---|---|
token_id | String | The id of the NFT to buy. |
token_address | String | The address of the cw721 that minted the NFT to buy. |
Cancels the sale for the specified NFT.
Only the NFT owner can cancel the sale.
Rust
JSON
pub enum ExecuteMsg {
CancelSale {
token_id: String,
token_address: String,
}
}
{
"cancel_sale":{
"token_id":"1",
"token_address":"andr1..."
}
}
Name | Type | Description |
---|---|---|
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. |
Has the modules feature enabled.
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.
Rust
JSON
pub enum QueryMsg {
#[returns(SaleStateResponse)]
LatestSaleState {
token_id: String,
token_address: String,
}
}
{
"latest_sale_state":{
"token_id":"1",
"token_address":"andr1..."
}
}
Name | Type | Description |
---|---|---|
token_id | String | The Id of the token to check. |
token_address | String | The address of the cw721 that minted the NFT to check. |
Rust
JSON
pub struct SaleStateResponse {
pub sale_id: Uint128,
pub coin_denom: String,
pub price: Uint128,
pub status: Status,
}
{
"sale_id":"3",
"coin_denom":"uandr",
"price":"100",
"status":"open"
}
Name | Type | Description |
---|---|---|
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 three options: -Open -Executed -Cancelled |
Gets the sale state for the given sale id.
Rust
JSON
pub enum QueryMsg
#[returns(SaleStateResponse)]
SaleState {
sale_id: Uint128,
}
}
{
"sale_state":{
"sale_id":"1"
}
}
Name | Type | Description |
---|---|---|
sale_id | Uint128 | The id of the sale to check. |
Rust
JSON
pub enum QueryMsg {
#[returns(SaleIdsResponse)]
SaleIds {
token_id: String,
token_address: String,
}
}
{
"sale_ids":{
"token_id":"1",
"token_address":"andr1..."
}
}
Name | Type | Description |
---|---|---|
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 ID of the sale.
Get sale information on the provided cw721 token address.
Rust
JSON
pub enum QueryMsg {
#[returns(Vec<SaleInfo>)]
SaleInfosForAddress {
token_address: String,
start_after: Option<String>,
limit: Option<u64>,
}
}
{
"sale_infos_for_address":{
"token_address":"andr1..."
}
}
Name | Type | Description |
---|---|---|
token_address | String | The cw721 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. |
A
Vec<SaleInfo>
is returned.Rust
pub struct SaleInfo {
pub sale_ids: Vec<Uint128>,
pub token_address: String,
pub token_id: String,
}
Name | Type | Description |
---|---|---|
sale_ids | Vec<Uint128> | The id of the sale. |
token_address | String | The cw721 address. |
token_id | String | The id of the token. |