Remix Smart Contract Tutorial ERC20
Prerequisites: MetaMask Wallet
Set Up MetaMask
- Download MetaMask here if you don't already have it installed.
Note Make a dev wallet for development purposes. This will reduce risk in short and long term.
Step 1: Set up Network configuration
You can setup Telos Mainnet or Testnet at Chainlist or Teloscan (testnet) by clicking "Connect Wallet". The network settings in Metamask can be added manually as seen here:
Telos Mainnet Settings:
- Network Name: Telos Mainnet
- New RPC URL: https://mainnet.telos.net/evm
- ChainID:
40
- Symbol:
TLOS
- Explorer: https://teloscan.io
Telos Testnet Settings:
- Network Name: Telos Testnet
- New RPC URL: https://testnet.telos.net/evm
- ChainID:
41
- Symbol:
TLOS
- Explorer: https://testnet.teloscan.io
Telos Websockets:
- Testnet : wss://testnet.telos.net/evm
- Mainnet: wss://mainnet.telos.net/evm
Step 2: Funding your Telos Testnet Account address
Using Test Network Faucet
You can use the Test Network Faucet to acquire funds for the test network Go to Testnet Faucet
Paste your address from Metamask in the space above the SEND TESTNET EVM TLOS button. Once completed, you will receive testnet funds to work with and write data to the blockchain.
Step 3: Connect MetaMask and deploy a smart contract using Remix
Open Remix
Load or create the smart contracts you want to compile and deploy using Remix file explorer. Click the contracts tab and create a file named MyEpicToken.sol.
For this example, we will deploy this ERC20 contract from Open Zeppelin
Copy and Paste the smart contract from Open Zeppelin under the contracts folder into MyEpicToken.sol file.
Change network to Web3Injected to integrate Telos Testnet Through MetaMask Click on Ethereum Deploy Logo on the side
Then MetaMask will pop up, Click Next & allow the wallet to connect to Remix
- The next step is to compile the contract into byte code so the Telos EVM can read the state changes being made from our Solidity program. Note the compile version at the top. Always match it to the compiler you program. It will declare with Pragma. Once complete, the byte code will be ready to compile.
- Time for Deployment.
- Click on the contract you have created called GLD Token that inherits the ERC20 standards
- Under Deploy, insert initial supply that will be passed to the constructor
- Transact
- Call data from the blockchain to test view methods from ERC20 contract inherited. View the contract address where ERC20 is located.