> ## Documentation Index
> Fetch the complete documentation index at: https://mantrachain.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ERC-20 Tokens

> Two ways to create ERC-20 tokens on MANTRA Chain

## Two Ways to Create ERC-20 Tokens

MANTRA Chain supports two methods for creating ERC-20 tokens, each with different use cases and benefits.

## Method 1: Deploy ERC-20 Contract in EVM

Deploy a standard ERC-20 contract inside the EVM (same experience as any EVM chain).

### Steps

1. **Write or use a standard ERC-20 contract**
   * Use OpenZeppelin's ERC20 contract
   * Or write your own ERC-20 implementation

2. **Deploy using standard EVM tooling**
   * Hardhat
   * Foundry
   * Remix
   * Or any EVM deployment tool

3. **Optionally, create a mapping to the Bank module**
   * This enables Cosmos SDK integration
   * Allows use in Cosmos-native applications

### Use Cases

* **Standard ERC-20 tokens**: Simple token requirements
* **External (non-MANTRA) developers**: Recommended approach
* **Quick deployment**: Fastest way to deploy tokens
* **Standard tooling**: Use familiar EVM development tools

### Example

```solidity theme={null}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor() ERC20("MyToken", "MTK") {
        _mint(msg.sender, 1000000 * 10**decimals());
    }
}
```

Deploy this contract using Hardhat, Foundry, or Remix - it works exactly like on Ethereum.

## Method 2: TokenFactory with ERC-20 Precompile

Create a denom in TokenFactory, which automatically creates a custom ERC-20 precompile address so the token can be used in the EVM.

### Steps

1. **Create token using TokenFactory module**
   * Use Cosmos SDK's TokenFactory
   * Configure token parameters

2. **Token automatically gets ERC-20 precompile address**
   * No additional setup required
   * Precompile address is deterministic

3. **Use token in EVM contracts seamlessly**
   * Call precompile from Solidity
   * Transfer, approve, and query balances

### Use Cases

* **MANTRA internal tokens**: Tokens created by MANTRA
* **Tokens requiring compliance features**: Access to Bank module compliance
* **Tokens that need Bank module integration**: Native Cosmos SDK support
* **Regulatory compliance**: Protocol-level compliance features

### Benefits

* **Compliance features**: Bank module has access to the token for compliance features
* **Seamless integration**: Works in both EVM and Cosmos SDK
* **Native protocol support**: Built-in MANTRA Chain features
* **No wrapping required**: Direct EVM access via precompile

## Recommendation

### For External Developers

**Use Method 1** (deploy standard ERC-20 contract):

* Familiar development experience
* Standard tooling and libraries
* No special setup required
* Works identically to other EVM chains

### For MANTRA

**Use Method 2** (TokenFactory) because:

* Compliance features built inside the protocol (specifically in the Bank module) have access to the token
* Seamless integration with Cosmos ecosystem
* Native protocol support
* Protocol-level compliance features

## TokenFactory ERC-20 Precompiles

Each TokenFactory token automatically gets:

* **ERC-20 precompile address**: Deterministic address based on token denom
* **Balance control**: Manage token balances from EVM
* **Transfer functionality**: Standard ERC-20 transfer operations
* **EVM contract compatibility**: Use in any EVM contract

### Using TokenFactory Tokens in EVM

```solidity theme={null}
// Example: Using a TokenFactory token in EVM
// The precompile address is deterministic based on the token denom

interface ITokenFactoryERC20 {
    function transfer(address to, uint256 amount) external returns (bool);
    function balanceOf(address account) external view returns (uint256);
}

contract MyContract {
    // Precompile address for a specific TokenFactory token
    address constant TOKEN_PRECOMPILE = 0x0000000000000000000000000000000000000801;
    
    function transferToken(address to, uint256 amount) external {
        ITokenFactoryERC20(TOKEN_PRECOMPILE).transfer(to, amount);
    }
}
```

## Comparison

| Feature | Method 1: EVM Contract | Method 2: TokenFactory |
| - | - | - |
| Development Experience | Standard EVM | Cosmos SDK + EVM |
| Compliance Features | Limited | Full protocol support |
| Cosmos Integration | Optional mapping | Native integration |
| Recommended For | External developers | MANTRA internal tokens |
| Setup Complexity | Low | Medium |
| Tooling | Standard EVM tools | Cosmos SDK + EVM |

## Next Steps

* Learn about [address derivation](https://mantrachain.mintlify.site/developers/architecture/address-derivation.md)
* Understand [transaction sequencing](https://mantrachain.mintlify.site/developers/architecture/transaction-sequencing.md)
* Get started with [EVM development](https://mantrachain.mintlify.site/developers/evm/getting-started.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.