Aptos Move by Example
  • 🚀Getting Started
  • Set-Up
  • Why is Move Secure
    • Move prover
  • Move vs Solidity
    • Resources
    • Parallel Processing
    • Reentrancy attacks
    • Memory management
    • Smart contract verification
    • Compiled language
  • Basic Concepts
    • Move.toml
    • Primary data-types
    • Strings
    • Comments
    • Functions
    • Function Visibilities
    • Control flow and expressions
    • Loops
    • Error
    • Struct and its Abilities
    • Scripts
    • Operations
  • Intermediate Concepts
    • Local variables
    • Constants
    • Signer
    • Vector
    • Address
    • Uses and Aliases
    • Maps
    • Hash functions
    • References
    • Unit test
    • Generics
    • Type Arguments
    • Type Inference
  • Advanced Concepts
    • Global Storage Structure
    • Global Storage Operations
    • Phantom Type Parameters
    • Timestamps
    • Ownership
    • Move coding conventions
    • View functions
    • Aptos account
    • Aptos Coin
    • Aptos Token(Nft)
    • Object
    • Token V2
  • Applications
    • First App
    • ToDoList
    • Voting System
    • Basic Tokens
    • Storage using Generics
    • Company
    • Collection
    • Football Card
    • Staking Module
    • MultiSender Wallet
    • English Auction
    • Dutch Auction
    • Attendance Sheet
    • Polling Contract
    • Lottery Contract
  • Decentralized Finance
    • Simple Swap Protocol Contract
    • Code of Swapping Protocol
  • Hacks
    • Coming soon
  • Hands on tutorials
    • Indexer tutorials
Powered by GitBook
On this page
Edit on GitHub
  1. Advanced Concepts

Token V2

What is Token V2?

The Aptos token v2 standard was developed with the following as an improvement on the Aptos Token standard. It has these ideas in mind:

  • Flexibility - NFTs are flexible and can be customised to accommodate any creative designs.

  • Composability - Multiple NFTs can be easily composed together, such that the final object is greater than the sum of its parts

  • Scalability - Greater parallelism between tokens

Key Difference between Token V2 and other Aptos token standard:

  • Token V2 is an object based token.

  • Decoupled token ownership from token data

  • Explicit data model for token metadata via adjacent resources

  • Extensible framework for tokens

Comparison between Token V1 and Token V2:

  • Token can be easily extended with custom data and functionalities without requiring any changes in the framework

  • Transfers simply a reference update

  • Direct transfer is allowed without an opt in

  • NFTs can own other NFTs adding easy composability

  • Soul bound tokens can be easily supported

Lets understand Token V2 using a simple example for creating a token

module my_addrx::TokenV2
{
    use std::signer;
    use aptos_framework::object; 
    use std::option;
    use aptos_token_objects::token::{Self, Token};
    use aptos_token_objects::royalty;
    use std::string::String;

    public entry fun create_token(account: &signer,collection_name: String, token_name: String, token_description: String, token_uri: String ) {
        
        let signer_address = signer::address_of(account);
        let royalty = royalty::create(1, 10, signer_address);
      
        //minting nft
        let token_constructor_ref = token::create_named_token(
            account,
            collection_name,
            token_description,
            token_name,
            option::some(royalty),
            token_uri
        );
        let obj = object::object_from_constructor_ref<Token>(&token_constructor_ref);
        //Transfering the NFT to the signer of the transaction
        let obj_signer = object::generate_signer(&token_constructor_ref);   
        object::transfer(&obj_signer,obj,signer_address);
    }
}
PreviousObjectNextApplications

Last updated 1 year ago

For more details .

follow this