Andromeda
Search
⌃K

CW721 Bids

Introduction

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.
To accept a bid, the owner of the NFT needs to transfer the NFT to the highest bidder. This will automatically accept the bid, transfering the NFT to the bidder and the funds to the seller.
The Bids ADO is not built to work as a standalone contract, instead it is implemented as a module for the CW721 ADO facilitating the process of trading NFTs.
Ado_type: cw721-bids

InstantiateMsg

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.

ExecuteMsg

PlaceBid

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 NFT owner is not allowed to place a bid.
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.

CancelBid

Cancels a bid previously placed by a purchaser.
A bid cannot be canceled if the expiration of the bid has not been reached.
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.

AcceptBid

Accepts a bid that is placed on your NFT. A bid is accepted by calling TransferNft and specifying the recipient as the address of the highest bidder.
Cannot accept a bid on a token that has a current TransferAgreement.
Cannot accept a bid that is expired.
Rust
pub enum ExecuteMsg{
AcceptBid {
token_id: String,
recipient: String,
}
}
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. The NFT owner is assigned as the recipient.

AndrReceive

The rest of the executes can be found in the AndrReceive section.

QueryMsg

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.

BidResponse

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.

AllBids

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.

AllBidsResponse

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.

AndrQuery

A set of base queries common to all Andromeda ADOs. Check AndrQuery.