Deploy a governance token
Include ERC20Votes to future-proof a token for on-chain 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.
Deploy your token with EIP-5805 compatibility. That means providing voting methods,
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.
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,
transferswill 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.