Create a token
This tutorial describes the process of creating a basic fungible token on Magi.
Clone the Magi token contract template:
git clone https://github.com/vsc-eco/magi_token_contract your-tokencd your-tokenDeploy Token
Section titled “Deploy Token”Compile your token contract:
tinygo build -gc=custom -scheduler=none -panic=trap -no-debug -target=wasm-unknown -o build/main.wasm ./contractwasm-tools strip -o build/main-striped.wasm build/main.wasmThen deploy the contract:
# If not done already, init config and fill in deployer active keycontract-deployer -init
# Deploy tokencontract-deployer -wasmPath build/main-striped.wasm -name "your token name"Initialize Token
Section titled “Initialize Token”Call the init function from your token contract owner address (contract deployer if not specified) with the following payload:
{"name":"Token Name","symbol":"TKN","decimals":3,"maxSupply":1000000000}Mint Tokens
Section titled “Mint Tokens”Call the mint function from the token owner address with the below payload. The tokens minted will be sent to your address.
{"amount":1000}Burn Tokens
Section titled “Burn Tokens”Call the burn function with the below payload. The tokens will be burnt from the caller address.
{"amount":500}Transfer Tokens
Section titled “Transfer Tokens”Call the transfer function with the below payload specifying the destination address and amount.
{"to":"hive:recipient","amount":100}For more details on Magi token standards, please refer to the README.