CW721 Bids
The CW721 Bids ADO is a smart contract used to buy/sell NFT tokens. It allows users to place a bid on a certain token which can then be accepted by the seller if satisfied. Once a bid is placed, funds are allocated for the purchase until the bid is expired, accepted, canceled, or a higher bid has been made.
The Bids ADO is not built to work as a standalone contract, instead it is implemented as a module for the NFT Collectible ADO facilitating the process of trading NFTs.
Ado_type: cw721-bids
Rust
JSON
pub struct InstantiateMsg {
pub andromeda_cw721_contract: String,
pub valid_demom: String,
}
{
"andromeda_cw721_contract":"andr1...",
"valid_denom":"uandr"
}
Name | Type | Description |
---|---|---|
andromeda_cw721_contract | String | The address of the contract allowed to sell tokens using the bid contract. |
valid_denom | String | The denom allowed in bids. |
Places a bid on the token with the specified
token_id
. When a bid is placed, the funds are taken and returned in the case of a higher bid or cancelation.The ADO owner is not allowed to place a bid on their ADO.
bid_amount
needs to exceed the previous highest bid.The funds must match the specified
valid_denom
in instantiation.Rust
JSON
pub enum ExecuteMsg{
PlaceBid {
token_id: String,
expiration: Expiration,
bid_amount: Uint128,
}
}
{
"place_bid":{
"token_id":"1",
"expiration":{
"at_height": 300
}
"bid_amount": "200000"
}
}
Name | Type | Description |
---|---|---|
token_id | String | The token id of the token/NFT to buy. |
expiration | An expiration for the bid. | |
bid_amount | Uint128 | The amount of funds to bid for the token. |
Cancels a bid previously placed by a purchaser.
Rust
JSON
pub enum ExecuteMsg{
CancelBid {
token_id: String,
}
}
{
"cancel_bid":{
"token_id": "1"
}
}
Name | Type | Description |
---|---|---|
token_id | String | The id of the token to remove the bid on. |
Accepts a bid that is placed on your NFT.
Only the
andromeda_cw721_contract
can accept bids.Rust
JSON
pub enum ExecuteMsg{
AcceptBid {
token_id: String,
recipient: String,
}
}
{
"accept_bid":{
"token_id":"1",
"recipient":"andr1..."
}
}
Name | Type | Description |
---|---|---|
token_id | String | The Id of the token to accept the bid on. |
recipient | String | The address to receive the funds of the bid. |
Returns the latest bid of the token with the given
token_id
.Rust
JSON
pub enum QueryMsg{
#[returns(BidResponse)]
Bid {
token_id: String,
}
}
{
"bid":{
"token_id":"1"
}
}
Name | Type | Description |
---|---|---|
token_id | String | The id of the token/NFT to get the latest bid on. |
Rust
JSON
pub struct BidResponse {
pub denom: String,
pub bid_amount: Uint128,
pub remaining_amount: Uint128,
pub tax_amount: Uint128,
pub expiration: Expiration,
pub purchaser: String,
}
{
"denom":"uandr",
"bid_amount":"1000",
"remaining_amount":"997",
"tax_amount":"3",
"expiration":{
"at_height": 500
},
"purchaser":"andr1..."
}
Name | Type | Description |
---|---|---|
denom | String | The denomination of the coin used to place bids. |
bid_amount | Uint128 | The amount of coins bid on the token. |
remaining_amount | Uint128 | The amount left after any royalties/taxes have been applied to the bid_amount. |
tax_amount | Uint128 | The amount of coins taken as tax. |
expiration | Expiration for the bid. | |
purchaser | String | The address that has placed the bid. |
Returns all the bids of a certain purchaser.
Rust
JSON
pub enum ExecuteMsg{
#[returns(AllBidsResponse)]
AllBids {
purchaser: String,
limit: Option<u32>,
start_after: Option<String>,
}
}
{
"all_bids":{
"purchaser":"andr1...",
"limit": 15
}
}
Name | Type | Description |
---|---|---|
purchaser | String | The address of the purchaser we want to get the bids of. |
limit | Option<u32> | An optional limit to the number of bids queried. The default limit is 10. The max limit is 30. |
start_after | Option<String> | An optional ID for which to start after, used for pagination. |
Rust
JSON
pub struct AllBidsResponse {
pub bids: Vec<BidResponse>,
}
{
"bids":[
{
"denom":"uandr",
"bid_amount":"1000",
"remaining_amount":"997",
"tax_amount":"3",
"expiration":{
"at_height": 500
},
"purchaser":"andr1..."
},
...
]
}
Name | Type | Description |
---|---|---|
bids | A vector of BidResponse containing each bid with the related information. |