Deploying a Smart Contract on the Autheo Blockchain
This document will guide you through launching an ERC20 token on the Autheo blockchain. This tutorial uses MetaMask wallet, OpenZeppelin and Remix IDE.
Connecting to the Autheo Network with MetaMask
Indepth information on connecting MetaMask to a custom RPC can be found on the MetaMask Support Site.
-
Click on the Network Selector Button in the upper left of the application's main window.
-
Click Add network.
-
Enter the following information for the Autheo blockchain:
-
Network name: Autheo
-
New RPC URL: TBD
-
Chain ID: TBD
-
Currency symbol: THEO
-
Click Save
-
Click on the Network Selector Button once more, you should now see the Autheo blockchain.
Creating an ERC20 Token Contract with OpenZeppelin
OpenZeppelin provides a variety of premade templates for use with EVM-compatible blockchains. In this instance, we will use their ERC20 wizard to deploy a custom token on the Autheo blockchain.
The left side of your screen will show a variety of pre-built options that are compatible with the ERC20 standard. You will want to update the Name, Symbol and Premint number of tokens. For our example, we will not alter any other options. Further information on these options can be found here.
Changes made to the name, symbol and premint tokens option will reflect within the code in the main window on the right of your screen. This code can be copied over to the Remix IDE in the next step.
Deploying your ERC20 Token with Remix IDE
From Remix, use the following steps:
-
Create a new file.
In the File Explorer window on the left of your screen, choose the Create new file option beneath the default_workspace header. The icon is a picture of a single page with the corner folded.
-
Name your new file, using the
.sol
file type.You can use any name for the contract file, as long as it ends in
.sol
. For example,ERC20Contract.sol
. -
Copy your OpenZeppelin code into the file.
After selecting your new file, you can copy your example contract code into the main working window in the center of your screen. The following expandable section contains a basic example from OpenZeppelin for a token called
Example CodeAutheoTest
with the symbolTST
and 10,000 preminted tokens.Example ERC20 Contract Code
// SPDX-License-Identifier: MIT
// Compatible with OpenZeppelin Contracts ^5.0.0
pragma solidity ^0.8.20;import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";contract AutheoTest is ERC20, Ownable, ERC20Permit {
constructor(address initialOwner)
ERC20("AutheoTest", "TST")
Ownable(initialOwner)
ERC20Permit("AutheoTest")
{
_mint(msg.sender, 10000 * 10 ** decimals());
}function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}
Compile your contract.
Click on the
Solidity Compiler
icon on the left sidebar, which appears as two opposite arrows pointing to the upper left and lower right. In this window, you will seeCompile filename.sol
. In the example instance,ERC20Contract.sol
.-
Choose EVM version
paris
.In the Advanced Configuration settings under the
Solidity Compiler
, choose theparis
version of EVM in the EVM Version dropdown menu. -
Connect your MetaMask Account to Remix.
Choose
Deploy & Run Transaction
from the left sidebar, directly under theSolidity Compiler
.You will see Environment at the top of this window, where you can choose Injected Provider - MetaMask. Assuming your MetaMask is properly configured for the Autheo network, this will allow you to deploy directly from Remix.
-
Verify information and deploy your ERC20 contract.
Verify that your account and contract value are correct, and then click
Deploy
to deploy your ERC20 token on the Autheo blockchain.