IBatchGovernor

Git Source

Inherits: IGovernor

Author: M^0 Labs

Functions

castVotes

Allows the caller to cast votes on multiple proposals.

function castVotes(uint256[] calldata proposalIds, uint8[] calldata supportList) external returns (uint256 weight);

Parameters

NameTypeDescription

proposalIds

uint256[]

The list of unique proposal IDs being voted on.

supportList

uint8[]

The list of support type per proposal IDs to cast.

Returns

NameTypeDescription

weight

uint256

The number of votes cast for each proposal (the same for all of them).

castVotesBySig

Allows a signer to cast votes on multiple proposals via an ECDSA secp256k1 signature.

function castVotesBySig(uint256[] calldata proposalIds, uint8[] calldata supportList, uint8 v, bytes32 r, bytes32 s)
    external
    returns (uint256 weight);

Parameters

NameTypeDescription

proposalIds

uint256[]

The list of unique proposal IDs being voted on.

supportList

uint8[]

The list of support type per proposal IDs to cast.

v

uint8

An ECDSA secp256k1 signature parameter.

r

bytes32

An ECDSA secp256k1 signature parameter.

s

bytes32

An ECDSA secp256k1 signature parameter.

Returns

NameTypeDescription

weight

uint256

The number of votes cast for each proposal (the same for all of them).

castVotesBySig

Allows a signer to cast votes on multiple proposals via an arbitrary signature.

function castVotesBySig(
    address voter,
    uint256[] calldata proposalIds,
    uint8[] calldata supportList,
    bytes memory signature
) external returns (uint256 weight);

Parameters

NameTypeDescription

voter

address

The address of the account casting the votes.

proposalIds

uint256[]

The list of unique proposal IDs being voted on.

supportList

uint8[]

The list of support type per proposal IDs to cast.

signature

bytes

An arbitrary signature

Returns

NameTypeDescription

weight

uint256

The number of votes cast for each proposal (the same for all of them).

castVotesWithReason

Allows the caller to cast votes with reason on multiple proposals.

function castVotesWithReason(uint256[] calldata proposalIds, uint8[] calldata supportList, string[] calldata reasonList)
    external
    returns (uint256 weight);

Parameters

NameTypeDescription

proposalIds

uint256[]

The list of unique proposal IDs being voted on.

supportList

uint8[]

The list of support type per proposal IDs to cast.

reasonList

string[]

The list of reason per proposal IDs to cast.

Returns

NameTypeDescription

weight

uint256

The number of votes cast for each proposal (the same for all of them).

castVotesWithReasonBySig

Allows a signer to cast votes with reason on multiple proposals via an ECDSA secp256k1 signature.

function castVotesWithReasonBySig(
    uint256[] calldata proposalIds,
    uint8[] calldata supportList,
    string[] calldata reasonList,
    uint8 v,
    bytes32 r,
    bytes32 s
) external returns (uint256 weight);

Parameters

NameTypeDescription

proposalIds

uint256[]

The list of unique proposal IDs being voted on.

supportList

uint8[]

The list of support type per proposal IDs to cast.

reasonList

string[]

The list of reason per proposal IDs to cast.

v

uint8

An ECDSA secp256k1 signature parameter.

r

bytes32

An ECDSA secp256k1 signature parameter.

s

bytes32

An ECDSA secp256k1 signature parameter.

Returns

NameTypeDescription

weight

uint256

The number of votes cast for each proposal (the same for all of them).

castVotesWithReasonBySig

Allows a signer to cast votes with reason on multiple proposals via an arbitrary signature.

function castVotesWithReasonBySig(
    address voter,
    uint256[] calldata proposalIds,
    uint8[] calldata supportList,
    string[] calldata reasonList,
    bytes memory signature
) external returns (uint256 weight);

Parameters

NameTypeDescription

voter

address

The address of the account casting the votes.

proposalIds

uint256[]

The list of unique proposal IDs being voted on.

supportList

uint8[]

The list of support type per proposal IDs to cast.

reasonList

string[]

The list of reason per proposal IDs to cast.

signature

bytes

An arbitrary signature

Returns

NameTypeDescription

weight

uint256

The number of votes cast for each proposal (the same for all of them).

getBallotDigest

Returns the ballot digest to be signed, via EIP-712, given an internal digest (i.e. hash struct).

function getBallotDigest(uint256 proposalId, uint8 support) external view returns (bytes32);

Parameters

NameTypeDescription

proposalId

uint256

The unique proposal ID being voted on.

support

uint8

The type of support to cast for the proposal.

Returns

NameTypeDescription

<none>

bytes32

The digest to be signed.

getBallotsDigest

Returns the ballots digest to be signed, via EIP-712, given an internal digest (i.e. hash struct).

function getBallotsDigest(uint256[] calldata proposalIds, uint8[] calldata supportList)
    external
    view
    returns (bytes32);

Parameters

NameTypeDescription

proposalIds

uint256[]

The list of unique proposal IDs being voted on.

supportList

uint8[]

The list of support type per proposal IDs to cast.

Returns

NameTypeDescription

<none>

bytes32

The digest to be signed.

getBallotWithReasonDigest

Returns the ballot with reason digest to be signed, via EIP-712, given an internal digest (i.e. hash struct).

function getBallotWithReasonDigest(uint256 proposalId, uint8 support, string calldata reason)
    external
    view
    returns (bytes32);

Parameters

NameTypeDescription

proposalId

uint256

The unique proposal ID being voted on.

support

uint8

The type of support to cast for the proposal.

reason

string

The reason for which the caller casts their vote, if any.

Returns

NameTypeDescription

<none>

bytes32

The digest to be signed.

getBallotsWithReasonDigest

Returns the ballots with reason digest to be signed, via EIP-712, given an internal digest (i.e. hash struct).

function getBallotsWithReasonDigest(
    uint256[] calldata proposalIds,
    uint8[] calldata supportList,
    string[] calldata reasonList
) external view returns (bytes32);

Parameters

NameTypeDescription

proposalIds

uint256[]

The list of unique proposal IDs being voted on.

supportList

uint8[]

The list of support type per proposal IDs to cast.

reasonList

string[]

The list of reason per proposal IDs to cast.

Returns

NameTypeDescription

<none>

bytes32

The digest to be signed.

hashProposal

Returns the unique identifier for the proposal if it were created at this exact moment.

function hashProposal(bytes memory callData) external view returns (uint256);

Parameters

NameTypeDescription

callData

bytes

The single call data used to call this governor upon execution of a proposal.

Returns

NameTypeDescription

<none>

uint256

The unique identifier for the proposal.

voteToken

Returns the EIP-5805 token contact used for determine voting power and total supplies.

function voteToken() external view returns (address);

BALLOTS_TYPEHASH

Returns the EIP712 typehash used in the encoding of the digest for castVotesBySig function.

function BALLOTS_TYPEHASH() external pure returns (bytes32);

BALLOTS_WITH_REASON_TYPEHASH

Returns the EIP712 typehash used in the encoding of the digest for castVotesWithReasonBySig function.

function BALLOTS_WITH_REASON_TYPEHASH() external pure returns (bytes32);

Errors

AlreadyVoted

Revert message when a voter is trying to vote on a proposal they already voted on.

error AlreadyVoted();

ArrayLengthMismatch

Revert message when input arrays do not match in length.

error ArrayLengthMismatch(uint256 length1, uint256 length2);

EmptyProposalIdsArray

Revert message when the proposal IDs array is empty.

error EmptyProposalIdsArray();

ExecutionFailed

Revert message when execution of a proposal fails.

error ExecutionFailed(bytes data);

Parameters

NameTypeDescription

data

bytes

The revert data returned due to the failed execution.

InvalidCallData

Revert message when a proposal's call data is not specifically supported.

error InvalidCallData();

InvalidCallDatasLength

Revert message when a proposal's call data array is not of length 1.

error InvalidCallDatasLength();

InvalidTarget

Revert message when a proposal target is not this governor itself.

error InvalidTarget();

InvalidTargetsLength

Revert message when a proposal's targets array is not of length 1.

error InvalidTargetsLength();

InvalidValue

Revert message when a proposal value is not 0 ETH.

error InvalidValue();

InvalidValuesLength

Revert message when a proposal's values array is not of length 1.

error InvalidValuesLength();

InvalidVoteStart

Revert message when a an invalid vote start is detected.

error InvalidVoteStart();

InvalidVoteTokenAddress

Revert message when the vote token specified in the constructor is address(0).

error InvalidVoteTokenAddress();

NotSelf

Revert message when the caller of a governance-controlled function is not this governor itself.

error NotSelf();

ProposalCannotBeExecuted

Revert message when the proposal information provided cannot be executed.

error ProposalCannotBeExecuted();

ProposalDoesNotExist

Revert message when the proposal does not exist.

error ProposalDoesNotExist();

ProposalExists

Revert message when the proposal already exists.

error ProposalExists();

ProposalInactive

Revert message when voting on a proposal that is not in an active state (i.e. not collecting votes).

error ProposalInactive(ProposalState state);

Parameters

NameTypeDescription

state

ProposalState

The current state of the proposal.

ZeroVotingPower

Revert message when voting on a proposal with a zero voting weight.

error ZeroVotingPower();

Enums

VoteType

The type of support to cast for a proposal.

enum VoteType {
    No,
    Yes
}

Copyright 2024 M^0 Foundation