Governance Reference

Pharo protocol is governed and upgraded by PHRO token holders, using three distinct components; the PHRO token, governance module and timelock. Together these contracts allow the community to propose, vote, and implement changes to the Pharo protocol.

Any addresses with more than 10M gPHRO delegated to it may propose governance actions.

Timelock

The Timelock contract can modify system parameters, logic, and contracts in a 'time-delayed, opt-out' upgrade pattern. Timelock has a hard-coded minimum delay of 2 days, which is the least amount of notice possible for a governance action. Each proposed action will be published at a minimum of 2 days in the future from the time of announcement. Major upgrades, such as changing the risk system, may have up to a 30 day delay. Timelock is controlled by the governance module; pending and completed governance actions can be monitored on the Timelock Dashboard (coming soon!).

Key Events

Delegate Changed

Emitted when an account changes delegate.

DelegateVotesChanged

Emitted when a delegate account's vote balance changes.

PropsalCreated

Emitted when a new proposal is created.

VoteCast

Emitted when a vote has been casted on a proposal.

ProposalCancelled

Emitted when a proposal has been cancelled.

ProposalQueued

Emitted when a proposal has been queued.

ProposalExecuted

Emitted when a proposal has been executed in the timelock.

Read-Only Functions: PHRO

Get Current Votes

Returns the balance of votes for an account as of the current block.

Name

Type

account

address

Address of the account of which to retrieve the number of votes.

Solidity

Web3

Get Prior Votes

Returns the prior number of votes for an account at a specific block number. The block number passed must be a finalized block or the function will revert.

Name

Type

account

address

Address of the account of which to retrieve the prior number of votes.

blocknumber

uint

The block number at which to retrieve the prior number of votes.

RETURN

uint96

The number of prior votes

Solidity

Web3

State-Changing Functions: gPHRO

Delegate

Delegate votes from the sender to the delegatee. Users can delegate to 1 address at a time, and the number of votes added to the delegatee’s vote count is equivalent to the balance of gPHRO in the user’s account. Votes are delegated from the current block and onward, until the sender delegates again, or transfers their gPHRO.

Name

Type

delegatee

address

The address to which msg.sender wishes to delegate to.

RETURN

no

Reverts on error.

Solidity

Web3

Delegate By Signature

Delegate votes from the sender to the delegatee. Users can delegate to 1 address at a time, and the number of votes added to the delegatee’s vote count is equivalent to the balance of gPHRO in the user’s account. Votes are delegated from the current block and onward, until the sender delegates again, or transfers their gPHRO.

Name

Type

delegatee

address

The address to which msg.sender wishes to delegate to.

nonce

uint

The contract state required to match the signature. This can be retrieved from the contract's public nonces mapping.

expiry

uint

The time when the signature expires. A block timestamp in seconds since the UNIX epoch.

v

uint

The recovery byte of the signature.

r

bytes32

Half of the ECDSA signature pair.

s

bytes32

Half of the ECDSA signature pair.

RETURN

no

Reverts on error.

Solidity

Web3

Read-Only Functions: Governor Alpha

Quorum Votes

Returns the minimum number of votes required for a proposal to succeed.

Solidity

Web3

Proposal Threshold

Returns the minimum number of votes for an account to create a proposal.

Solidity

Web3

Proposal Max Operations

Returns the maximum number of actions that can be included in a proposal. Actions are function calls that will be made when a proposal succeeds and executes.

Solidity

Web3

Voting Delay

Returns the number of blocks to wait before voting on a proposal may begin. This value is added to the current block number when a proposal is created.

Solidity

Web3

Voting Period

Returns the duration of voting on a proposal, in blocks.

Solidity

Web3

Get Actions

Gets the actions of a selected proposal. Pass a proposal ID and get the targets, values, signatures and calldatas of that proposal.

Name

Type

proposalid

uint

ID of the proposal.

Returns:

  • Array of addresses of contracts the proposal calls.

  • Array of unsigned integers the proposal uses as values.

  • Array of strings of the proposal's signatures.

  • Array of calldata bytes of the proposal.

Solidity

Web3

Get Receipt

Returns a proposal ballot receipt of a given voter.

Name

Type

proposalid

uint

ID of the proposal in which to get a voter's ballot receipt.

voter

address

Address of the account of a proposal voter.

Receipt

struct

A Receipt struct for the ballot of the voter address.

Solidity

Web3

State

Returns enum of the type ProposalState, possible types are; Pending, Active, Canceled, Defeated, Succeeded, Queued, Expired and Executed.

Name

Type

proposalid

uint

ID of the proposal.

Solidity

Web3

State-Changing Functions: Governor Alpha

Propose

Creates a proposal to create a market, issue a grant or change the protocol.

Proposals will be voted on by delegated voters. If there is sufficient support before the voting period ends, the proposal shall be automatically enacted. Enacted proposals are queued and executed in the Timelock contract.

The sender must hold more gPHRO than the current proposal threshold (proposalThreshold()) as of the immediate previous block. If the threshold is 2,000,000 gPHRO, the sender must have been delegated more than 1% of all gPHRO in order to create a proposal. The proposal can have up to 10 actions (based on proposalMaxOperations()).

Name

Type

targets

address

The ordered list of target addresses for calls to be made during proposal execution. This array must be the same length of all other array parameters in this function.

values

uint

The ordered list of values (i.e. msg.value) to be passed to the calls made during the proposal execution. This array must be the same length of all other array parameters in this function.

signatures

string

The ordered list of function signatures to be passed during proposal execution. This array must be the same length of all other array parameters in this function.

calldatas

bytes

The ordered list of data to be passed to each individual function call during proposal execution. This array must be the same length of all other array parameters in this function.

description

string

A human readable description of the proposal and the changes it will enact.

RETURN

uint

Returns the ID of the new proposal.

Solidity

Web3

Queue

After a proposal has succeeded, any address can call the queue method to move the proposal into the Timelock queue. A proposal can only be queued

Name

Type

proposalid

uint

ID of a given successful proposal.

RETURN

no

Reverts on error.

Solidity

Web3

Execute

After the Timelock delay period, any account may invoke the execute method to apply the changes from the proposal to the target contracts. This will invoke each of the actions described in the proposal.

The execute function can be called by any Ethereum address.

This function is payable so the Timelock contract can invoke payable functions that were selected in the proposal.

Name

Type

proposalid

uint

ID of a given s

Solidity

Web3

Cancel

A proposal is eligible to be cancelled at any time prior to its execution, including while queued in the Timelock, using this function.

The cancel function can be called by the proposal creator, or any Ethereum address, if the proposal creator fails to maintain more delegated votes than the proposal threshold (e.g. 2,000,000).

Name

Type

proposalid

uint

ID of a proposal to cancel.

Solidity

Web3

Cast Vote

Cast a vote on a proposal. The account's voting weight is determined by its number of delegated votes at the time the proposal becomes active.

Name

Type

proposalid

uint

ID of a given successful proposal.

support

bool

A boolean of true for 'yes' and false for 'no' on the proposal vote.

RETURN

no

Reverts on error.

Solidity

Web3

Cast Vote By Signature

Cast a vote on a proposal. The account's voting weight is determined its number of delegated votes at the time the proposal became active. This method has the same purpose as Cast Vote, but instead enables offline signatures to participate in governance voting. For more details on how to create an offline signature, review EIP-712.

Name

Type

proposalid

uint

ID of a given successful proposal.

support

bool

A boolean of true for 'yes' and false for 'no' on the proposal vote.

expiry

uint

The time when the signature expires. A block timestamp in seconds since the UNIX epoch.

v

uint

The recovery byte of the signature.

r

bytes32

Half of the ECDSA signature pair.

s

bytes32

Half of the ECDSA signature pair.

Solidity

Web3

Last updated

Was this helpful?