Deployment of ERC777 with Truffle Migrations doesn't work.
See original GitHub issueA 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:
- Created 4 years ago
- Comments:5 (5 by maintainers)
@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 intruffle@5.0.13
.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.
Let me know if you have any other issues!