Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

InternalTrait

Fully qualified path: openzeppelin_governance::votes::votes::VotesComponent::InternalTrait

pub trait InternalTrait<TContractState, +HasComponent<TContractState>, +VotingUnitsTrait<ComponentState<TContractState>>, impl Clock: ERC6372Clock, impl HasComponent<TContractState>: HasComponent<TContractState>, +SNIP12Metadata, +Drop<TContractState>>

Trait functions

get_total_supply

Returns the current total supply of votes.

Fully qualified path: openzeppelin_governance::votes::votes::VotesComponent::InternalTrait::get_total_supply

fn get_total_supply(self: @ComponentState<TContractState>) -> u256

move_delegate_votes

Moves delegated votes from one delegate to another.

May emit one or two DelegateVotesChanged events.

Fully qualified path: openzeppelin_governance::votes::votes::VotesComponent::InternalTrait::move_delegate_votes

fn move_delegate_votes(
    ref self: ComponentState<TContractState>,
    from: ContractAddress,
    to: ContractAddress,
    amount: u256,
)

transfer_voting_units

Transfers, mints, or burns voting units.

To register a mint, from should be zero. To register a burn, to should be zero. Total supply of voting units will be adjusted with mints and burns.

WARNING: If voting units are based on an underlying transferable asset (like a token), you must call this function every time the asset is transferred to keep the internal voting power accounting in sync. For ERC20 and ERC721 tokens, this is typically handled using hooks.

May emit one or two DelegateVotesChanged events.

Fully qualified path: openzeppelin_governance::votes::votes::VotesComponent::InternalTrait::transfer_voting_units

fn transfer_voting_units(
    ref self: ComponentState<TContractState>,
    from: ContractAddress,
    to: ContractAddress,
    amount: u256,
)

num_checkpoints

Returns the number of checkpoints for account.

Fully qualified path: openzeppelin_governance::votes::votes::VotesComponent::InternalTrait::num_checkpoints

fn num_checkpoints(self: @ComponentState<TContractState>, account: ContractAddress) -> u64

checkpoints

Returns the pos-th checkpoint for account.

Fully qualified path: openzeppelin_governance::votes::votes::VotesComponent::InternalTrait::checkpoints

fn checkpoints(
    self: @ComponentState<TContractState>, account: ContractAddress, pos: u64,
) -> Checkpoint

_delegate

Delegates all of account’s voting units to delegatee.

Emits a DelegateChanged event. May emit one or two DelegateVotesChanged events.

Fully qualified path: openzeppelin_governance::votes::votes::VotesComponent::InternalTrait::_delegate

fn _delegate(
    ref self: ComponentState<TContractState>, account: ContractAddress, delegatee: ContractAddress,
)