1

I am making a DAO using openzeppelin and I downloaded the governance contract that they provide from the openzeppelin contract wizard. once I had imported this file into remix IDE an error popped up saying

"Function has to override specified but does not override anything"

so I followed that error to the GovernorCountingSimple.sol file and saw that it was the _countVote function but I can't seem to override it. I think I am just missing something simple but I don't know how to override it when the last argument within the function is "bytes memory" with no declared name and I cant seem to just call the super statement on the function to pass the last argument.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/governance/Governor.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorSettings.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorCountingSimple.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorVotes.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorVotesQuorumFraction.sol";
import "@openzeppelin/contracts/governance/extensions/GovernorTimelockControl.sol";

contract GovernernerContract is Governor, GovernorSettings, GovernorCountingSimple, 
GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl {
constructor(
                            IVotes _token, 
                            TimelockController _timelock, 
                            uint256 _votingDelay,
                            uint256 _votingPeriod,
                            uint256 _quorumPercentage
                        )
    Governor("governernerContract")
    GovernorSettings( _votingDelay /* 1 block */, _votingPeriod  /* 45818= ~ 1 week */, 0)
    GovernorVotes(_token)
    GovernorVotesQuorumFraction(_quorumPercentage)
    GovernorTimelockControl(_timelock)
{}
    

// The following functions are overrides required by Solidity.

//this is my attempt to override the function but i dont know how to deal with the bytes 
//memory argument
function _countVote(
    uint256 proposalId,
    address account,
    uint8 support,
    uint256 weight,
    bytes memory // params
) internal override {
//    super._countVote(proposalId,account,support,weight,*);
}


function votingDelay()
    public
    view
    override(IGovernor, GovernorSettings)
    returns (uint256)
{
    // return super.votingDelay();
}

function votingPeriod()
    public
    view
    override(IGovernor, GovernorSettings)
    returns (uint256)
{
    return super.votingPeriod();
}

function quorum(uint256 blockNumber)
    public
    view
    override(IGovernor, GovernorVotesQuorumFraction)
    returns (uint256)
{
    return super.quorum(blockNumber);
}

function state(uint256 proposalId)
    public
    view
    override(Governor, GovernorTimelockControl)
    returns (ProposalState)
{
    return super.state(proposalId);
}

function propose(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, string memory description)
    public
    override(Governor, IGovernor)
    returns (uint256)
{
    return super.propose(targets, values, calldatas, description);
}

function proposalThreshold()
    public
    view
    override(Governor, GovernorSettings)
    returns (uint256)
{
    return super.proposalThreshold();
}

function _execute(uint256 proposalId, address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
    internal
    override(Governor, GovernorTimelockControl)
{
    super._execute(proposalId, targets, values, calldatas, descriptionHash);
}

function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash)
    internal
    override(Governor, GovernorTimelockControl)
    returns (uint256)
{
    return super._cancel(targets, values, calldatas, descriptionHash);
}

function _executor()
    internal
    view
    override(Governor, GovernorTimelockControl)
    returns (address)
{
    return super._executor();
}

function supportsInterface(bytes4 interfaceId)
    public
    view
    override(Governor, GovernorTimelockControl)
    returns (bool)
{
    return super.supportsInterface(interfaceId);
}

}

gsan
  • 549
  • 1
  • 4
  • 14
TheGarry243
  • 63
  • 1
  • 7

1 Answers1

1

You was closer to the solution...

Just change this line: super._countVote(proposalId,account,support,weight,*);

Instead of using this symbol * to omit last parameter, try with single quotes.

This should work: super._countVote(proposalId,account,support,weight,'');

NineCattoRules
  • 2,253
  • 6
  • 39
  • 84