Error on deploy of ERC777 on Hardhat

Hi everybody,
I'm new in openzeppellin. I was trying to deploy an ERC777 upgradable contract with hardhat (following the guide) but I get an error

  • TypeError: Cannot read property 'readFile' of undefined
    at readValidations (.../node_modules/@openzeppelin/hardhat-upgrades/src/validations.ts:34:38)
    at OverriddenTaskDefinition.config_1.subtask [as _action] (.../node_modules/@openzeppelin/hardhat-upgrades/src/index.ts:34:11)

Any help will be appreciated.

:computer: Environment
Version used:

"devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.1",
    "@openzeppelin/hardhat-upgrades": "^1.6.0",
    "ethers": "^5.0.29",
    "hardhat": "^2.0.8"
  },
"dependencies": {
   "@openzeppelin/contracts-upgradeable": "^3.4.0
 }

:memo:Details
This is my hardhat.config.js

require('@openzeppelin/hardhat-upgrades');
require('@nomiclabs/hardhat-ethers');
module.exports = {
   solidity: "0.7.3",
};

This is my scripts/deploy.js

const { ethers, upgrades } = require("hardhat");
async function main() {
  // We get the contract to deploy
  const Token = await ethers.getContractFactory("IARS");
  console.log("Deploying IARS...");
  const token = await upgrades.deployProxy(Token);
  await token.deployed();
  console.log("IARS deployed to:", token.address);
}

:1234: Code to reproduce

npx hardhat run --network localhost scripts/deploy.js

1 Like

Hi @Pablo_Paganini,

If you haven’t already I recommend deploying a simple contract (e.g. Box from https://docs.openzeppelin.com/learn/upgrading-smart-contracts) to start with to check that your configuration is ok.

When deploying ERC777 to a non-public network you also need to deploy an ERC1820 registry. You can do this using OpenZeppelin Test Helpers: https://docs.openzeppelin.com/test-helpers/0.5/api#erc1820registry
Test Helpers uses web3, I am not sure if there is an easy ethers way to do this.

Hi @abcoathup
Thanks for your reply.
The problem was my node version. I was using version 10 and version 12 or later is needed
Regards.

1 Like

You need to update your node js as well as do something as