# Composable SNIP-20 **Based on the SNIP-20 Reference Implementation in:** [https://github.com/enigmampc/snip20-reference-impl](https://github.com/enigmampc/snip20-reference-impl) **Forked at:** [5bde578](https://github.com/enigmampc/snip20-reference-impl/tree/5bde5789a856462d1b77b02018867c56620022c5) This is an implementation of a [SNIP-20](https://github.com/SecretFoundation/SNIPs/blob/master/SNIP-20.md), [SNIP-21](https://github.com/SecretFoundation/SNIPs/blob/master/SNIP-21.md), [SNIP-22](https://github.com/SecretFoundation/SNIPs/blob/master/SNIP-22.md) and [SNIP-23](https://github.com/SecretFoundation/SNIPs/blob/master/SNIP-23.md) compliant token contract. At the time of token creation you may configure: * Public Total Supply: If you enable this, the token's total supply will be displayed whenever a TokenInfo query is performed. DEFAULT: false * Enable Deposit: If you enable this, you will be able to convert from SCRT to the token.* DEFAULT: false * Enable Redeem: If you enable this, you will be able to redeem your token for SCRT.* It should be noted that if you have redeem enabled, but deposit disabled, all redeem attempts will fail unless someone has sent SCRT to the token contract. DEFAULT: false * Enable Mint: If you enable this, any address in the list of minters will be able to mint new tokens. The admin address is the default minter, but can use the set/add/remove_minters functions to change the list of approved minting addresses. DEFAULT: false * Enable Burn: If you enable this, addresses will be able to burn tokens. DEFAULT: false \*:The conversion rate will be 1 uscrt for 1 minimum denomination of the token. This means that if your token has 6 decimal places, it will convert 1:1 with SCRT. If your token has 10 decimal places, it will have an exchange rate of 10000 SCRT for 1 token. If your token has 3 decimal places, it will have an exchange rate of 1000 tokens for 1 SCRT. You can use the exchange_rate query to view the exchange rate for the token. The query response will display either how many tokens are worth 1 SCRT, or how many SCRT are worth 1 token. That is, the response lists the symbol of the coin that has less value (either SCRT or the token), and the number of those coins that are worth 1 of the other. ## Usage examples: To create a new token: ```secretcli tx compute instantiate '{"name":"","symbol":"","admin":"","decimals":,"initial_balances":[{"address":"","amount":""}],"prng_seed":"","config":{"public_total_supply":,"enable_deposit":,"enable_redeem":,"enable_mint":,"enable_burn":}}' --label --from ``` The `admin` field is optional and will default to the "--from" address if you do not specify it. The `initial_balances` field is optional, and you can specify as many addresses/balances as you like. The `config` field as well as every field in the `config` is optional. Any `config` fields not specified will default to `false`. To deposit: ***(This is public)*** ```secretcli tx compute execute '{"deposit": {}}' --amount 1000000uscrt --from ``` To send SSCRT: ```secretcli tx compute execute '{"transfer": {"recipient": "", "amount": ""}}' --from ``` To set your viewing key: ```secretcli tx compute execute '{"create_viewing_key": {"entropy": ""}}' --from ``` To check your balance: ```secretcli q compute query '{"balance": {"address":"", "key":"your_viewing_key"}}'``` To view your transaction history: ```secretcli q compute query '{"transfer_history": {"address": "", "key": "", "page": , "page_size": }}'``` To withdraw: ***(This is public)*** ```secretcli tx compute execute '{"redeem": {"amount": ""}}' --from ``` To view the token contract's configuration: ```secretcli q compute query '{"token_config": {}}'``` To view the deposit/redeem exchange rate: ```secretcli q compute query '{"exchange_rate": {}}'``` ## Troubleshooting All transactions are encrypted, so if you want to see the error returned by a failed transaction, you need to use the command `secretcli q compute tx `