Deploy a simple ERC20 token in Remix

I have been using Remix for really quick contracts rather than spinning up an OpenZeppelin SDK project or a Truffle project (both of which are still pretty quick to do).

Remix supports importing via GitHub. See the documentation for details:
https://remix-ide.readthedocs.io/en/latest/import.html

This makes it easy to import OpenZeppelin Contracts.

:warning: Note: You should only use code published in an official release of OpenZeppelin Contracts, the latest release is 3.1. When importing via GitHub on Remix you can specify the release tag, (otherwise you will get the latest code in the master branch). The example below imports v3.1.0.

An example ERC20 token:

Token.sol

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

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/token/ERC20/ERC20.sol";

contract Token is ERC20 {

    constructor () public ERC20("Token", "TKN") {
        _mint(msg.sender, 1000000 * (10 ** uint256(decimals())));
    }
}
5 Likes

2 posts were split to a new topic: Issue deploying ERC20 token to Ropsten using Remix

A post was split to a new topic: Import OpenZeppelin Contracts from GitHub in Remix?

We can Create an ERC20 using Remix, without writing Solidity

4 posts were split to a new topic: How to verify simple ERC20 deployed via Remix on Etherscan?