Skip to content

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

@wuminqi

Description

@wuminqi

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

> codefordao-contracts@0.1.0 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions