# Deploy Smart Contracts with Remix

In this tutorial, we’ll walk you through **creating and deploying a basic ERC-20 token dApp** on the HeLa testnet using **Remix IDE,** which is an open source web and desktop application that provides a fast development cycle with intuitive GUIs and a rich set of plugins.&#x20;

### **Prerequisites**

Before we start, let’s make sure you’ve got the right setup:

1. **Browser**: Chrome, Brave, or Firefox (latest versions work best).
2. **Wallet** :&#x20;

   [MetaMask installed.](/wallet/metamask.md)

   * Add the HeLa [testnet RPC](/network-endpoints-and-explorer/network-endpoints-and-explorer.md) (details will be shared by the chain team).
   * Fund your wallet with testnet tokens ([faucet link](/network-endpoints-and-explorer/images-and-media.md)).
3. **Remix IDE**: No install required. Just open Remix in your browser. \
   Visit [https://remix.ethereum.org](https://remix.ethereum.org/)

### **Step 1: Create ERC-20 Token Contract**

1. In the file explorer, create a new file under the `contracts` folder named `MyToken.sol`
2. Copy and paste the following ERC-20 token contract code:

```jsx
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

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

/// @title MyToken - A basic ERC20 Token on HeLa Chain
/// @custom:dev-run-script ./scripts/deploy.js

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("MyFirstHeLaToken", "HLT") {
       _mint(msg.sender, initialSupply * 10 ** decimals());
    }
}

```

**Customizing Your Token**

You can customize your token by changing:

* `"MyFirstHelaToken"` - The token name
* `"HLT"` - The token symbol (appears in MetaMask, max 5 characters)
* `5000` - The initial token supply minted to your wallet \</aside>

### Step 2: Adding a Deploy Script

Remix uses **NatSpec annotations** to link contracts with scripts.

1. In Remix’s File Explorer, create a folder: `scripts/`.
2. Create `deploy.js` inside it.
3. Paste this code:

```jsx
// scripts/deploy.js
async function main() {
    // Get the signer (the deployer wallet from Remix environment)
    const [deployer] = await ethers.getSigners();

    console.log("Deploying contracts with account:", deployer.address);

    // Compile + get contract factory
    const Token = await ethers.getContractFactory("MyToken");

    // Deploy contract
    const token = await Token.deploy();
    await token.deployed();

    console.log("MyToken deployed to:", token.address);
}

// Run the script with error handling
main()
    .then(() => process.exit(0))
    .catch((error) => {
        console.error(error);
        process.exit(1);
    });
```

### **Step 3: Compile the Contract**

Before deploying, we’ll make one important tweak to avoid compilation errors.

1. Go to the **Solidity Compiler** tab in the left sidebar
2. Expand **Advanced Configurations**.

   * Under **EVM Version**, select **Homestead** (this ensures smooth compatibility with HeLa’s runtime).

   **Your settings should look like this:**

<figure><img src="/files/BRXkKJkczGXutefI2Roo" alt=""><figcaption></figcaption></figure>

3. Now click **Compile**.
4. If the compilation succeeds, you’ll see a green check.

### **Step 4: Deploy to HeLa**

1. Navigate to the **Deploy & Run Transactions** tab
2. In the **Environment** dropdown, select **Browser** **Extension** > **Injected Provider - MetaMask**

> **Network Detection**
>
> If Injected Provider cannot detect the network, refresh the Remix IDE page and switch between networks in MetaMask.

3. Select your **MyToken** contract from the dropdown
4. Enter an initial supply (e.g., `100000`)
5. Click **Deploy** to deploy your ERC-20 token contract
6. Confirm the deployment transaction in MetaMask

<figure><img src="/files/feIqOVceWVbTsSKPtjLZ" alt=""><figcaption></figcaption></figure>

### **Step 5: Get Contract Address**

1. After successful deployment, copy the **Contract Address** from Remix, from the terminal.

### **Step 6: Verify on Block Explorer**

1. In MetaMask, click on the transaction and select [**View on block explorer**](https://testnet-blockexplorer.helachain.com/)
2. Verify that the ERC-20 token transfer is displayed correctly on the explorer

### **Step 7: Import Token to MetaMask**

1. In MetaMask, go to **Tokens** tab and click **Import Tokens.**

<figure><img src="/files/hAirbVQExRqxfzCmO242" alt=""><figcaption></figcaption></figure>

2. Paste the contract address from Remix into the **Token Contract Address** field
3. The token information should auto-populate (Token Symbol and Decimals)
4. Click **Add Custom Token** and then **Import Tokens**

### **Step 8: Verify Token Balance**

1. Check your **Tokens** tab in MetaMask to see your newly minted tokens
2. You should see 100000 tokens (or your custom amount) in your wallet

### **Step 9: Transfer Tokens**

1. Select your token in MetaMask and click **Send**
2. Enter the recipient address and amount
3. Click **Next** and confirm the transaction
4. Wait for the transaction to be confirmed

> **Testing Tips**
>
> * Test token transfers between different MetaMask accounts
> * Verify all transactions appear correctly on the block explorer
> * If you encounter issues, try resetting MetaMask via settings

### **Troubleshooting**

If you encounter issues:

* **Network not detected**: Refresh Remix and switch networks in MetaMask
* **Transaction fails**: Ensure you have sufficient HLUSD for gas fees
* **Token not appearing**: Double-check the contract address when importing
* **MetaMask issues**: Reset MetaMask via settings if problems persist

## Support :&#x20;

If you encounter any issues during setup or require assistance, please join the [**HeLa Developer Community**](https://discord.gg/NEBtTztJCj) for direct support and guidance.<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.helalabs.com/build-on-hela/build-on-testnet/deploy-smart-contracts-with-remix.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
