CW20 V1.0.0
Introduction
The CW20 ADO is a smart contract to initiate a standard CW20 token. CW20 is a specification for fungible tokens based on CosmWasm. The name and design is loosely based on Ethereum's ERC20 standard, but many changes have been made.
Ado_type: cw20
InstantiateMsg
The symbol can only consist of letters and has to be between 3 and 12 characters.
Decimals will indicate how divisible your token is. Having a decimal of 6 means you could have 0.000001 of your token. Showcasing the decimalized amounts is usually handled by the front-end interface that would take the amount of tokens and divide it by the number of decimals. This means that when you transfer or send tokens from this ADO directly, you would still use whole numbers. For example, if I want to transfer 5 full tokens to someone and I have 6 decimals for my token, I would be sending 5000000 tokens from this ADO.
Name | Type | Description |
---|---|---|
| String | The name of the token. |
| String | The symbol of the token. |
| u8 | The number of decimals for the token. |
| Vec<Cw20Coin> | A vector containing a list of addresses and the amount of coin to initialize each. |
| Option<MinterResponse> | Optional field to define a minter for the token and an optional cap for the total supply of tokens that can be minted. If not defined, additional tokens cannot be minted. |
| Option<InstantiateMarketingInfo> | Optional field to define the marketing information of the project. |
| 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. |
Cw20Coin
Struct used to initiate balances for addresses. Contains an address and the amount of tokens for that address.
InstantiateMarketingInfo
Struct used to store the marketing related data of the token.
Name | Type | |
---|---|---|
| Option<String> | A URL pointing to the project behind this token. |
| Option<String> | A longer description of the token and it's utility. Designed for tooltips or such. |
| Option<String> | The address (if any) who can update this data structure. |
| Option<Logo> | A link to the logo, or a comment that there is an on-chain logo stored. |
Logo
Url: A reference to an externally hosted logo. Must be a valid HTTP or HTTPS URL.
Embedded: Logo content stored on the blockchain. Enforce maximum size of 5KB on all variants
EmbeddedLogo
Svg: Store the Logo as an SVG file. The content must conform to the specifications found here.
Png: Store the Logo as a PNG file. This will likely only support up to 64x64 or so within the 5KB limit.
MinterResponse
The cap refers to the total supply. If it is not specified, then there is an unlimited cap.
Name | Type | Description |
---|---|---|
| String | The address to assign as a minter. |
| Option<Uint128> | A hard cap on total amount of CW20 tokens that can be minted by this ADO. |
ExecuteMsg
Mint
Only with the "mint" extension. If authorized, creates amount new tokens and adds to the recipient balance.
Name | Type | Description |
---|---|---|
| String | The address to receive the minted tokens. |
| Uint128 | The amount of tokens to mint. |
Transfer
Transfer is a base message to move tokens to another account without triggering actions.
Name | Type | Description |
---|---|---|
| The address to transfer the tokens to. | |
| Uint128 | The amount of tokens to transfer. |
Send
Send is a base message to transfer tokens to a contract and trigger an action on the receiving contract.
The amount
sent might be affected depending on the attached modules.
The msg
should be base64 encoded and not raw binary.
This message is used when sending tokens to other ADOs that interact with CW20 tokens. In that case, the msg
should be a CW20HookMsg that would be defined in the ADOs documentation page.
Name | Type | Description |
---|---|---|
| The address of the receiving contract. | |
| Uint128 | The amount to send. |
| Binary | A message to be sent to the receiving contract. |
Burn
Burn is a base message to destroy tokens forever
Name | Type | Description |
---|---|---|
| Uint128 | The amount of coins to be burnt. |
IncreaseAllowance
Sets an amount
of tokens from the owner that the specified spender
can interact with.
A new Expiration will overwrite a previous one.
Name | Type | Description |
---|---|---|
| String | The address to receive the allowance. |
| Uint128 | The amount of tokens to give the spender access to. |
| Option<Expiration> | Optional Expiration for the allowance of the spender. |
DecreaseAllowance
Decreases the allowance set for the spender
by the set amount.
The amount specified in DecreaseAllowance
does not replace the old amount but is subtracted from it. If the result is 0 or less, then the spender no longer has an Allowance from the owner.
If an Expiration
is set, it will overwrite previously set Expiration
Name | Type | Description |
---|---|---|
| String | The address to have their allowance decreased. |
| Uint128 | The amount to decrease the allowance by. |
| Option<Expiration> | Optional expiration for the allowance of the spender. |
TransferFrom
Transfers the amount
of tokens from the owner
address to the recipient.
The amount specified
cannot exceed the allowance of the address executing TransferFrom.
Name | Type | Description |
---|---|---|
| String | The owner address that has the tokens to transfer. |
| String | The address the receive the tokens. |
| Uint128 | The amount of tokens to send from the owner to the recipient. |
SendFrom
Sends the amount
of tokens from the owner
address to the contract
address. Can use a msg to trigger an action on the receiving contract.
The amount specified
cannot exceed the allowance of the address executing TransferFrom.
The msg
should be base64 encoded and not raw binary.
Name | Type | Description |
---|---|---|
| String | The owner address that has the tokens to transfer. |
| String | The contract address to receive the tokens. |
| Uint128 | The amount of tokens to send from the owner to the contract. |
| Binary | A message to be sent to the receiving contract. |
BurnFrom
Burns a specified amount
of tokens from the owner
address forever.
The amount specified
cannot exceed the allowance of the address executing BurnFrom.
Name | Type | Description |
---|---|---|
| String | The address to burn tokens from. |
| Uint128 | The amount of tokens to burn. |
UpdateMarketing
Updates the marketing information if instantiated.
Setting None/null for any of these will leave it unchanged
Name | Type | Description |
---|---|---|
| Option<String> | A URL pointing to the project behind this token. |
| Option<String> | A longer description of the token and it's utility. Designed for tooltips or such. |
| Option<String> | The address (if any) who can update this data structure. |
UploadLogo
Uploads a Logo for the token.
Check Logo.
UpdateMinter
Only with the "mintable" extension. The current minter may set a new minter. Setting the minter to None will remove the token's minter forever.
Only available to the current minter.
Name | Type | Description |
---|---|---|
| Option<String> | The address of the new minter. If not specified, then the token minter is removed forever. |
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
Balance
Queries the balance of a specific address.
Name | Type | Description |
---|---|---|
| String | The address to get the balance of. |
BalanceResponse
Name | Type | Description |
---|---|---|
| Uint128 | The amount of tokens the specified |
TokenInfo
Returns metadata on the contract.
TokenInfoResponse
Name | Type | Description |
---|---|---|
| String | The name of the token. |
| String | The symbol of the token. |
| u8 | The number of decimals for the token. |
| Uint128 | The total amount of tokens. |
Minter
Returns who can mint and the hard cap on maximum tokens after minting
MinterResponse
Name | Type | Description |
---|---|---|
| String | The address of the assigned minter. |
| Option<Uint128> | Cap is a hard cap on total supply that can be achieved by minting. |
Allowance
Returns the amount of tokens that the spender has from the owner's tokens and the expiration for the tokens.
Name | Type | Description |
---|---|---|
| String | The address of the owner of the tokens. |
| String | The address to check the allowance of. |
AllowanceResponse
Name | Type | Description |
---|---|---|
| Uint128 | The amount of tokens the spender has as allowance. |
| The expiration for the tokens. |
AllAllowanaces
Returns all the allowances that the specified owner
has given along with the information for each allowance.
Name | Type | Description |
---|---|---|
| String | The address of the owner that has given allowances. |
| Option<String> | An optional Id for which to start after, used for pagination. |
| Option<u32> | An optional limit to how many allowances are returned. Is set by default to 10. Can be set to reach a maximum of 30. |
AllAllowanceResponse
Name | Type | Description |
---|---|---|
| Vec<AllowanceInfo> | A vector containing each allowance and the related information. |
AllowanceInfo
Name | Type | Description |
---|---|---|
| String | The address that has an allowance. |
| Uint128 | The amount of tokens in the allowance. |
| The expiration for the allowance. |
AllSpenderAllowances
Returns all allowances this spender has been granted. Supports pagination.
Name | Type | Description |
---|---|---|
| String | The address we want to check the allowances for. |
| Option<String> | An optional Id for which to start after, used for pagination. |
| Option<u32> | An optional limit to how many allowances are returned. Is set by default to 10. Can be set to a maximum of 30. |
AllAccounts
Returns all the addresses that have a balance.
Name | Type | Description |
---|---|---|
| Option<String> | An optional Id for which to start after, used for pagination. |
| Option<u32> | An optional limit to how many Accounts are returned. Is set by default to 10. Can be set to reach a maximum of 30. |
AllAccountsResponse
Name | Type | Description |
---|---|---|
| Vec<String> | A vector containing the addresses that own the token. |
MarketingInfo
Returns the metadata of the marketing of the project.
MarketingInfoResponse
Name | Type | Description |
---|---|---|
| Option<String> | A URL pointing to the project behind this token. |
| Option<String> | A longer description of the token and it's utility. Designed for tooltips or such. |
| Option<LogoInfo> | A link to the logo, or a comment there is an on-chain logo stored. |
| Option<Addr> | The address (if any) who can update this data structure. |
DownloadLogo
Downloads the embedded logo data (if stored on chain). Errors if no logo data stored for this contract.
DownloadLogoResponse
Name | Type | Description |
---|---|---|
| String | The MIME type of the logo. |
| Binary | The LOGO data. |
Base Queries
The rest of the query messages can be found in the ADO Base section.
Last updated