Crowdfund V1.0.0
Introduction
As the name suggests, the Crowdfund ADO is a smart contract that allows users to start a crowdfund for their projects by selling NFTs.
The owner of the contract can start the crowdfund by executing StartSale
. Before starting the sale, they can use the contract to mint the tokens from the specified token_address
in the InstantiateMsg
. In order to be eligible for the sale, the NFT needs to be minted and owned by the crowdfund ADO.
We allow for owners other than the contract, incase the creator wants to set aside a few tokens for some other use, say airdrop, team allocation, etc., but only those which have the contract as the owner will be available to sell.
Every sale sets a min_tokens_sold
which specifies the minimum number of tokens that need to be sold in order for the sale to be considered successful. This acts as an insurance for the buyers by allowing them to get a refund in case this goal was not achieved. If this threshhold is met, the owner can end the sale.
Ado_type: crowdfund
InstantiateMsg
Name | Type | Desctription |
---|---|---|
| The reference to the CW721 ADO that will mint the NFTs for the sale. Can be either the contract address or a VFS reference. | |
| bool | A flag to whether minting is allowed after a sale has been done. Minting is never allowed during a sale. |
| 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 token to be sold in a future sale. The message fields are defined and sent to the corresponding token contract defined as the token_address
in the instantiation to mint. We use a vector of MintMsg
to facilitate bulk minting for projects.
We allow for owners to be other than the contract incase the creator wants to set aside a few tokens for some other use, say airdrop, team allocation, etc... Only the tokens minted with the contract as the owner will be available to sell in the sale.
Only the contract owner can execute Mint.
Minting is only allowed before a sale starts.
The limit for the number of MintMsg
is 100.
Unlike other mint messages, the crowdfund mint allows users to keep the owner field empty defaulting the owner to the crowdfund ADO, making it eligible for a sale.
CrowdfundMintMsg
Name | Type | Description |
---|---|---|
| String | Unique Id of the NFT. |
| Option<String> | The owner of the newly minted NFT. In order to be included in the sale, the owner field should be kept empty or set as the crowdfund contract. |
| Option<String> | Universal resource identifier for this NFT Should point to a JSON file that conforms to the CW721 Metadata JSON Schema. |
| Any custom extension used by this contract. |
StartSale
Initiates a new crowdfund with the specified information.
Only available to the contract owner.
An Expiration must be set and not in past date.
A sale should not be already ongoing.
Name | Type | Description |
---|---|---|
| Option<MillisecondsExpiration> | An optional timestamp in milliseconds to when the sale start. The sale will immediately start if not specified. |
| Timestamp in milliseconds to specify when the sale ends. | |
| The price per token. | |
| Uint128 | The minimum amount of tokens sold to go through with the sale. |
| Option<u32> | The amount of tokens a wallet can purchase, default is 1. |
| The recipient of the funds if the sale met the |
Purchase
Purchases tokens based on the specified limit or amount of funds sent.
A sale needs to be in progress in order to purchase tokens.
If number_of_tokens
is not specified, the maximum number of tokens are purchased based on the funds allocated (Unless we reach the maximum allowed).
Name | Type | Description |
---|---|---|
| Option<u32> | An optional limit to the number of tokens to purchase. If not specified, the maximum number of tokens are purchased based on the funds allocated (Unless we reach the maximum allowed). |
PurchaseByTokenId
Purchases a token with the specified token_id
.
Name | Type | Descripton |
---|---|---|
| String | The token Id of the NFT to purchase. |
ClaimRefund
If the minimum number of tokens to be sold was not reached. The user can claim their own refund. Refunding will return the funds to the buyer and burn the token.
EndSale
Ends the sale. In the case that the minimum number of tokens to be sold is not achieved, refunds are sent to the buyers and tokens are burnt. If the minimum amount of tokens sold was achieved, the tokens are sent to the buyers and the funds to the recipient.
The sale can only be ended if the expiration of the sale has been reached or the threshhold of min tokens sold is met.
The EndSale message needs to be called twice. Once for distribution of NFTs and another for distribution of funds.
Name | Type | Description |
---|---|---|
| Option<u32>> | An optional limit on the number of transferred tokens in case the sale was a success, or the number of refunds to issue in case the sale did not succeed (min amount not reached). |
UpdateTokenContract
Updates the token address of the CW721 used by the Crowdfund to a new one.
Only available to the owner of the ADO.
Name | Type | Description |
---|---|---|
| The new token address to be used in the crowdfund. |
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
State
Queries the state of the sale. State is only available once a sale has started.
The response is stored in a State struct:
Name | Type | Description |
---|---|---|
| The expiration denoting when the sale ends as a timestamp in milliseconds. | |
| The price of each token. | |
| Uint128 | The minimum number of tokens sold for the sale to go through. |
| u32 | The max number of tokens allowed per wallet. |
| Uint128 | Number of tokens sold. |
| Uint128 | The amount of funds to send to recipient if sale successful. This already takes into account the royalties and taxes. |
| Uint128 | Number of tokens transferred to purchasers if sale was successful. |
| The recipient of the raised funds if the sale is successful. |
Config
Queries the configuration of the contract.
The response is stored in a Config struct:
Name | Type | Description |
---|---|---|
| String | The address of the token contract whose tokens are being sold. |
| bool | Whether or not the owner can mint additional tokens after the sale has been conducted. |
AvailableTokens
Queries the available tokens for sale.
Name | Type | Description |
---|---|---|
| Option<String> | Optional parameter to specify which Token to start from. If none specified index |
| Option<u32> | Limit to number of available tokens to query. |
Returns a Vec<String>
containing the token Ids of the available NFTs for sale.
IsTokenAvailable
Checks if the token with the specified token_id
is available for sale.
Name | Type | Description |
---|---|---|
| String | The Id of the token to check. |
Returns a bool
response specifyi ng whether the token is available for purchase or not.
Base Queries
The rest of the query messages can be found in the ADO Base section.
Last updated