Andromeda
Search…
CW20
The message definitions for the Andromeda token contract.

Introduction

The CW20 Token ADO is a smart contract to initiate a standard CW20 coin.
Ado_type: cw20

InstantiateMsg

Rust
JSON
pub struct InstantiateMsg {
pub name: String,
pub symbol: String,
pub decimals: u8,
pub initial_balances: Vec<Cw20Coin>,
pub mint: Option<MinterResponse>,
pub marketing: Option<InstantiateMarketingInfo>,
pub modules: Option<Vec<Module>>,
}
{
"name": "mytoken",
"symbol":"MYT",
"decimals": 6,
"initial_balances":[
{
"address":"juno1...",
"amount":"500"
}
...
],
"mint":{
"minter":"juno1...",
"cap": "1000000"
}
}
Name
Type
Description
name
String
The name of the token.
symbol
String
The symbol of the token.
decimals
u8
The number of decimals for the token.
initial_balances
A vector containing a list of addresses and the amount of coin to initialize each.
mint
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.
marketing
Optional field to define the marketing information of the project.
modules
Option<Vec<Module>>
An optional vector of Andromeda Modules that can be attached to the contract. "address-list" module can be added.

Cw20Coin

Struct used to initiate balances for addresses. Contains an address and the amount of tokens for that address.
pub struct Cw20Coin {
pub address: String,
pub amount: Uint128,
}

InstantiateMarketingInfo

Struct used to store the marketing related data of the token.
pub struct InstantiateMarketingInfo {
pub project: Option<String>,
pub description: Option<String>,
pub marketing: Option<String>,
pub logo: Option<Logo>,
}
Name
Type
Text
project
Option<String>
A URL pointing to the project behind this token.
description
Option<String>
A longer description of the token and it's utility. Designed for tooltips or such.
marketing
Option<String>
The address (if any) who can update this data structure.
logo
Option<Logo>
A link to the logo, or a comment that there is an on-chain logo stored.
pub enum Logo {
Url(String),
Embedded(EmbeddedLogo),
}
  • 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
pub enum EmbeddedLogo {
Svg(Binary),
Png(Binary),
}
  • Svg: Store the Logo as an SVG file. The content must conform to the specifications found here. (The contract should do some light-weight sanity-check validation).
  • Png: Store the Logo as a PNG file. This will likely only support up to 64x64 or so within the 5KB limit.

MinterResponse

pub struct MinterResponse {
pub minter: String,
pub cap: Option<Uint128>,
}
Name
Type
Description
minter
String
The address to assign as a minter.
cap
Option<Uint128>
A hard cap on total supply that can be achieved by minting.
The cap refers to the total supply. If None, there is unlimited cap.

ExecuteMsg

Mint

Only with the "mint" extension. If authorized, creates amount new tokens and adds to the recipient balance.
Rust
JSON
pub enum ExecuteMsg {
Mint {
recipient: String,
amount: Uint128
}
}
{
"mint":{
"recipient":"juno1...",
"amount": "100"
}
}
Name
Type
Description
recipient
String
The address to receive the minted tokens.
amount
Uint128
The amount of tokens to mint.

Transfer

Transfer is a base message to move tokens to another account without triggering actions.
The amount sent might be affected depending on the attached modules.
Rust
JSON
pub enum ExecuteMsg {
Transfer {
recipient: String,
amount: Uint128
}
}
{
"transfer":{
"recipient":"juno1...",
"amount": "100"
}
}
Name
Type
Description
recipient
String
The address to transfer the tokens to.
amount
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.
Rust
JSON
pub enum ExecuteMsg {
Send {
contract: String,
amount: Uint128,
msg: Binary,
}
}
{
"send":{
"contract":"juno1...",
"amount":"100",
"msg":""
}
}
Name
Type
Description
contract
String
The address of the receiving contract.
amount
Uint128
The amount to send.
msg
Binary
A message to be sent to the receiving contract.

Burn

Burn is a base message to destroy tokens forever
Rust
JSON
pub enum ExecuteMsg {
Burn {
amount: Uint128,
}
}
{
"burn": {
"amount": "100"
}
}
Name
Type
Description
amount
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.
Rust
JSON
pub enum ExecuteMsg {
IncreaseAllowance {
spender: String,
amount: Uint128,
expires: Option<Expiration>,
}
}
{
"increase_allowance":{
"spender":"juno1...",
"amount":"1000"
}
}
Name
Type
Description
spender
String
The address to receive the allowance.
amount
Uint128
The amount of tokens to give the spender access to.
expires
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
Rust
JSON
pub enum ExecuteMsg {
DecreaseAllowance {
spender: String,
amount: Uint128,
expires: Option<Expiration>,
}
}
{
"decrease_allowance": {
"spender":"juno1...",
"amount":"100",
"expires": {
"at_height": "500"
}
}
}
Name
Type
Description
spender
String
The address to have their allowance decreased.
amount
Uint128
The amount to decrease the allowance by.
expires
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.
Rust
JSON
pub enum ExecuteMsg {
TransferFrom {
owner: String,
recipient: String,
amount: Uint128,
}
}
{
"transfer_from":{
"owner":"juno1...",
"recipient":"juno1...",
"amount":"50"
}
}
Name
Type
Description
owner
String
The owner address that has the tokens to transfer.
recipient
String
The address the receive the tokens.
amount
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.
Rust
JSON
pub enum ExecuteMsg{
SendFrom {
owner: String,
contract: String,
amount: Uint128,
msg: Binary,
}
}
{
"send_from":{
"owner":"juno1...",
"contract":"juno1...",
"amount":"100",
"msg": ""
}
}
Name
Type
Description
owner
String
The owner address that has the tokens to transfer.
contract
String
The contract address to receive the tokens.
amount
Uint128
The amount of tokens to send from the owner to the contract.
msg
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.
Rust
JSON
pub enum ExecuteMsg{
BurnFrom {
owner: String,
amount: Uint128,
}
}
{
"burn_from":{
"owner":"juno1...",
"amount": "100"
}
}
Name
Type
Description
owner
String
The address to burn tokens from.
amount
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
Rust
JSON
pub enum ExecuteMsg {
UpdateMarketing {
project: Option<String>,
description: Option<String>,
marketing: Option<String>,
}
}
{
"update_marketing":{
"project":"http...",
"marketing":"juno1..."
}
}
Name
Type
Description
project
Option<String>
A URL pointing to the project behind this token.
description
Option<String>
A longer description of the token and it's utility. Designed for tooltips or such.
marketing
Option<String>
The address (if any) who can update this data structure.
Uploads a Logo for the token.
Rust
JSON
pub enum ExecuteMsg {
UploadLogo(Logo),
}
{
"upload_logo":{
"url":"https://www..."
}
}
Check Logo.

AndrReceive

Uses the modules feature.

QueryMsg

Balance

Queries the balance of a specific address.
Rust
JSON
pub enum QueryMsg {
Balance {
address:String,
}
}
{
"balance":{
"address":"juno1..."
}
}
Name
Type
Description
address
String
The address to get the balance of.

BalanceResponse

Rust
JSON
pub struct BalanceResponse {
pub balance: Uint128,
}
{
"balance":"100"
}
Name
Type
Description
balance
Uint128
The amount of tokens the specified address has in their balance.

TokenInfo

Returns metadata on the contract.
Rust
JSON
pub enum QueryMsg {
TokenInfo {}
}
{
"token_info":{}
}

TokenInfoResponse

Rust
JSON
pub struct TokenInfoResponse {
pub name: String,
pub symbol: String,
pub decimals: u8,
pub total_supply: Uint128,
}
{
"name":"mytoken",
"symbol":"MYT",
"decimals": 6,
"total_supply":"10000000"
}
Name
Type
Description
name
String
The name of the token.
symbol
String
The symbol of the token.
decimals
u8
The number of decimals for the token.
total_supply
Uint128
The total amount of tokens.

Minter

Returns who can mint and the hard cap on maximum tokens after minting
Rust
JSON
pub enum ExecuteMsg {
Minter {}
}
{
"minter":{}
}

MinterResponse

Rust
JSON
pub struct MinterResponse {
pub minter: String,
pub cap: Option<Uint128>,
{
"minter":"juno1...",
"cap":"1000000"
}
Name
Type
Description
minter
String
The address of the assigned minter.
cap
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.
Rust
JSON
pub enum QueryMsg {
Allowance {
owner: String,
spender: String
}
}
{
"allowance": {
"owner":"juno1...",
"spender":"juno1..."
}
}
Name
Type
Description
owner
String
The address of the owner of the tokens.
spender
String
The address to check the allowance of.

AllowanceResponse

Rust
JSON
pub struct AllowanceResponse {
pub allowance: Uint128,
pub expires: Expiration,
}
{
"allowance":"1000",
"expires":{
"at_height":"500"
}
}
Name
Type
Description
allowance
Uint128
The amount of tokens the spender has as allowance.
expires
The expiration for the tokens.

AllAllowanaces

Returns all the allowances that the specified owner has given along with the information for each allowance.
Rust
JSON
pub enum QueryMsg{
AllAllowances {
owner: String,
start_after: Option<String>,
limit: Option<u32>,
}
}
{
"all_allowances":{
"owner":"juno1...",
"limit": 20,
"start_after": 4
}
}
Name
Type
Description
owner
String
The address of the owner that has given allowances.
start_after
Option<String>
An optional ID for which to start after, used for pagination.
limit
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

Rust
JSON
pub struct AllAllowancesResponse {
pub allowances: Vec<AllowanceInfo>,
}
{
"allowances":[
{
"spender":"juno1...",
"allowance":"1000",
"expires":{
"never":{}
}
},
{
...
}
]
}
Name
Type
Description
allowances
Vec<AllowanceInfo>
A vector containing each allowance and the related information.

AllowanceInfo

pub struct AllowanceInfo {
pub spender: String,
pub allowance: Uint128,
pub expires: Expiration
}
Name
Type
Description
spender
String
The address that has an allowance.
allowance
Uint128
The amount of tokens in the allowance.
expires
The expiration for the allowance.

AllAccounts

Returns all the addresses that have a balance.
Rust
JSON
pub enum QueryMsg{
AllAccounts {
start_after: Option<String>,
limit: Option<u32>,
}
}
{
"all_accounts":{
"limit": 25
}
Name
Type
Description
start_after
Option<String>
An optional ID for which to start after, used for pagination.
limit
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

Rust
JSON
pub struct AllAccountsResponse {
pub accounts: Vec<String>,
}
{
"accounts":["juno1...","juno1...",...]
}
Name
Type
Description
accounts
Vec<String>
A vector containing the addresses that own the token.

MarketingInfo

Returns the metadata of the marketing of the project.
Rust
JSON
pub enum ExecuteMsg {
MarketingInfo {}
}
{
"marketing_info":{}
}

MarketingInfoResponse

Rust
JSON
pub struct MarketingInfoResponse {
pub project: Option<String>,
pub description: Option<String>,
pub logo: Option<LogoInfo>,
pub marketing: Option<Addr>,
}
{
"project":"http:...",
"description":" This project ...",
"marketing":"juno1..."
}
Name
Type
Description
project
Option<String>
A URL pointing to the project behind this token.
description
Option<String>
A longer description of the token and it's utility. Designed for tooltips or such.
logo
Option<LogoInfo>
A link to the logo, or a comment there is an on-chain logo stored.
marketing
Option<Addr>
The address (if any) who can update this data structure.
Downloads the embedded logo data (if stored on chain). Errors if no logo data stored for this contract.
Rust
JSON
pub enum ExecuteMsg {
DownloadLogo {}
}
{
"download_logo":{}
}

DownloadLogoResponse

Rust
pub struct DownloadLogoResponse {
pub mime_type: String,
pub data: Binary,
}
Name
Type
Description
mime_type
String
The MIME type of the logo.
data
Binary
The LOGO data.

AndrQuery

Check AndrQuery.
Copy link
Outline
Introduction
InstantiateMsg
ExecuteMsg
Mint
Transfer
Send
Burn
IncreaseAllowance
DecreaseAllowance
TransferFrom
SendFrom
BurnFrom
UpdateMarketing
UploadLogo
AndrReceive
QueryMsg
Balance
TokenInfo
Minter
Allowance
AllAllowanaces
AllAccounts
MarketingInfo
DownloadLogo
AndrQuery