home / skills / raintree-technology / claude-starter / token-standards

token-standards skill

/skills/aptos/token-standards

This skill helps you navigate Aptos token standards across fungible and non-fungible tokens, enabling correct minting, transfers, and royalties.

npx playbooks add skill raintree-technology/claude-starter --skill token-standards

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
5.9 KB
---
name: aptos-token-standards
description: Expert on Aptos token standards including fungible tokens (Coin framework, Fungible Asset), NFTs (Digital Asset/Token V2), collections, metadata, minting, burning, royalties, and transfer patterns.
allowed-tools: Read, Write, Edit, Grep, Glob, Bash
model: sonnet
license: MIT
metadata:
  author: raintree
  version: "1.0"
---

# Aptos Token Standards Expert

Expert on Aptos token standards for fungible and non-fungible tokens.

## Triggers

- token, nft, fungible asset
- coin, digital asset, collection
- mint, burn, metadata, royalty
- Token V1, Token V2

## Token Frameworks Overview

| Framework | Type | Status | Use For |
|-----------|------|--------|---------|
| Coin (0x1::coin) | Fungible | Current | Simple tokens, APT |
| Fungible Asset | Fungible | Current | Advanced features |
| Token V1 (0x3) | NFT | Deprecated | Legacy only |
| Digital Asset (0x4) | NFT | Current | All new NFTs |

## Coin Framework

### Create Coin

```move
module my_addr::my_coin {
    use aptos_framework::coin;
    
    struct MyCoin {}
    
    struct Caps has key {
        mint_cap: coin::MintCapability<MyCoin>,
        burn_cap: coin::BurnCapability<MyCoin>,
    }
    
    fun init_module(sender: &signer) {
        let (burn_cap, freeze_cap, mint_cap) = coin::initialize<MyCoin>(
            sender,
            string::utf8(b"My Coin"),
            string::utf8(b"MYC"),
            8,    // decimals
            true, // monitor_supply
        );
        move_to(sender, Caps { mint_cap, burn_cap });
    }
}
```

### Coin Operations

```move
// Mint
let coins = coin::mint(amount, &caps.mint_cap);
coin::deposit(recipient, coins);

// Burn
let coins = coin::withdraw<MyCoin>(account, amount);
coin::burn(coins, &caps.burn_cap);

// Transfer
coin::transfer<MyCoin>(from, to, amount);

// Balance
coin::balance<MyCoin>(account);

// Register to receive
coin::register<MyCoin>(account);
```

## Fungible Asset Framework

### Create Fungible Asset

```move
use aptos_framework::fungible_asset::{Self, MintRef, BurnRef, TransferRef};
use aptos_framework::primary_fungible_store;

struct Refs has key {
    mint_ref: MintRef,
    burn_ref: BurnRef,
    transfer_ref: TransferRef,
}

fun init_module(admin: &signer) {
    let constructor_ref = &object::create_named_object(admin, b"MY_FA");
    
    primary_fungible_store::create_primary_store_enabled_fungible_asset(
        constructor_ref,
        option::none(),  // max_supply
        string::utf8(b"My FA"),
        string::utf8(b"MFA"),
        8,
        string::utf8(b"https://icon.png"),
        string::utf8(b"https://project.com"),
    );
    
    move_to(admin, Refs {
        mint_ref: fungible_asset::generate_mint_ref(constructor_ref),
        burn_ref: fungible_asset::generate_burn_ref(constructor_ref),
        transfer_ref: fungible_asset::generate_transfer_ref(constructor_ref),
    });
}
```

### FA Operations

```move
// Mint
let fa = fungible_asset::mint(&refs.mint_ref, amount);
primary_fungible_store::deposit(recipient, fa);

// Burn
let fa = primary_fungible_store::withdraw(holder, amount);
fungible_asset::burn(&refs.burn_ref, fa);

// Freeze
fungible_asset::set_frozen_flag(&refs.transfer_ref, account, true);
```

## Digital Asset (NFT - Token V2)

### Create Collection

```move
use aptos_token_objects::collection;

collection::create_unlimited_collection(
    creator,
    string::utf8(b"Description"),
    string::utf8(b"Collection Name"),
    option::none(),  // royalty
    string::utf8(b"https://collection.uri"),
);

// Or fixed supply
collection::create_fixed_collection(creator, description, max_supply, name, royalty, uri);
```

### Mint NFT

```move
use aptos_token_objects::token;

let constructor_ref = token::create_named_token(
    creator,
    collection_name,
    string::utf8(b"Description"),
    token_name,
    option::none(),  // royalty
    string::utf8(b"https://token.uri"),
);

// Transfer to recipient
let transfer_ref = object::generate_transfer_ref(&constructor_ref);
let linear_ref = object::generate_linear_transfer_ref(&transfer_ref);
object::transfer_with_ref(linear_ref, recipient);
```

### NFT Properties

```move
use aptos_token_objects::property_map;

let mutator_ref = property_map::generate_mutator_ref(&constructor_ref);

property_map::add_typed(&mutator_ref, string::utf8(b"level"), 1u64);
property_map::add_typed(&mutator_ref, string::utf8(b"rarity"), string::utf8(b"legendary"));

// Update later
property_map::update_typed(&mutator_ref, &string::utf8(b"level"), 2u64);
```

### NFT Transfer & Burn

```move
// Transfer
object::transfer(owner, token_object, recipient);

// Burn
token::burn(owner, token_object);
```

## Royalties

```move
use aptos_token_objects::royalty;

let royalty = royalty::create(
    5,    // numerator (5%)
    100,  // denominator
    payee_address
);

collection::create_unlimited_collection(
    creator, description, name,
    option::some(royalty),  // royalty
    uri
);
```

## Comparison

### Coin vs Fungible Asset

| Feature | Coin | Fungible Asset |
|---------|------|----------------|
| Simplicity | Simple | More complex |
| Flexibility | Limited | Extensive |
| Freeze/Pause | Yes | Yes (more control) |
| Adoption | Wide | Growing |

### Token V1 vs Digital Asset

| Feature | Token V1 | Digital Asset |
|---------|----------|---------------|
| Object model | No | Yes |
| Composability | Limited | High |
| Soul-bound | No | Yes |
| Status | Deprecated | Current |

## Best Practices

- Use Digital Asset for all new NFT projects
- Use Fungible Asset for advanced token features
- Store capability refs securely
- Validate inputs before minting
- Consider upgrade patterns early
- Test thoroughly before mainnet

## TypeScript Integration

```typescript
// Coin balance
const balance = await aptos.getAccountCoinAmount({
  accountAddress: "0x...",
  coinType: "0x1::aptos_coin::AptosCoin"
});

// NFTs
const tokens = await aptos.getAccountOwnedTokens({ accountAddress: "0x..." });

// Token data
const data = await aptos.getDigitalAssetData({ digitalAssetAddress: "0x..." });
```

Overview

This skill is an expert reference for Aptos token standards covering fungible tokens (Coin, Fungible Asset) and NFTs (Digital Asset / Token V2). It explains creation, minting, burning, transfers, collections, metadata, royalties, and recommended patterns for production systems. It targets developers building on Aptos who need practical, production-ready guidance.

How this skill works

The skill inspects and explains core Move primitives and Aptos framework modules used to implement tokens: coin, fungible_asset, aptos_token_objects, collection, token, property_map, royalty, and object transfer refs. It summarizes code patterns for initializing modules, generating and storing capability refs, minting/burning, registering accounts, and managing metadata and royalties. It also contrasts legacy Token V1 with current Digital Asset (Token V2) and highlights when to choose Coin vs Fungible Asset.

When to use it

  • Start new NFT projects with Digital Asset (Token V2) for composability and metadata features.
  • Use Coin framework for simple fungible tokens like APT or straightforward ERC20-like tokens.
  • Use Fungible Asset when you need advanced controls: freeze, transfer refs, or configurable supply.
  • Implement royalties via the royalty helper when secondary-sale fees are required.
  • Prefer object-model tokens when you need on-chain mutable properties or composable assets.

Best practices

  • Store mint/burn/transfer capability refs securely inside module-hosted resources.
  • Validate metadata and typed properties before minting to avoid immutable mistakes.
  • Prefer Digital Asset for new NFTs; avoid Token V1 except for legacy compatibility.
  • Design upgrade or migration patterns early; include tests for supply and permission flows.
  • Test on devnet/testnet with full lifecycle: create, mint, transfer, freeze, burn, and royalty settlement.

Example use cases

  • Create a utility token with Coin for in-platform payments and simple balances.
  • Launch a game NFT collection with Digital Asset, using property_map for level and rarity upgrades.
  • Issue a capped fungible asset with Fungible Asset for tokenized in-game currency that supports freezes.
  • Mint collectibles with per-collection royalties to enforce creator fees on secondary markets.
  • Implement soul-bound or composable assets using Token V2 object patterns.

FAQ

When should I choose Coin vs Fungible Asset?

Choose Coin for simple tokens and broad compatibility; choose Fungible Asset for advanced controls (freeze, transfer refs, custom supply) and richer administration.

Are Token V1 tokens still supported?

Token V1 is deprecated; only use it for legacy compatibility. Use Digital Asset (Token V2) for all new NFT projects due to the object model and composability.