contracts icon indicating copy to clipboard operation
contracts copied to clipboard

Failed to compile contracts with TypeError: Function needs to specify overridden contract "GovernorVotes"

Open wuminqi opened this issue 3 years ago • 0 comments

Failed to run npm run compile on OSX 12.6 with Node.js v16.4.2.

The message says TypeError: Function needs to specify overridden contract "GovernorVotes".

It appears that override(Governor, IGovernor) should be override(GovernorVotes, IGovernor) to pass the compilation according to the message tip.

Detailed Output

➜  contracts git:(main) ✗ npm run compile

> [email protected] compile
> npx hardhat compile

Solidity 0.8.12 is not fully supported yet. You can still use Hardhat, but some features, like stack traces, might not work correctly.

Learn more at https://hardhat.org/hardhat-runner/docs/reference/solidity-support

TypeError: Function needs to specify overridden contract "GovernorVotes".
  --> contracts/core/Governor.sol:69:9:
   |
69 |         override(Governor, IGovernor)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: This contract: 
  --> @openzeppelin/contracts/governance/extensions/GovernorVotes.sol:14:1:
   |
14 | abstract contract GovernorVotes is Governor {
   | ^ (Relevant source part starts here and spans across multiple lines).


TypeError: Invalid contract specified in override list: "Governor".
  --> contracts/core/Governor.sol:69:9:
   |
69 |         override(Governor, IGovernor)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: This contract: 
  --> @openzeppelin/contracts/governance/Governor.sol:26:1:
   |
26 | abstract contract Governor is Context, ERC165, EIP712, IGovernor {
   | ^ (Relevant source part starts here and spans across multiple lines).


Error HH600: Compilation failed

For more info go to https://hardhat.org/HH600 or run Hardhat with --show-stack-traces

wuminqi avatar Sep 29 '22 05:09 wuminqi