Custom Voting in OZ Governance

Hey guys, I am create a DAO for a project and have already created a ERC20 Votes based token. Now I have to create the governance using the same. I would like to add a way so I can track votes from different contracts with custom ways, like let's say if the tokens are already in a lock for sometime, there has to be a way to track votes using those as well. Is there a way to achieve a same.

TLDR: Need a way to track votes from multiple smart contracts including ERC20 Votes.

Hello @tgf90083,

OpenZeppelin Governor only allows 1 voting mechanism, which you can play with in our Wizard. If you have an specific question, please submit it individually to #support.

I'll keep this open in the #smart-contracts:developer-wanted category in case someone from the community shows up.

Hi @ernestognw , Thank you for the response. Please allow me to provide more details on my question. I was recently looking into the blur contract and it is also a governance token. However, in the contract, the votes are being calculated from 2 different places, one is the standard voting, another is from the tokens which are locked in another contract. So I was wondering if something like this was possible or not in the governance because my token is already deployed on mainnet and cannot change it either. Attaching the blur contracts for reference. Thank you

Token Locking contract:

From what I can see the votes are calculated from the same ERC20, the difference is just if that's been claimed or not, so their governor should still have a single voting mechanism (the underlying Blur token).

This can be done with a custom ERC20Votes by overriding the getVotes function (among others) as they do:

function getVotes(address account) public view override returns (uint256) {
    return ERC20Votes.getVotes(account) + _getTokenLockupBalance(account);

Yes correct, however as you said they are overriding the getVotes functions to do the same. The issue I have is that my token is already deployed, so is there a way to achieve something similar inside the governance contract? Thank you

You'll need to replace the token. Maybe taking a look to ERC20Wrapper may help you. It can be used to wrap a token and add functionalities.

1 Like