LogoLogo
WebsiteTwitterGitHub
  • Introduction
    • Bridge
  • Wallets
    • fWallet
    • Rabby
    • MetaMask
    • Coinbase Wallet
    • Ledger
  • Staking
    • Overview
    • Stake FTM
    • Liquid Staking
    • Governance
  • Build on Opera
    • Overview
    • Tutorials
      • Deploy Contract
      • Verify Contract
      • Unit Test Contract
      • Create Fixed-Cap Asset
      • Create Variable-Cap Asset
      • Proxy Pattern
      • Diamond Proxy Pattern
    • Oracles
      • Chainlink
      • Band Protocol
      • API3
    • API
      • Public Endpoints
      • Transaction Tracing
      • Web3 API
      • GraphQL
        • Getting Started
        • Installation
        • Schema Basics
        • Schema Structure
        • Implementation Details
    • Providers
      • Contracts
        • Chainstack
        • thirdweb
        • GetBlock
      • API
        • The Graph
        • Covalent
        • Moralis
  • Funding
    • Gas Monetization
  • Run a Node
    • Overview
    • Node Providers
    • Mainnet
      • Run Validator Node
      • Run API Node
    • Testnet
      • Run Validator Node
      • Run Read-Only Node
    • Troubleshooting
    • FAQ
  • Technology
    • Overview
    • Consensus
    • Database Storage
    • Proof of Stake
    • Transaction Fees
    • Stablecoin
    • FAQ
  • Security
    • Contract Library
    • Fantom Safe
Powered by GitBook

© 2024 Fantom Foundation

On this page
Export as PDF
  1. Build on Opera
  2. Tutorials

Create Fixed-Cap Asset

PreviousUnit Test ContractNextCreate Variable-Cap Asset

Fixed-cap assets are fungible tokens for which the supply is determined at the time of asset creation. No additional quantities can be generated afterward.

Create the Asset

  1. Write the token smart contract:

    1. Functions

      1. Fixed-cap assets

        1. constructor(cap)

        2. cap()

        3. _beforeTokenTransfer(from, to, amount)

      2. General

        1. name()

        2. symbol()

        3. decimals()

        4. totalSupply()

        5. balanceOf(account)

        6. transfer(recipient, amount)

        7. allowance(owner, spender)

        8. approve(spender, amount)

        9. transferFrom(sender, recipient, amount)

        10. increaseAllowance(spender, addedValue)

        11. decreaseAllowance(spender, subtractedValue)

        12. _transfer(sender, recipient, amount)

        13. _mint(account, amount)

        14. _burn(account, amount)

        15. _approve(owner, spender, amount)

        16. _setupDecimals(decimals_)

  2. Compile your code into bytecode

  3. Deploy your fixed-cap asset by sending your code in a transaction to the Opera network

  4. Navigate to to check that your token has been created

This contract is designed to be unopinionated, allowing developers to access the internal functions in ERC-20 (such as ) and expose them as external functions in the way they prefer. On the other hand, (such as ) are designed using opinionated patterns to provide developers with ready-to-use, deployable contracts.

https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Capped.sol
the Explorer
_mint
ERC-20 Presets
ERC-20PresetMinterPauser