Aptos Coin Deployment
Introduction
This tutorial shows how to deploy your own coin.
Please refer to here to get started.
Create Template
Create a simple example contract code written in Move.
You can create a sample contract moon_coin by selecting the template option
and clicking the Create Template button.

Source Code
Note that init_module function is executed only once during deployment.
module MoonCoin::moon_coin {
use aptos_framework::coin;
struct MoonCoin {}
fun init_module(sender: &signer) {
aptos_framework::managed_coin::initialize<MoonCoin>(
sender,
b"Moon Coin",
b"MOON",
6,
false,
);
}
public entry fun register(account: &signer) {
aptos_framework::managed_coin::register<MoonCoin>(account)
}
public entry fun mint(account: &signer, dst_addr: address, amount: u64) {
aptos_framework::managed_coin::mint<MoonCoin>(account, dst_addr, amount);
}
public entry fun burn(account: &signer, amount: u64) {
aptos_framework::managed_coin::burn<MoonCoin>(account, amount);
}
public entry fun transfer(from: &signer, to: address, amount: u64,) {
coin::transfer<MoonCoin>(from, to, amount);
}
}
Note that you should replace MoonCoin address _ of your own account address.
[package]
name = "Examples"
version = "0.0.0"
[addresses]
MoonCoin = "_"
[dependencies]
AptosFramework = { git = "https://github.com/aptos-labs/aptos-core.git", subdir = "aptos-move/framework/aptos-framework/", rev = "main" }
Compile The Source Code
Select the project you want to compile. For now, let's choose aptos/moon_coin and click Compile button.

Deployment
If the compilation succeed, you can see mv file moon-coin.mv.
Click the Deploy button.

and you can see wallet popup. Let's click Send button.

Check Out Deployed Contract
After deployment, you can see moon_coin module and functions.

Calling Contract Functions
Call
registerfunction to accept deposits ofMoonCoin.
Select
mintfunction. First parameter is the address of receiver for minting coin and second parameter is the amount of minting coin. For now, set your account address for the first parameter because you have already registered above. The receiver should callregisterbefore callingmint.
Check if the coin have been minted in Aptos Explorer Coins tab.

Try more...
- Call
burnfunction and check it out in Aptos Explorer Coins tab. - Create and switch to new account address and try
register. Switch to the original address again and transfer or mint to the address you just newly created.