How to deploy ERC777 using OpenZeppelin CLI?

Hi @gabo,

I was able to deploy GLDToken (as a regular contract) to ganache after deploying ERC1820 registry using a simple script.

Please note, if you want to create an upgradeable contract then you would need to use OpenZeppelin Contracts Ethereum Package which is upgrade safe. You could also use OpenZeppelin Upgrades Plugins to deploy upgradeable contracts: https://docs.openzeppelin.com/upgrades-plugins/1.x/

index.js

// src/index.js
const Web3 = require('web3');
const web3 = new Web3('http://localhost:8545');
require('@openzeppelin/test-helpers/configure')({ provider: web3.currentProvider });

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

async function main() {
  // Retrieve accounts from the local node
  const accounts = await web3.eth.getAccounts();

  await singletons.ERC1820Registry(accounts[0]);
}

main();

Deploy ERC1820 registry

$ node src/index.js

Deploy GLDToken

$ npx oz deploy
Nothing to compile, all contracts are up to date.
? Choose the kind of deployment regular
? Pick a network development
? Pick a contract to deploy GLDToken
? initialSupply: uint256: 100000000000000000000
? defaultOperators: address[]:
✓ Deployed instance of GLDToken
0xCfEB869F69431e42cdB54A4F4f105C19C080A601

Interact

$ npx oz call
? Pick a network development
? Pick an instance GLDToken at 0xCfEB869F69431e42cdB54A4F4f105C19C080A601
? Select which function name()
✓ Method 'name()' returned: Gold
Gold
1 Like