VotesComponent
Votes Component
The Votes component provides a flexible system for tracking and delegating voting power. It is currently implemented for ERC20 and ERC721 tokens. An account can delegate their voting power to a representative, that will pool delegated voting units from different delegators and can then use it to vote in decisions. Voting power must be delegated to be counted, and an account must delegate to itself if it wishes to vote directly without a trusted representative.
When integrating the Votes component, the ´VotingUnitsTrait´ must be implemented to get the voting units for a given account as a function of the implementing contract. For simplicity, this module already provides two implementations for ERC20 and ERC721 tokens, which will work out of the box if the respective components are integrated.
NOTE: ERC20 and ERC721 tokens implementing this component must call ´transfer_voting_units´ whenever a transfer, mint, or burn operation is performed. Hooks can be leveraged for this purpose, as shown in the following ERC20 example:
See the documentation (https://docs.openzeppelin.com/contracts-cairo/3.0.0/governance.html#usage_2) for examples and more details.
Fully qualified path: openzeppelin_governance::votes::votes::VotesComponent
Modules
Free functions
Structs
| Storage | — |
| DelegateChanged | Emitted when delegator delegates their votes from from_delegate to to_delegate . |
| DelegateVotesChanged | Emitted when delegate votes are updated from previous_votes to new_votes . |
| ComponentState | — |
Enums
Traits
| VotingUnitsTrait | A trait that must be implemented when integrating {VotesComponent} into a contract. It offers a mechanism to retrieve the number of voting units for a given account at the current time. |
| HasComponent | — |
| InternalTrait | — |
| UnsafeNewContractStateTraitForVotesImpl | — |