0

I am having trouble voting in my DAO. I have created a ERC721 Token and a DAO, both using the OpenZeppelin Wizard

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

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/draft-ERC721Votes.sol";

contract DAOToken is ERC721, Ownable, EIP712, ERC721Votes {
    constructor() ERC721("DAOToken", "DTK") EIP712("DAOToken", "1") {}

    function safeMint(address to, uint256 tokenId) public onlyOwner {
        _safeMint(to, tokenId);
    }

    // The following functions are overrides required by Solidity.

    function _afterTokenTransfer(address from, address to, uint256 tokenId, uint256 batchSize)
        internal
        override(ERC721, ERC721Votes)
    {
        super._afterTokenTransfer(from, to, tokenId, batchSize);
    }
}

And a Governor:

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

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

contract MyGovernor is Governor, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction {
    constructor(IVotes _token)
        Governor("MyGovernor")
        GovernorVotes(_token)
        GovernorVotesQuorumFraction(1)
    {}

    function votingDelay() public pure override returns (uint256) {
        return 0; // 0 block
    }

    function votingPeriod() public pure override returns (uint256) {
        return 10; // 1 block
    }

    // The following functions are overrides required by Solidity.

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

After creating a proposal succesfully to mint to an address on my chain (I used a Ganache generated Chain), when I try to vote I am getting a Gas Estimate error that says that the proposal ID could not be found. I am getting the proposal ID by using the function 'hashProposal'

I followed the instructions from this Medium Article

Following has already been checked:

  1. The address I use to vote with has delegated voting rights to itself.

  2. The address I use to vote with owns tokens (minted to myself after creating the token).

  3. Ownership of the token has been transferred to the DAO (after minting to mysfelf for step 2).

  4. Creating the proposal does not seem to cause any errors.

2 Answers 2

1

There could be several reasons why you are getting a "proposal ID not found" error when trying to vote on your proposal. Here are some potential causes and solutions to consider:

  • The proposal ID you are using is not correct. When calling the hashProposal function, make sure you are passing in the correct parameters for the proposal you want to vote on. This includes the correct function selector, proposal metadata, and voting token address.

  • The voting token address you are using is not correct. The voting token address must be the address of the ERC721 token that you are using for voting in your DAO. If you are not sure what the voting token address is, you can check the governance variable in your DAO contract, which should hold the address of the voting token.

  • The voting period has not started yet. The voting period for a proposal starts after the votingDelay defined in your governor contract has passed. If you are trying to vote on a proposal before the voting period has started, you will not be able to do so and will get the "proposal ID not found" error.

  • The voting period has already ended. The voting period for a proposal ends after the votingPeriod defined in your governor contract has passed. If you are trying to vote on a proposal after the voting period has ended, you will not be able to do so and will get the "proposal ID not found" error.

  • The proposal has already been executed or cancelled. If a proposal has already been executed or cancelled, it will no longer be available for voting and you will get the "proposal ID not found" error. To check the status of a proposal, you can call the getProposal function on your governor contract and check the executed and cancelled variables.

In general, it is important to make sure that you are using the correct parameters and following the correct sequence of steps when creating and voting on proposals in your DAO. You may also want to check the logs for any potential errors that may be causing the issue.

0

Turn out my proposal contained some errors, some mix up of addresses etc. Once I submitted my proposal correctly, it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.