ERC777 constructor arguments

I’m trying to deploy zeppelin’s implementation of ERC777 just as an example. I understand the constructor takes three arguments: name, symbol and an array of addresses (default operators), hence the following 2_another_migrate.js code in truffle:

var MyContract = artifacts.require("./ERC777.sol");
var defaultOperators = ["0xEe545e6239a7e0d42095872956DdC981f028da60","0x3e576F19520215637569c6aCB0740723326d1375", "0x569bd2696200ce347f72cE586B6d355C28E5aAf4"];

module.exports = function(deployer) {
deployer.deploy(MyContract, "TestToken", "TTN", defaultOperators);

BUT, when I to run the migration the console says:

“ERC777” hit a require or revert statement somewhere in its constructor. Try:

  • Verifying that your constructor params satisfy all require conditions.
  • Adding reason strings to your require statements.

So what exactly should I pass as a third argument? My goal is to eventually deploy it to a test network and interact with it via MEW… any other thing I might be missing here? Thank you

Hi @Bleier, I deployed a simple ERC777 to Rinkeby testnet with a similar deploy script to yours using Truffle.

In a testing environment an ERC777 requires deploying an ERC1820 registry using openzeppelin-test-helpers. See the test suite:

Smart contract:

pragma solidity ^0.5.0;

import "openzeppelin-solidity/contracts/token/ERC777/ERC777.sol";

contract ABC777 is ERC777 {
        string memory name,
        string memory symbol,
        address[] memory defaultOperators
    ) public ERC777(name, symbol, defaultOperators) {
        _mint(msg.sender, msg.sender, 10000 * 10 ** 18, "", "");


var MyContract = artifacts.require("ABC777");
var defaultOperators = [

module.exports = function(deployer) {
    deployer.deploy(MyContract, "ABC 777 Token", "ABC", defaultOperators);

Deployed contract:

Etherscan: 0x8312703dd4296D5c98Ab885e6E5BA12147aC168C
OneClickDapp: ABC777 (to interact with the contract)


Thanks so much! I was missing the contract itself hehe

1 Like

For the record, when testing against a development network like ganache or geth --dev you need to use openzeppelin-test-helpers as shown below.

const { singletons } = require('openzeppelin-test-helpers');

contract('ERC777', function (accounts) {
  before(async function () {
    const funder = accounts[0]; // account that will be used to fund the deployment
    await singletons.ERC1820Registry(funder);

  it(...your test here...);
1 Like

Yup, I realized my problem was not the constructor but the deployment of the ERC12820Registry. I followed the instructions you gave to CrazyRabbitLTC a couple of days ago. but truffle “Cannot find module ‘openzeppelin-test-helpers/configure’”

This is the deploy code I wrote after going over that issue:

var ERC777 = artifacts.require("TTN777");

require('openzeppelin-test-helpers/configure')({ web3 });

const { singletons } = require('openzeppelin-test-helpers');

const name = "TestToken777";
const symbol = "TTN";
const defaultOperators = [];

module.exports = async function(deployer, network, accounts) {
  const erc1820 = await singletons.ERC1820Registry(accounts[0]);
  deployer.deploy(ERC777, name, symbol, defaultOperators);
1 Like

Configure is still unreleased! :slightly_smiling_face: You can try it for now by installing the latest code from GitHub directly: npm install github:OpenZeppelin/openzeppelin-test-helpers. The feature will be released on npm likely next week.

Check out the changelog in case there are any breaking changes you need to adapt to.


Ty! so I did try
npm install github:OpenZeppelin/openzeppelin-test-helpers
but npm throws a ELIFECYCLE error…

npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the scrypt@6.0.3 install script.

Maybe this has been a problem with my node version all along?

node -v v12.2.9
node-gyp -v v3.8.0

running npm install openzeppelin-test-helpers does start the installation, but fails with the same error… :frowning:

@abcoathup what node/truffle version did you use to deploy your 777, if I may ask? And thanks guys for your time

1 Like

I am running:
Truffle v5.0.17
Node v11.9.0
npm 6.9.0

On Windows using Windows Subsystem for Linux.

Potentially an issue with your node/node-gyp setup.

1 Like

Thanks mate, I believe it is indeed a problem with node… I will roll back to v11.9 and see if that works.
Is your project open sourced by the way? :sweat_smile:

1 Like

@Bleier Let us know how you get on with node.

My sample project is pretty much just the smart contract and deploy above. Happy to share.

Yeah I completely uninstalled and reinstalled node following these instructions. I’m gonna try with different versions starting next week :slight_smile:

1 Like

Hopefully with a clean start for node you should be fine. I have definitely been there before.

Let us know if you have any issues.

We’ve just released v0.4.0 with this change, so there’s no need to install from GitHub anymore :slight_smile: Simply run npm install openzeppelin-test-helpers


Just did that and oh it felt so good

+ openzeppelin-test-helpers@0.4.0 added 11 packages and updated 4 packages in 52.933s

BUT truffle migrate throws an error anyways:

Error: Error: Cannot find module 'openzeppelin-test-helpers'

It looks like it was properly installed though…


So yes, it was a problem with node. It stopped throwing a bunch of errors after rolling back to version 10.0.0. Now it only throws one error lol (see above)


Hi @Bleier is your code open source so I can have a look?

I have a simple ERC777 token example using the OpenZeppelin implementation on GitHub which I have deployed to ganache-cli, Ropsten and Rinkeby.

1 Like

This is mine, I just uploaded it now:
The readme contains everything I did to replicate the bug… I’ll check yours out and see if I can decypher what went wrong. Thanks a bunch! :slight_smile:

1 Like

Hi @Bleier

You didn’t have a package.json in GitHub. I assume you have one, if you haven’t, run npm init and then install any packages you need.

Appears there are three issues;

  1. openzeppelin-test-helpers has a dependency on chai so run an npm install --save-dev chai

  2. module.exports = async function(deployer, accounts) { should be module.exports = async function(deployer, network, accounts) {

  1. Need to add an await to the deploy await deployer.deploy(ERC777, name, symbol, defaultOperators);

As an aside, for deploying to ganache-cli I uncommented in truffle-config.js the development network

    development: {
     host: "",     // Localhost (default: none)
     port: 8545,            // Standard Ethereum port (default: none)
     network_id: "*",       // Any network (default: none)

Once the above is done truffle migrate deploys your 777 token.

1 Like