Token Standards

Token Standards on æternity

The æternity blockchain provides robust support for both fungible and non-fungible tokens through well-defined token standards. These standards ensure interoperability and consistency across different implementations while leveraging the security and efficiency of æternity's native FATE virtual machine. Similar to how ERC-20 and ERC-721 revolutionized token creation on Ethereum, AEX-9 and AEX-141 serve as the foundational standards for building fungible and non-fungible tokens on æternity.

These standards have enabled the development of various DeFi applications and NFT projects within the æternity ecosystem. From decentralized exchanges and tipping systems to complex NFT collections, developers can utilize these battle-tested standards and reference implementations to build secure and scalable token-based applications. The standards are specifically designed to take advantage of æternity's unique features, including state channels for scalability and the Sophia smart contract language for enhanced security.

Fungible Token Standard (AEX-9)

The AEX-9 standard, inspired by Ethereum's ERC-20, provides a robust interface for implementing fungible tokens. These tokens are ideal for creating cryptocurrencies, governance tokens, or any other asset where each unit is interchangeable with another. The standard includes essential functions for token transfers, allowances, and balance tracking.

Non-Fungible Token Standard (AEX-141)

The AEX-141 standard, modeled after ERC-721, enables the creation of unique, non-fungible tokens. This standard is perfect for digital collectibles, gaming assets, or any application requiring distinct, non-interchangeable tokens. The implementation includes comprehensive metadata handling and transfer mechanics specifically optimized for the æternity blockchain.

Implementation Examples

DeFi Applications

The æternity ecosystem features several production-ready DeFi implementations that showcase the versatility of the AEX-9 standard:

Reference Implementation

The aeternity-fungible-token serves as the official reference implementation of the AEX-9 standard. This implementation provides developers with a solid foundation for creating their own fungible tokens, complete with best practices and security considerations.

Token Sale and DEX

  • Token Sale Example: The aeternity-token-sale-example demonstrates a straightforward implementation of a token sale contract, ideal for projects looking to launch their own tokens.

  • Superhero DEX: The dex-contracts-v2 implements an Automated Market Maker (AMM) protocol, powering the Superhero DEX. This sophisticated implementation shows how to create complex DeFi applications using AEX-9 tokens.

Social and Cross-Chain Solutions

  • Tipping System: The Superhero Social platform utilizes two key components:

  • Cross-Chain Trading: The jelly-ae-htlc implements Hashed TimeLock Contracts (HTLC), enabling secure cross-chain token swaps through the JellySwap protocol.

NFT Collection Examples

  • aex141-nft-collection-example: A production-ready example implementation that demonstrates:

    • Collection creation and management

    • NFT minting processes

    • Transfer functionality

    • Metadata handling

    • Integration with front-end applications

Additional Implementation Examples

  • aex141-examples: A comprehensive repository containing:

    • Multiple implementation patterns

    • Various use cases for different NFT types

    • Best practices for AEX-141 implementation

    • Extended functionality examples

    • Integration patterns with other æternity features

Getting Started

To begin working with these token standards, developers can:

  1. Review the standard specifications (AEX-9 or AEX-141)

  2. Explore the reference implementations

  3. Clone and modify the example repositories

  4. Test implementations using the æternity SDK

  5. Deploy to testnet for thorough testing before mainnet deployment

// Example AEX-9 Token Interface
contract interface FungibleToken =
  record meta_info = {
    name : string,
    symbol : string,
    decimals : int }
    
  datatype event = 
    Transfer(address, address, int)
    | Allowance(address, address, int)
    
  entrypoint meta_info : () => meta_info
  entrypoint total_supply : () => int
  entrypoint balance : address => option(int)
  entrypoint transfer : (address, int) => unit

For detailed implementation guides, code examples, and best practices, please refer to the specific documentation sections for each standard and example project. You can also refer to the documentation for AEXs in general:

Last updated

Was this helpful?