🟒Build on Ave Chain

Here’s a step-by-step guide to using Remix Ethereum to create, compile, and deploy a basic ERC-20 smart contract on the Avenium Blockchain.

Steps to Use Remix Ethereum

1. Open Remix Ethereum

  1. Visit the Remix Ethereum website.

  2. Create a new file by clicking on the folder icon on the left side, then click the "+" (New File) button and name the file, for example, AveToken.sol.

2. Write the Smart Contract

Copy and paste the following code into your new file:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Import the OpenZeppelin ERC-20 implementation
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

// Define the contract
contract AveToken is ERC20, Ownable {
    // Constructor to initialize the token
    constructor() ERC20("Ave Token", "AVE") {
        // Mint initial supply to the contract deployer
        _mint(msg.sender, 1000000 * 10 ** decimals());
    }

    // Function to mint new tokens, restricted to the contract owner
    function mint(address to, uint256 amount) external onlyOwner {
        _mint(to, amount);
    }

    // Function to burn tokens, restricted to the contract owner
    function burn(address from, uint256 amount) external onlyOwner {
        _burn(from, amount);
    }
}

3. Compile the Smart Contract

  1. Click on the "Solidity Compiler" tab on the left sidebar.

  2. Select the appropriate compiler version (e.g., 0.8.0 or higher) that matches the pragma version specified in the contract.

  3. Click the "Compile AveToken.sol" button.

4. Deploy the Smart Contract

  1. Click on the "Deploy & Run Transactions" tab on the left sidebar.

  2. In the "Environment" dropdown, select "Injected Web3". This will connect Remix to MetaMask.

  3. Make sure your MetaMask is connected to the Avenium testnet. You can add the Avenium testnet to MetaMask with the following details:

    • Network Name: Ave Chain Testnet

    • New RPC URL: https://connect-testnet.avenium.io

    • Chain ID: 8886

    • Currency Symbol: tAVE

    • Block Explorer URL: https://testnet.avescan.net

  4. Click "Deploy" and confirm the transaction in MetaMask.

5. Interact with the Deployed Contract

  1. After deploying, the contract instance will appear in the "Deployed Contracts" section.

  2. You can interact with the contract functions (such as mint and burn) directly from the Remix interface.

  3. For example, to mint new tokens:

    • Enter the recipient's address and the amount of tokens to mint in the mint function fields.

    • Click the transact button next to the mint function and confirm the transaction in MetaMask.

Additional Notes

  • Security: Always make sure to audit your smart contract code or have it audited by professionals before deploying on the mainnet.

  • Testing: It's a good practice to test your contract thoroughly on a testnet before deploying it on the mainnet.

Using Remix Ethereum is a straightforward way to write, compile, and deploy smart contracts on the Avenium Blockchain. This guide covered creating a basic ERC-20 token contract, compiling it, and deploying it using MetaMask connected to the Avenium testnet. By following these steps, you can develop and deploy your own smart contracts efficiently.

Last updated