question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Deployment of ERC777 with Truffle Migrations doesn't work.

See original GitHub issue

A requirement to deploy ERC777 requires a local instance of ERC1820 to be deployed, which does not exist on a local Test network.

There are several issues here: 1: ERC777 fails to deploy, but does not communicate to the user the reason why it failed. No revert/require statements fail with a description why. It is not communicated with the user that the lack of an ERC1820 contract is the problem.

2: Deployment of ERC1820 via the OpenZeppelin-test-helpers in migrations does not work as Truffle Migrations does not seem to be able to properly require in openzeppelin-test-helpers

Because of this, it is unclear of the best way to deploy ERC777 using truffle migrations. Perhaps an external ‘setup script’ needs to be created.

💻 Environment Mac OSX Mojave, zsh terminal

OpenZeppelin: openzeppelin-solidity@next (Next at time of this issue filing) Truffle v5.0.13

📝 Details

Solidity code:

pragma solidity >=0.4.21 <0.6.0;

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

contract My777Token is ERC777 {
    constructor(string memory name, string memory symbol, address[] memory defaultOperators)
    ERC777(name, symbol, defaultOperators) public {
    }

}

Migrations code:


const My777Token = artifacts.require("My777Token");
const { singletons } = require('openzeppelin-test-helpers');


const name = "LuckyToken";
const symbol = "LT";
const defaultOperators = [];

module.exports = async function(deployer, accounts) {
    let accounts = await web3.eth.getAccounts();
    const erc1820 = await singletons.ERC1820Registry(accounts[0]);
    
  deployer.deploy(My777Token, name, symbol, defaultOperators);
};

🔢 Code to reproduce bug

The example above will not deploy an ERC777 token, it is unclear how to deploy a ERC777 in a standard method using Truffle Migrations.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
frangiocommented, May 11, 2019

@crazyrabbitLTC I think you have a bug in your migrations code though.

The function you export in the migration receives three arguments and accounts is the third one. At least in truffle@5.0.13.

const ERC777 = artifacts.require('ERC777');

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

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

const name = "LuckyToken";
const symbol = "LT";
const defaultOperators = [];

module.exports = async function(deployer, network, accounts) {
  const erc1820 = await singletons.ERC1820Registry(accounts[0]);

  deployer.deploy(ERC777, name, symbol, defaultOperators);
};
1reaction
frangiocommented, May 11, 2019

Yes it was intentional but we just merged the PR so I deleted the branch and forgot to update this comment. Sorry! Updated the comment above now.

npm install github:OpenZeppelin/openzeppelin-test-helpers

Let me know if you have any other issues!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deployment of ERC777 with Truffle Migrations doesn't work.
A requirement to deploy ERC777 requires a local instance of ERC1820 to be deployed, which does not exist on a local Test network....
Read more >
ERC777 Migration with Truffle doesn't work - Contracts
Hi team, I'm a begginer in smart contracts programming and I'm having trouble deploying my ERC777 contract following the SimpleERC777 ...
Read more >
Deployment of ERC777 with Truffle Migrations doesn't work.
A requirement to deploy ERC777 requires a local instance of ERC1820 to be deployed, which does not exist on a local Test network....
Read more >
erc 777 - Truffle cannot pass array of addresses as constructor ...
ERC777 can be deployed to a local Ethereum now. previously I forgot to deploy ERC1820 first. if (network === 'development') { await ...
Read more >
Migrating contract with truffle gives me transaction revert
I find the problem. The ERC777 contract from open zeppelin has an hardcoded memeber _ERC1820_REGISTRY ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found