Basic Coin Implementation
Fromexamples/move/coin/sources/my_coin.move:
Key Concepts
One-Time Witness (OTW)
TheMY_COIN struct is a one-time witness that proves this is the first (and only) time this module initializes:
- Same name as module (in UPPERCASE)
- Only has
dropability - Used once in
init
TreasuryCap
Controls minting and burning:CoinMetadata
Defines display properties:- Decimals: Number of decimal places
- Symbol: Ticker symbol (e.g., “BTC”)
- Name: Full name
- Description: Optional description
- Icon URL: Optional icon image
Fixed Supply Coin
Fromexamples/move/coin/sources/fixed_supply.move: