OpenZeppelin / openzeppelin-upgrades

Plugins for Hardhat and Foundry to deploy and manage upgradeable contracts on Ethereum.
MIT License
629 stars 268 forks source link

upgrades.deployProxy error #890

Closed RayLvv closed 1 year ago

RayLvv commented 1 year ago

Here occurs an error when I call upgrades.deployProxy function:

const { ethers, upgrades} = require('hardhat');
const CONTRACT = await ethers.getContractFactory("CONTRACT");
const contract = await upgrades.deployProxy(
        CONTRACT,
        ["0x123"],
        { initializer: 'initialize' }
    );

Following error occured:

Error: invalid format type (argument="format", value=true, code=INVALID_ARGUMENT, version=abi/5.7.0)
    at Logger.makeError (/Project/$project/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
    at Logger.throwError (/Project/$project/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
    at Logger.throwArgumentError (/Project/$project/node_modules/@ethersproject/logger/src.ts/index.ts:285:21)
    at ConstructorFragment.format (/Project/$project/node_modules/@ethersproject/abi/src.ts/fragments.ts:720:20)
    at /Project/$project/node_modules/@ethersproject/abi/src.ts/interface.ts:165:63
    at Array.map (<anonymous>)
    at Interface.format (/Project/$project/node_modules/@ethersproject/abi/src.ts/interface.ts:165:36)
    at /Project/$project/node_modules/@openzeppelin/hardhat-upgrades/src/utils/deploy-impl.ts:113:41
    at resumeOrDeploy (/Project/$project/node_modules/@openzeppelin/upgrades-core/src/deployment.ts:76:30)
    at /Project/$project/node_modules/@openzeppelin/upgrades-core/src/impl-store.ts:63:23 {
  reason: 'invalid format type',
  code: 'INVALID_ARGUMENT',
  argument: 'format',
  value: true
}
RayLvv commented 1 year ago

Maybe that's because ethers compatibility problem, I'm using following package:

  "dependencies": {
    "@aragon/osx": "^1.3.0-rc0.3",
    "@aragon/osx-ethers": "^1.3.0-rc0.3",
    "@aragon/sdk-client": "^1.14.0",
    "@aragon/sdk-client-common": "^1.6.0",
    "@nomicfoundation/hardhat-chai-matchers": "^2.0.0",
    "@nomicfoundation/hardhat-ethers": "^3.0.0",
    "@nomicfoundation/hardhat-network-helpers": "^1.0.0",
    "@nomicfoundation/hardhat-toolbox": "^3.0.0",
    "@nomicfoundation/hardhat-verify": "^1.0.0",
    "@nomiclabs/hardhat-ethers": "^2.2.3",
    "@openzeppelin/hardhat-upgrades": "^2.3.1",
    "@typechain/ethers-v6": "^0.4.0",
    "@typechain/hardhat": "^8.0.0",
    "@types/mocha": ">=9.1.0",
    "@types/node": "^20.8.3",
    "ethers": "5.7.2",
    "hardhat": "^2.18.0",
    "hardhat-gas-reporter": "^1.0.8",
    "ipfs-http-client": "53.0.1",
    "solidity-coverage": "^0.8.1",
    "ts-node": ">=8.0.0",
    "typechain": "^8.2.0",
    "typescript": ">=4.5.0"
  },
ericglau commented 1 year ago

The current versions of the Hardhat Upgrades plugin requires ethers v6.

You can update your existing project to use ethers v6 according to Hardhat Toolbox v3's release notes.