Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

IVotes

Common interface for Votes-enabled contracts.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes

pub trait IVotes<TState>

Trait functions

get_votes

Returns the current amount of votes that account has.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes::get_votes

fn get_votes(self: @TState, account: ContractAddress) -> u256

get_past_votes

Returns the amount of votes that account had at a specific moment in the past.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes::get_past_votes

fn get_past_votes(self: @TState, account: ContractAddress, timepoint: u64) -> u256

get_past_total_supply

Returns the total supply of votes available at a specific moment in the past.

NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. Votes that have not been delegated are still part of total supply, even though they would not participate in a vote.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes::get_past_total_supply

fn get_past_total_supply(self: @TState, timepoint: u64) -> u256

delegates

Returns the delegate that account has chosen.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes::delegates

fn delegates(self: @TState, account: ContractAddress) -> ContractAddress

delegate

Delegates votes from the sender to delegatee.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes::delegate

fn delegate(ref self: TState, delegatee: ContractAddress)

delegate_by_sig

Delegates votes from delegator to delegatee.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes::delegate_by_sig

fn delegate_by_sig(
    ref self: TState,
    delegator: ContractAddress,
    delegatee: ContractAddress,
    nonce: felt252,
    expiry: u64,
    signature: Span<felt252>,
)

clock

Returns the current timepoint determined by the contract’s operational mode, intended for use in time-sensitive logic. See https://eips.ethereum.org/EIPS/eip-6372#clock.

Requirements:

  • This function MUST always be non-decreasing.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes::clock

fn clock(self: @TState) -> u64

CLOCK_MODE

Returns a description of the clock the contract is operating in. See https://eips.ethereum.org/EIPS/eip-6372#clock_mode.

Requirements:

  • The output MUST be formatted like a URL query string, decodable in standard JavaScript.

Fully qualified path: openzeppelin_interfaces::governance::votes::IVotes::CLOCK_MODE

fn CLOCK_MODE(self: @TState) -> ByteArray