Skip to main content

GovernorBravoDelegate

Git Source

Inherits: GovernorBravoDelegateStorageV2, IGovernorBravoEventsAndErrors

State Variables

name

The name of this contract

string public constant name = "Olympus Governor Bravo";

MIN_PROPOSAL_THRESHOLD_PCT

The minimum setable proposal threshold

uint256 public constant MIN_PROPOSAL_THRESHOLD_PCT = 15_000;

MAX_PROPOSAL_THRESHOLD_PCT

The maximum setable proposal threshold

uint256 public constant MAX_PROPOSAL_THRESHOLD_PCT = 1_000_000;

MIN_VOTING_PERIOD

The minimum setable voting period

uint256 public constant MIN_VOTING_PERIOD = 21600;

MAX_VOTING_PERIOD

The max setable voting period

uint256 public constant MAX_VOTING_PERIOD = 100800;

MIN_VOTING_DELAY

The min setable voting delay

uint256 public constant MIN_VOTING_DELAY = 7200;

MAX_VOTING_DELAY

The max setable voting delay

uint256 public constant MAX_VOTING_DELAY = 50400;

MIN_GOHM_SUPPLY

The minimum level of gOHM supply acceptable for OCG operations

uint256 public constant MIN_GOHM_SUPPLY = 1_000e18;

quorumPct

The percentage of total supply in support of a proposal required in order for a quorum to be reached and for a vote to succeed

Olympus has a variable supply system, that actively fluctuates fairly significantly, so it is better to use a percentage of total supply, rather than a fixed number of tokens.

uint256 public constant quorumPct = 20_000_000;

highRiskQuorum

The percentage of total supply in support of a proposal related to a high risk module in the Default system required in order for a quorum to be reached and for a vote to succeed

Olympus has a variable supply system, that actively fluctuates fairly significantly, so it is better to use a percentage of total supply, rather than a fixed number of tokens.

uint256 public constant highRiskQuorum = 20_000_000;

approvalThresholdPct

The percentage of votes that must be in favor of a proposal for it to succeed

uint256 public constant approvalThresholdPct = 60_000_000;

proposalMaxOperations

The maximum number of actions that can be included in a proposal

uint256 public constant proposalMaxOperations = 15;

DOMAIN_TYPEHASH

The EIP-712 typehash for the contract's domain

bytes32 public constant DOMAIN_TYPEHASH =
keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");

BALLOT_TYPEHASH

The EIP-712 typehash for the ballot struct used by the contract

bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,uint8 support)");

Functions

initialize

Used to initialize the contract during delegator constructor

function initialize(
address timelock_,
address gohm_,
address kernel_,
address vetoGuardian_,
uint256 votingPeriod_,
uint256 votingDelay_,
uint256 activationGracePeriod_,
uint256 proposalThreshold_
) public virtual;

Parameters

NameTypeDescription
timelock_addressThe address of the Timelock
gohm_addressThe address of the gOHM token
kernel_addressThe address of the kernel
vetoGuardian_addressThe address of the veto guardian
votingPeriod_uint256The initial voting period
votingDelay_uint256The initial voting delay
activationGracePeriod_uint256
proposalThreshold_uint256The initial proposal threshold (percentage of total supply. out of 1000)

propose

Function used to propose a new proposal. Sender must have delegates above the proposal threshold

function propose(
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas,
string memory description
) public returns (uint256);

Parameters

NameTypeDescription
targetsaddress[]Target addresses for proposal calls
valuesuint256[]Eth values for proposal calls
signaturesstring[]Function signatures for proposal calls
calldatasbytes[]Calldatas for proposal calls
descriptionstringString description of the proposal

Returns

NameTypeDescription
<none>uint256Proposal id of new proposal

emergencyPropose

Create proposal in case of emergency

Can only be called by the veto guardian in the event of an emergency

function emergencyPropose(
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas
) external returns (uint256);

Parameters

NameTypeDescription
targetsaddress[]Target addresses for proposal calls
valuesuint256[]Eth values for proposal calls
signaturesstring[]Function signatures for proposal calls
calldatasbytes[]Calldatas for proposal calls

activate

Activates voting for a proposal

This also captures quorum based on total supply to ensure it's as close as possible to the proposal start time

function activate(uint256 proposalId) external;

queue

Queues a successful proposal

function queue(uint256 proposalId) external;

Parameters

NameTypeDescription
proposalIduint256The id of the proposal to queue

_queueOrRevertInternal

function _queueOrRevertInternal(
uint256 proposalId,
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) internal;

execute

Executes a queued proposal if eta has passed

function execute(uint256 proposalId) external payable;

Parameters

NameTypeDescription
proposalIduint256The id of the proposal to execute

cancel

Cancels a proposal only if sender is the proposer, or proposer delegates dropped below proposal threshold

function cancel(uint256 proposalId) external;

Parameters

NameTypeDescription
proposalIduint256The id of the proposal to cancel

veto

Vetoes a proposal only if sender is the veto guardian

function veto(uint256 proposalId) external;

Parameters

NameTypeDescription
proposalIduint256The id of the proposal to veto

castVote

Cast a vote for a proposal

function castVote(uint256 proposalId, uint8 support) external;

Parameters

NameTypeDescription
proposalIduint256The id of the proposal to vote on
supportuint8The support value for the vote. 0=against, 1=for, 2=abstain

castVoteWithReason

Cast a vote for a proposal with a reason

function castVoteWithReason(uint256 proposalId, uint8 support, string calldata reason) external;

Parameters

NameTypeDescription
proposalIduint256The id of the proposal to vote on
supportuint8The support value for the vote. 0=against, 1=for, 2=abstain
reasonstringThe reason given for the vote by the voter

castVoteBySig

Cast a vote for a proposal by signature

External function that accepts EIP-712 signatures for voting on proposals.

function castVoteBySig(uint256 proposalId, uint8 support, uint8 v, bytes32 r, bytes32 s) external;

castVoteInternal

Internal function that caries out voting logic

function castVoteInternal(address voter, uint256 proposalId, uint8 support) internal returns (uint256);

Parameters

NameTypeDescription
voteraddressThe voter that is casting their vote
proposalIduint256The id of the proposal to vote on
supportuint8The support value for the vote. 0=against, 1=for, 2=abstain

Returns

NameTypeDescription
<none>uint256The number of votes cast

_setVotingDelay

Admin function for setting the voting delay

function _setVotingDelay(uint256 newVotingDelay) external;

Parameters

NameTypeDescription
newVotingDelayuint256new voting delay, in blocks

_setVotingPeriod

Admin function for setting the voting period

function _setVotingPeriod(uint256 newVotingPeriod) external;

Parameters

NameTypeDescription
newVotingPerioduint256new voting period, in blocks

_setProposalThreshold

Admin function for setting the proposal threshold

newProposalThreshold must be greater than the hardcoded min

function _setProposalThreshold(uint256 newProposalThreshold) external;

Parameters

NameTypeDescription
newProposalThresholduint256new proposal threshold

_setVetoGuardian

Admin function for setting the vetoGuardian. vetoGuardian can veto any proposal

function _setVetoGuardian(address account) external;

Parameters

NameTypeDescription
accountaddressAccount to set vetoGuardian to (0x0 to remove vetoGuardian)

_setPendingAdmin

Begins transfer of admin rights. The newPendingAdmin must call _acceptAdmin to finalize the transfer.

Admin function to begin change of admin. The newPendingAdmin must call _acceptAdmin to finalize the transfer.

function _setPendingAdmin(address newPendingAdmin) external;

Parameters

NameTypeDescription
newPendingAdminaddressNew pending admin.

_acceptAdmin

Accepts transfer of admin rights. msg.sender must be pendingAdmin

Admin function for pending admin to accept role and update admin

function _acceptAdmin() external;

_setModuleRiskLevel

Sets whether a module is considered high risk

Admin function to set whether a module in the Default Framework is considered high risk

function _setModuleRiskLevel(bytes5 module_, bool isHighRisk_) external;

Parameters

NameTypeDescription
module_bytes5The module to set the risk of
isHighRisk_boolIf the module is high risk

_isEmergency

Checks if the system should be set to an emergency state due to a collapsing supply of gOHM

function _isEmergency() internal view returns (bool);

_isHighRiskProposal

Checks if a proposal is high risk by identifying actions where the Default Framework kernel is the target, if so, checking if it's installing or deactivating a policy, and if so, checking if the policy is touching a high risk module. This makes external calls, so when for future updates to the Governor, make sure that functions where it is used cannot be re-entered.

function _isHighRiskProposal(address[] memory targets, string[] memory signatures, bytes[] memory calldatas)
internal
returns (bool);

getChainIdInternal

View function that gets the chain ID of the current network

function getChainIdInternal() internal view returns (uint256);

Returns

NameTypeDescription
<none>uint256The chain ID

getProposalThresholdVotes

View function that gets the proposal threshold in number of gOHM based on current supply

function getProposalThresholdVotes() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256The proposal threshold in number of gOHM

getQuorumVotes

View function that gets the quorum in number of gOHM based on current supply

function getQuorumVotes() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256The quorum in number of gOHM

getHighRiskQuorumVotes

View function that gets the high risk quorum in number of gOHM based on current supply

function getHighRiskQuorumVotes() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256The high risk quorum in number of gOHM

getProposalQuorum

Gets the quorum required for a given proposal

function getProposalQuorum(uint256 proposalId) external view returns (uint256);

Parameters

NameTypeDescription
proposalIduint256the id of the proposal

Returns

NameTypeDescription
<none>uint256The quorum required for the given proposal

getProposalThreshold

Gets the proposer votes threshold required for a given proposal

function getProposalThreshold(uint256 proposalId) external view returns (uint256);

Parameters

NameTypeDescription
proposalIduint256the id of the proposal

Returns

NameTypeDescription
<none>uint256The proposer votes threshold required for the given proposal

getProposalEta

Gets the eta value for a given proposal

function getProposalEta(uint256 proposalId) external view returns (uint256);

Parameters

NameTypeDescription
proposalIduint256the id of the proposal

Returns

NameTypeDescription
<none>uint256The eta value for the given proposal

getProposalVotes

Gets the against, for, and abstain votes for a given proposal

function getProposalVotes(uint256 proposalId) external view returns (uint256, uint256, uint256);

Parameters

NameTypeDescription
proposalIduint256the id of the proposal

Returns

NameTypeDescription
<none>uint256The against, for, and abstain votes for the given proposal
<none>uint256
<none>uint256

getActions

Gets actions of a proposal

function getActions(uint256 proposalId)
external
view
returns (address[] memory targets, uint256[] memory values, string[] memory signatures, bytes[] memory calldatas);

Parameters

NameTypeDescription
proposalIduint256the id of the proposal

Returns

NameTypeDescription
targetsaddress[]of the proposal actions
valuesuint256[]of the proposal actions
signaturesstring[]of the proposal actions
calldatasbytes[]of the proposal actions

getReceipt

Gets the receipt for a voter on a given proposal

function getReceipt(uint256 proposalId, address voter) external view returns (Receipt memory);

Parameters

NameTypeDescription
proposalIduint256the id of proposal
voteraddressThe address of the voter

Returns

NameTypeDescription
<none>ReceiptThe voting receipt

getVoteOutcome

Gets the voting outcome of the proposal

function getVoteOutcome(uint256 proposalId) public view returns (bool);

Parameters

NameTypeDescription
proposalIduint256the id of proposal

Returns

NameTypeDescription
<none>boolThe voting outcome

state

Gets the state of a proposal

function state(uint256 proposalId) public view returns (ProposalState);

Parameters

NameTypeDescription
proposalIduint256The id of the proposal

Returns

NameTypeDescription
<none>ProposalStateProposal state