Deploy a governance token
Include ERC20Votes to future-proof a token for onchain governance
If you are deploying a token that might govern a DAO in the future, include voting methods. It's easy and safe to add them up front. It's much harder to upgrade or wrap the token to add them later.
How to deploy a compatible token
Deploy your token with EIP-5805 compatibility. That means providing voting methods, getVotes
and getPastVotes
. Governors can call those voting methods when counting votes on proposals.
OpenZeppelin's ERC20Votes extension is a canonical implementation of EIP-5805. OpenZeppelin Governor – or a custom Governor contract – uses the extension to calculate voting power.
Learn more about Governor, the leading DAO smart contact setup.
Deploying a token with voting is safe and easy
Open Zeppelin's ERC20Votes extension is safe and self-contained. It has been audited and is currently deployed in thousands of token contracts.
The main tradeoff is gas usage. Fortunately, users can make that decision themselves.
Users can choose to activate their voting power by calling delegate
. When an account is delegated, transfers
will also update voting power. That update uses extra gas. Users who do a lot of transfers can always undelegate their tokens to save gas by delegating to the zero address.
Last updated