Skip to main content
GitHub: InitiaERC20

Overview

The InitiaERC20 contract is an implementation of the ERC20 token standard with additional functionalities such as access control, registry integration, and support for Cosmos blockchain interactions. This contract inherits from multiple contracts including IERC20, Ownable, ERC20Registry, ERC165, and ERC20ACL. It can be used in two ways: via the ERC20Factory for standard tokens, or inherited directly for custom tokens with additional logic.

Inheritance

  • IERC20: Interface for ERC20 standard functions.
  • Ownable: Provides ownership control.
  • ERC20Registry: Handles ERC20 registry functionalities.
  • ERC165: Supports interface identification.
  • ERC20ACL: Provides access control mechanisms.

Events

  • Transfer: Emitted when tokens are transferred from one address to another.
  • address indexed from: The address sending the tokens.
  • address indexed to: The address receiving the tokens.
  • uint256 value: The amount of tokens transferred.
  • Approval: Emitted when an address approves another address to spend tokens on its behalf.
  • address indexed owner: The address granting the approval.
  • address indexed spender: The address receiving the approval.
  • uint256 value: The amount of tokens approved.

State Variables

  • mapping(address => uint256) public balanceOf: Tracks the balance of each address.
  • mapping(address => mapping(address => uint256)) public allowance: Tracks the allowance each address has given to another address.
  • string public name: The name of the token.
  • string public symbol: The symbol of the token.
  • uint8 public decimals: The number of decimals the token uses.
  • uint256 public totalSupply: The total supply of the token.

Constructor

Initializes the contract with the token’s name, symbol, and decimals. The register_erc20 modifier registers the token with the ERC20 registry. InitiaERC20 is used for custom deployments only; factory-created tokens use the ERC20 contract.

Parameters

Functions

supportsInterface

Checks if the contract supports a given interface.

Parameters

Returns

_transfer

Transfers tokens from one address to another and registers the recipient’s ERC20 store if necessary.

Parameters

_mint

Mints new tokens and assigns them to an address, registering the recipient’s ERC20 store if necessary.

Parameters

_burn

Burns tokens from an address.

Parameters

transfer

Transfers tokens to a recipient, ensuring the recipient is not a blocked address.

Parameters

Returns

approve

Approves an address to spend a specified amount of tokens on behalf of the caller.

Parameters

Returns

transferFrom

Transfers tokens from one address to another on behalf of the sender, ensuring the recipient is not a blocked address.

Parameters

Returns

mint

Mints new tokens to a specified address, ensuring the recipient is not a blocked address. This function can only be called by the owner.

Parameters

burn

Burns tokens from the caller’s address, ensuring the sender is not a module address.

Parameters

burnFrom

Burns tokens from a specified address on behalf of the caller, ensuring the address is not a module address. Requires prior allowance approval.

Parameters

Returns

sudoTransfer

Transfers tokens from one address to another, bypassing the usual access control checks. This function can only be called by the chain signer.

Parameters