CW721
Introduction
The CW721 ADO is a smart contract to allow users to launch their own custom NFT projects. In addition to the standard CW721 messages, we have added some custom logic to further extend the utility and function of the contract.
The CW721 ADO is one of the base ADOs meaning it can interact with a large number of other ADOs such as the marketplace, crowdfund, auction, CW721 timelock and many more.
The contract has implemented a custom TransferAgreement
message to allow the buying/selling of tokens between two parties throught the CW721 ADO itself.
Ado_type: cw721
Version: 2.0.3-beta.1
InstantiateMsg
Name | Type | Description |
---|---|---|
| String | The name of the NFT collection. |
| String | The symbol of the NFT collection. |
| The address allowed to mint NFTs. | |
| String | Contract address of the kernel contract to be used for AMP messaging. Kernel contract address can be found in our deployed contracts. |
| Option<String> | Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified. |
ExecuteMsg
Mint
Mints a new NFT.
Only available to the defined minter
in the InstantiateMsg.
Name | Type | Description |
---|---|---|
| String | Unique Id of the NFT. |
| String | The address of the NFT owner. |
| Option<String> | URI pointing to the NFT metadata. You can read more about the NFT token URI and metadata standards here. |
| TokenExtension | Any custom extension used by this contract. Here we use TokenExtension. |
TokenExtension
Extension that can be added to an NFT when minting.
Name | Type | Description |
---|---|---|
| String | The entity to assign as the publisher of the NFT e.g. "Andromeda" or "Bob". (Immutable). |
BatchMint
Mint several NFTs at once.
Name | Type | Description |
---|---|---|
| Vec<MintMsg> | Vector of MintMsg. Similar to minting one token, but allows minting of many tokens in one go. |
TransferAgreement
Assigns a TransferAgreement
for a token. If the agreement
field is not set, the message will remove any previously set agreements on the token (Instead of making a new RemoveAgreement message).
Only available to the token owner.
Name | Type | Description |
---|---|---|
| String | The token Id of the NFT we want to add an agreement for. |
| Option<TransferAgreement> | The agreement for the token containing the selling price and the address allowed to purchase the token. If not specified then any previously set agreement is removed from the token. |
TransferAgreement
The purchaser
may use the TransferNft
message for this token as long as funds are provided equaling the amount
defined in the agreement.
If the purchaser
is set to "*"
then anyone can complete the TransferAgreement
(Anyone can buy the NFT).
Name | Type | Description |
---|---|---|
| The amount required for the purchaser to transfer ownership of the token. | |
| String | The address of the purchaser that is allowed to purchase the token. |
TransferNft
A CW721 compliant transfer method. Transfers ownership of a minted token.
Archived tokens cannot be transferred.
Only available to the contract owner, an approved operator, or a purchaser in a TransferAgreement
for the given token.
Name | Type | Description |
---|---|---|
| The address to receive the NFT. | |
| String | The token Id of the token to be transferred. |
SendNft
A CW721 compliant send method. Sends ownership of a minted token to an external contract.
Only available to the token owner/operator/approved address.
Name | Type | Description |
---|---|---|
| The address of the receiving contract. | |
| String | The Id of the token to be sent. |
| Binary | A message to be sent to the receiving contract. |
Burn
Destroys any token data related to an token Id. The Id of the token is still reserved.
Cannot be undone.
Only available to the token owner.
Name | Type | Description |
---|---|---|
| String | The Id of the token to burn. |
Archive
Archives an token, making it immutable in any respect. Once an token is archived it cannot be edited, transferred or burnt.
Cannot be undone.
Only available to the token owner.
Name | Type | Description |
---|---|---|
| String | The Id of the token to archive. |
Approve
A CW721 compliant approve method. Approves a given address as an operator for the token, allowing them to transfer, burn or archive the token.
Only available to the token owner/operator.
Name | Type | Description |
---|---|---|
| String | The address to be authorised as an operator. |
| String | The id of the token for which to assign the |
| Option<Expiration> | An optional expiration for the approval. Defaults to never. |
Revoke
A CW721 compliant revoke method. Revokes operator privileges for a given address.
Only available to the token owner/operator.
Name | Type | Description |
---|---|---|
| String | The address of the operator for which to revoke privileges. |
| String | The Id of the token for which to revoke operator privileges. |
ApproveAll
A CW721 compliant approve all method. Approves a given address as an operator for all tokens owned by the sender.
Will overwrite any approval currently assigned to the operator's address.
Name | Type | Description |
---|---|---|
| String | The address to be authorised as an operator. |
| Option<Expiration> | An optional expiration for the approval. Defaults to never. |
RevokeAll
A CW721 compliant revoke all method. Revokes an operator's privileges for any tokens owned by the sender.
Name | Type | Description |
---|---|---|
| String | The address of the operator for which to revoke privileges. |
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
Minter
Queries the current minter of the contract.
MinterResponse
OwnerOf
A CW721 compliant "owner of" query. Queries the current owner of a given token Id.
Name | Type | Description |
---|---|---|
| String | The Id of the token to query. |
| bool | Whether to include any expired owners. |
OwnerOfResponse
Name | Type | Description |
---|---|---|
| String | The owner of the queried token. |
| Vec<Approval> | An array of all approvals for the token. |
Approval
Name | Type | Description |
---|---|---|
| String | The address that is approved. |
| The expiration for the approval. |
Operator
Returns the approval of a given operator for all tokens of an owner. Errors if no approvals are set.
Name | Type | Description |
---|---|---|
| String | The address of the NFTs owner. |
| String | The address of the operator that has approvals over the specified |
| Option<bool> | Whether to include any expired approvals. |
OperatorResponse
Returns an Approval struct.
AllOperators
List all operators that can access all of the owner's tokens.
Name | Type | Description |
---|---|---|
| String | The address of the owner for which to query operators. |
| Option<bool> | Whether to include any expired approvals. |
| Option<u32> | An optional limit on how many approvals are returned. The default limit is 10 and the maximum limit allowed is 100. |
| Option<String> | An optional address for which to start after, used for pagination. |
OperatorsResponse
Name | Type | Description |
---|---|---|
| Vec<Approval> | An array of all approvals for the given owner address. |
NumTokens
A CW721 compliant "num tokens" query. Queries the amount of tokens minted by the contract.
NumTokensResponse
Name | Type | Description |
---|---|---|
| u64 | The amount of tokens minted by the contract. |
NftInfo
A CW721 compliant "nft info" query. Queries the stored info of a token.
Name | Type | Description |
---|---|---|
| String | The id of the token. |
NftInfoResponse
Name | Type | Description |
---|---|---|
| String | Universal resource identifier for this token. |
| T (Generic type) | Any extension being used by the contract to add custom metadata to the tokens. |
AllNftInfo
A CW721 compliant "all nft info" query. Queries all stored info of an token.
Name | Type | Description |
---|---|---|
| String | The token id of the NFT. |
| Option<bool> | Whether to include any expired approvals. |
AllNftInfoResponse
Name | Type | Description |
---|---|---|
| The address that can transfer the token. | |
| Data on the token itself. |
IsArchived
Checks if the token with the specified token_id
is archived.
Name | Type | Description |
---|---|---|
| String | The |
Returns a bool value.
TransferAgreement
Checks if the token has a TransferAgreement .
Name | Type | Description |
---|---|---|
| String | The token_id of the nft we want to check. |
Returns None if no TransferAgreement is found, and the TransferAgreement struct otherwise.
Tokens
Queries all the tokens of a particular owner.
Name | Type | Description |
---|---|---|
| String | The address that we want to check the tokens of |
| Option<String> | An optional address for which to start after, used for pagination. |
| Option<u32> | Optional limit to the number of tokens queried. It is set by default as 10 and can be set up to 30. |
TokensResponse
Contains all token_ids in lexicographical ordering. If there are more than limit
, use start_from
in future queries to achieve pagination.
AllTokens
Queries the tokens minted by the contract.
Name | Type | Description |
---|---|---|
| Option<String> | An optional address for which to start after, used for pagination. |
| Option<u32> | Optional limit to the number of tokens queried. It is set by default as 10 and can be set up to 30. |
TokensResponse
Contains all token_ids in lexicographical ordering. If there are more than limit
, use start_from
in future queries to achieve pagination.
ContractInfo
Queries the name and symbol of the token collection.
ContractInfoResponse
Name | Type | Description |
---|---|---|
| String | The name of the contract. |
| String | The assigned symbol of the contract. |
Approval
Queries the spender's approval to check for the expiration.
Name | Type | Description |
---|---|---|
| String | The token Id of the NFT to check. |
| String | The address to check the approvals. |
| Option<bool> | Optional flag to include the expired approvals. Defaults to false. |
ApprovalResponse
Name | Type | Description |
---|---|---|
| Approval | The approved spender and the expiration for the approval. |
Name | Type | Description |
---|---|---|
| String | Account that can transfer/send the token |
| When the Approval expires. Might be Expiration::never. |
Approvals
Returns all the approvals a token has.
Name | Type | Description |
---|---|---|
| String | The token Id of the NFT to get approvals for. |
| Option<bool> | Optional flag to include the expired approvals. Defaults to false. |
ApprovalsResponse
Return a vector of Approval.
Base Queries
The rest of the query messages can be found in the ADO Base section.