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

# Deploying ERC-20 Token

> Deploy an ERC-20 token on the agung testnet using Remix and MetaMask. Set the token name, symbol, and supply, then verify deployment.

This guide shows how to deploy an ERC-20 token contract on agung using Remix, a browser-based Solidity IDE. You start from a boilerplate ERC-20 contract and set:

* `Token Name`
* `Symbol`
* `Total Supply`

By the end you will have an ERC-20 token deployed on the agung testnet.

## Prerequisites

* Basic understanding of blockchain and ERC-20 tokens.
* MetaMask installed, with the agung network added.
* Familiarity with [Remix IDE](https://remix.ethereum.org/).
* A wallet funded with AGUNG tokens for gas fees.

## Instructions

### 1. Open Remix IDE

* Open Remix and create a new workspace.
* In **File explorer**, create a new file.
* Name it `MyERC20Token.sol`.
  <img src="https://mintcdn.com/peaq/bfUMfJGiNN2sOYvn/assets/img/erc-20-1.png?fit=max&auto=format&n=bfUMfJGiNN2sOYvn&q=85&s=07df7e96d250f7dfb31d1b634161f437" alt="erc-20-1" width="2554" height="1381" data-path="assets/img/erc-20-1.png" />

### 2. ERC-20 Code

Paste this boilerplate ERC-20 contract into the file. It uses the OpenZeppelin ERC-20 implementation:

```solidity theme={"theme":{"light":"github-light-default","dark":"github-dark"}}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

// Import OpenZeppelin's ERC-20 implementation
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 { // Here we are declaring the contract & inheriting ERC20
    constructor(uint256 initialSupply) ERC20("MyToken", "MTK") { 
        _mint(msg.sender, initialSupply * (10 ** uint256(decimals())));
    }
}
```

### 3. Modify Token Details

Update the placeholders in the code:

* **Token name**: replace `"MyToken"` with your token's name, for example `"ExampleToken"`.
* **Symbol**: replace `"MTK"` with a short symbol, for example `"EXT"`.
* **Total supply**: `initialSupply` is a constructor argument you pass at deployment. For a supply of 1,000,000 tokens with 18 decimals, enter `1000000` in step 5.
  <img src="https://mintcdn.com/peaq/bfUMfJGiNN2sOYvn/assets/img/erc-20-2.png?fit=max&auto=format&n=bfUMfJGiNN2sOYvn&q=85&s=72505b08ccb1ee55daf85c420f265a15" alt="erc-20-2" width="2554" height="1372" data-path="assets/img/erc-20-2.png" />

### 4. Compile the Contract

In the **Solidity Compiler** tab:

* Select a compiler version that matches the pragma, for example `0.8.20+commit.a1b79de6`.
* Click **Compile MyERC20Token.sol**.
* Check that there are no errors.
  <img src="https://mintcdn.com/peaq/bfUMfJGiNN2sOYvn/assets/img/erc-20-3.png?fit=max&auto=format&n=bfUMfJGiNN2sOYvn&q=85&s=35461693d922d910c566fb47cfb2df66" alt="erc-20-3" width="535" height="1341" data-path="assets/img/erc-20-3.png" />

### 5. Deploy the Contract

* Go to the **Deploy & Run Transactions** tab in Remix.
* Set the environment to **Browser Extension** and pick MetaMask.
* Select your agung account in MetaMask.
* In the constructor field, enter the total supply, for example `1000000`.
* Click **Deploy** and confirm the transaction in MetaMask.
  <img src="https://mintcdn.com/peaq/bfUMfJGiNN2sOYvn/assets/img/erc-20-4.png?fit=max&auto=format&n=bfUMfJGiNN2sOYvn&q=85&s=eea66650483bc8c04d20163c25a79f37" alt="erc-20-4" width="519" height="967" data-path="assets/img/erc-20-4.png" />

### 6. Verify Deployment

<img src="https://mintcdn.com/peaq/bfUMfJGiNN2sOYvn/assets/img/erc-20-5.png?fit=max&auto=format&n=bfUMfJGiNN2sOYvn&q=85&s=344094a2786eb6b102e0b9368f5e602a" alt="erc-20-5" width="2026" height="279" data-path="assets/img/erc-20-5.png" />

The Remix console logs the deployment transaction for `MyERC20Token.sol` on agung.

* After deployment, the contract appears under **Deployed Contracts** in Remix.
* Call the read functions (blue) to check `name()`, `symbol()` and `totalSupply()`.
* Call `balanceOf()` with your wallet address to check your token balance.
  <img src="https://mintcdn.com/peaq/bfUMfJGiNN2sOYvn/assets/img/erc-20-6.png?fit=max&auto=format&n=bfUMfJGiNN2sOYvn&q=85&s=2cfa06c301c2a14e7739f4bc4865186b" alt="erc-20-6" width="565" height="1027" data-path="assets/img/erc-20-6.png" />

## Summary

Your ERC-20 token is deployed on agung. You can look the contract up on [Subscan](https://agung-testnet.subscan.io/) and keep interacting with it from Remix. From here you can extend the contract with minting, burning or access control.


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