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:
The address I use to vote with has delegated voting rights to itself.
The address I use to vote with owns tokens (minted to myself after creating the token).
Ownership of the token has been transferred to the DAO (after minting to mysfelf for step 2).
Creating the proposal does not seem to cause any errors.