Thanks so much! I was missing the contract itself hehe
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...);
});
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);
};
Configure is still unreleased! 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…
@abcoathup what node/truffle version did you use to deploy your 777, if I may ask? And thanks guys for your time
@Bleier
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.
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?
@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
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 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)
I have a simple ERC777 token example using the OpenZeppelin implementation on GitHub which I have deployed to ganache-cli, Ropsten and Rinkeby.
This is mine, I just uploaded it now: https://github.com/alanbleier182/777/tree/master
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!
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;
-
openzeppelin-test-helpers
has a dependency onchai
so run annpm install --save-dev chai
-
module.exports = async function(deployer, accounts) {
should bemodule.exports = async function(deployer, network, accounts) {
- 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: "127.0.0.1", // 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.
Hi,
Here is an example to deploy the ERC1820 registry, using the openzeppelin-test-helpers.
This example deals with multiple migrate --reset
inside the truffle console
.
Please note that the second step of migration, is for loading the openzeppelin-test-helpers
.
There we try to configure it, but if is already configured, an exception is thrown and it is catch.
Then we deploy the ERC1820Registry.
The third step of migration is for deploying the ERC777.
Enjoy!
Hi @sebasgoldberg,
Welcome to the community
I wrote a Simple ERC777 example: Simple ERC777 token example
Thanks for sharing. I hardcoded the check for a development network to deploy the ERC1820Registry, which is less useful when deploying to a private network.
2 posts were split to a new topic: Converting ERC20 to ERC777 and errors with: Cannot find module ‘@openzeppelin/test-helpers’