Skip to content

BerachainGovernance

0x4f4A5c2194B8e856b7a05B348F6ba3978FB6f6D5 | ABI JSON

The Berachain Governance contract extends OpenZeppelin's governor contracts. It uses the $BGT token as its governance token, which determines voting power in the governance system. Users must hold $BGT tokens to participate in governance activities such as creating proposals and voting.

Inherits: Governor, GovernorSettings, GovernorCountingSimple, GovernorVotes, GovernorVotesQuorumFraction, GovernorTimelockControl, GovernorPreventLateQuorum

Structs

InitialGovernorParameters

Parameters used to initialize the governor contract.

solidity
struct InitialGovernorParameters {
    uint256 proposalThreshold;
    uint256 quorumNumeratorValue;
    uint48 votingDelay;
    uint32 votingPeriod;
}

Properties

NameTypeDescription
proposalThresholduint256The minimum number of votes required to create a proposal
quorumNumeratorValueuint256The numerator of the quorum fraction
votingDelayuint48The delay before voting begins
votingPerioduint32The duration of the voting period

View Functions

BALLOT_TYPEHASH

Returns the type hash used for ballot signatures in EIP-712.

solidity
function BALLOT_TYPEHASH() public view virtual returns (bytes32);

COUNTING_MODE

Returns a string describing the vote counting mode. For this contract, returns "support=bravo&quorum=for,abstain".

solidity
function COUNTING_MODE() public pure virtual override returns (string memory);

EXTENDED_BALLOT_TYPEHASH

Returns the type hash used for extended ballot signatures in EIP-712.

solidity
function EXTENDED_BALLOT_TYPEHASH() public view virtual returns (bytes32);

clock

Returns the current timepoint according to the mode the contract is operating on.

solidity
function clock() public view virtual override returns (uint48);

getVotes

Returns the voting power of an account at a specific timepoint.

solidity
function getVotes(address account, uint256 timepoint) public view virtual override returns (uint256);

getVotesWithParams

Returns the voting power of an account at a specific timepoint, with additional parameters.

solidity
function getVotesWithParams(
    address account,
    uint256 timepoint,
    bytes memory params
) public view virtual override returns (uint256);

hasVoted

Returns whether an account has cast a vote on a specific proposal.

solidity
function hasVoted(uint256 proposalId, address account) public view virtual override returns (bool);

hashProposal

Hashes the proposal parameters to get a unique proposal ID.

solidity
function hashProposal(
    address[] memory targets,
    uint256[] memory values,
    bytes[] memory calldatas,
    bytes32 descriptionHash
) public pure virtual override returns (uint256);

name

Returns the name of the governor instance.

solidity
function name() public view virtual override returns (string memory);

proposalDeadline

Returns the deadline timepoint for a proposal.

solidity
function proposalDeadline(uint256 proposalId) public view virtual override returns (uint256);

proposalEta

Returns the timestamp at which a proposal will be executable, if in queued state.

solidity
function proposalEta(uint256 proposalId) public view virtual override returns (uint256);

proposalNeedsQueuing

Returns whether a proposal needs to be queued before execution.

solidity
function proposalNeedsQueuing(uint256 proposalId) public view virtual override returns (bool);

proposalProposer

Returns the account that created a proposal.

solidity
function proposalProposer(uint256 proposalId) public view virtual override returns (address);

proposalSnapshot

Returns the snapshot timepoint for a proposal.

solidity
function proposalSnapshot(uint256 proposalId) public view virtual override returns (uint256);

proposalThreshold

Returns the number of votes required to create a proposal.

solidity
function proposalThreshold() public view virtual override returns (uint256);

proposalVotes

Returns the current votes for a proposal.

solidity
function proposalVotes(uint256 proposalId)
    public
    view
    virtual
    override
    returns (uint256 againstVotes, uint256 forVotes, uint256 abstainVotes);

quorum

Returns the minimum number of votes required for a timepoint to be valid.

solidity
function quorum(uint256 timepoint) public view virtual override returns (uint256);

quorumDenominator

Returns the denominator used to calculate quorum.

solidity
function quorumDenominator() public view virtual override returns (uint256);

quorumNumerator

Returns the numerator used to calculate quorum.

solidity
function quorumNumerator() public view virtual override returns (uint256);

state

Returns the state of a proposal.

solidity
function state(uint256 proposalId) public view virtual override returns (ProposalState);

timelock

Returns the timelock contract address.

solidity
function timelock() public view virtual override returns (address);

token

Returns the governance token contract.

solidity
function token() public view virtual override returns (IERC5805);

version

Returns the version of the governor instance.

solidity
function version() public view virtual override returns (string memory);

votingDelay

Returns the delay before voting on a proposal may take place, in blocks.

solidity
function votingDelay() public view virtual override returns (uint256);

votingPeriod

Returns the voting period duration, in blocks.

solidity
function votingPeriod() public view virtual override returns (uint256);

Functions

execute

Executes a successful proposal. Can only be called when a proposal is in the Succeeded state.

Parameters:

  • targets: List of target addresses for proposal calls
  • values: List of ETH values for proposal calls
  • calldatas: List of calldata for proposal calls
  • descriptionHash: Hash of the proposal description
solidity
function execute(
    address[] memory targets,
    uint256[] memory values,
    bytes[] memory calldatas,
    bytes32 descriptionHash
) public payable virtual override returns (uint256);

onERC1155Received

Handles the receipt of a single ERC1155 token type. Required for the contract to receive ERC1155 tokens.

solidity
function onERC1155Received(address, address, uint256, uint256, bytes memory)
    public
    virtual
    override
    returns (bytes4);

relay

Relays a transaction or function call to a target contract. Can only be called by the governance executor.

solidity
function relay(address target, uint256 value, bytes calldata data) external payable virtual override;

updateQuorumNumerator

Updates the quorum numerator. Can only be called through governance.

solidity
function updateQuorumNumerator(uint256 newQuorumNumerator) external virtual override;

updateTimelock

Updates the timelock contract. Can only be called through governance.

solidity
function updateTimelock(TimelockController newTimelock) external virtual override;

Events

EIP712DomainChanged

Emitted when the EIP712 domain is changed. This is used for vote signature verification.

solidity
event EIP712DomainChanged();

LateQuorumVoteExtensionSet

Emitted when the late quorum vote extension duration is changed. This extension helps prevent last-minute quorum manipulations.

solidity
event LateQuorumVoteExtensionSet(uint64 oldVoteExtension, uint64 newVoteExtension);

Parameters

NameTypeDescription
oldVoteExtensionuint64Previous duration of the vote extension period
newVoteExtensionuint64New duration of the vote extension period

ProposalCanceled

Emitted when a proposal is canceled.

solidity
event ProposalCanceled(uint256 proposalId);

Parameters

NameTypeDescription
proposalIduint256ID of the canceled proposal

ProposalCreated

Emitted when a new proposal is created.

solidity
event ProposalCreated(
    uint256 proposalId,
    address proposer,
    address[] targets,
    uint256[] values,
    string[] signatures,
    bytes[] calldatas,
    uint256 voteStart,
    uint256 voteEnd,
    string description
);

Parameters

NameTypeDescription
proposalIduint256Unique identifier of the proposal
proposeraddressAddress of the account that created the proposal
targetsaddress[]Target addresses for proposal calls
valuesuint256[]ETH values for proposal calls
signaturesstring[]Function signatures for proposal calls
calldatasbytes[]Encoded function data for proposal calls
voteStartuint256Timestamp when voting begins
voteEnduint256Timestamp when voting ends
descriptionstringDescription of the proposal

ProposalExecuted

Emitted when a proposal is executed.

solidity
event ProposalExecuted(uint256 proposalId);

Parameters

NameTypeDescription
proposalIduint256ID of the executed proposal

ProposalExtended

Emitted when a proposal's voting period is extended due to late quorum.

solidity
event ProposalExtended(uint256 indexed proposalId, uint64 extendedDeadline);

Parameters

NameTypeDescription
proposalIduint256ID of the proposal being extended
extendedDeadlineuint64New deadline timestamp for the proposal

ProposalQueued

Emitted when a proposal is queued in the timelock.

solidity
event ProposalQueued(uint256 proposalId, uint256 etaSeconds);

Parameters

NameTypeDescription
proposalIduint256ID of the queued proposal
etaSecondsuint256Timestamp when the proposal can be executed

ProposalThresholdSet

Emitted when the proposal threshold is updated.

solidity
event ProposalThresholdSet(uint256 oldProposalThreshold, uint256 newProposalThreshold);

Parameters

NameTypeDescription
oldProposalThresholduint256Previous number of votes required to create proposal
newProposalThresholduint256New number of votes required to create proposal

QuorumNumeratorUpdated

Emitted when the quorum numerator is updated.

solidity
event QuorumNumeratorUpdated(uint256 oldQuorumNumerator, uint256 newQuorumNumerator);

Parameters

NameTypeDescription
oldQuorumNumeratoruint256Previous numerator of the quorum fraction
newQuorumNumeratoruint256New numerator of the quorum fraction

TimelockChange

Emitted when the timelock controller contract is changed.

solidity
event TimelockChange(address oldTimelock, address newTimelock);

Parameters

NameTypeDescription
oldTimelockaddressPrevious timelock contract address
newTimelockaddressNew timelock contract address

VoteCast

Emitted when a vote is cast on a proposal.

solidity
event VoteCast(address indexed voter, uint256 proposalId, uint8 support, uint256 weight, string reason);

Parameters

NameTypeDescription
voteraddressAddress of the account casting the vote
proposalIduint256ID of the proposal being voted on
supportuint8Support value: 0=against, 1=for, 2=abstain
weightuint256Number of votes cast
reasonstringOptional reason for the vote

VoteCastWithParams

Emitted when a vote with parameters is cast on a proposal.

solidity
event VoteCastWithParams(
    address indexed voter,
    uint256 proposalId,
    uint8 support,
    uint256 weight,
    string reason,
    bytes params
);

Parameters

NameTypeDescription
voteraddressAddress of the account casting the vote
proposalIduint256ID of the proposal being voted on
supportuint8Support value: 0=against, 1=for, 2=abstain
weightuint256Number of votes cast
reasonstringOptional reason for the vote
paramsbytesAdditional parameters for the vote

VotingDelaySet

Emitted when the voting delay is updated.

solidity
event VotingDelaySet(uint256 oldVotingDelay, uint256 newVotingDelay);

Parameters

NameTypeDescription
oldVotingDelayuint256Previous delay before voting starts
newVotingDelayuint256New delay before voting starts

VotingPeriodSet

Emitted when the voting period duration is updated.

solidity
event VotingPeriodSet(uint256 oldVotingPeriod, uint256 newVotingPeriod);

Parameters

NameTypeDescription
oldVotingPerioduint256Previous duration of the voting period
newVotingPerioduint256New duration of the voting period