Request example of creating an ERC777 token using Remix

Hi @Rahaman,

:warning: The following example has not been tested nor audited. Smart contracts should be appropriately tested and audited before being used in production.

Public testnets already have the ERC1820 Registry deployed so we don’t need to deploy this ourselves when deploying our token to a public testnet.

To import OpenZeppelin Contracts via GitHub with Remix we need to follow the Remix documentation: https://remix-ide.readthedocs.io/en/latest/import.html#importing-from-github

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

Simple777Token.sol

pragma solidity ^0.6.2;

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

/**
 * @title Simple777Token
 * @dev Very simple ERC777 Token example, where all tokens are pre-assigned to the creator.
 * Note they can later distribute these tokens as they wish using `transfer` and other
 * `ERC20` or `ERC777` functions.
 * Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v2.5.1/contracts/examples/SimpleToken.sol
 */
contract Simple777Token is ERC777 {

    /**
     * @dev Constructor that gives msg.sender all of existing tokens.
     */
    constructor () public ERC777("Simple777Token", "S7", new address[](0)) {
        _mint(msg.sender, 10000 * 10 ** 18, "", "");
    }
}

Deployed on Ropsten: https://ropsten.etherscan.io/address/0xecd7ccc03273b6b1201e8c81c0c749a12bdd86a1

I verified using the following method: Verifying a contract inheriting from OpenZeppelin Contracts

The verified code on Ropsten: https://ropsten.etherscan.io/address/0xecd7ccc03273b6b1201e8c81c0c749a12bdd86a1#code

1 Like