ZeroGovernor

Git Source

Inherits: IZeroGovernor, ThresholdGovernor

Author: M^0 Labs

State Variables

_MAX_TOTAL_ZERO_REWARD_PER_ACTIVE_EPOCH

The maximum number of Zero tokens that can be rewarded per active epoch.

uint256 internal constant _MAX_TOTAL_ZERO_REWARD_PER_ACTIVE_EPOCH = 5_000_000e6;

emergencyGovernorDeployer

Returns the address of the Emergency Governor Deployer.

address public immutable emergencyGovernorDeployer;

powerTokenDeployer

Returns the address of the Power Token Deployer.

address public immutable powerTokenDeployer;

standardGovernorDeployer

Returns the address of the Standard Governor Deployer.

address public immutable standardGovernorDeployer;

_allowedCashTokens

The set of allowed cash tokens.

mapping(address token => bool allowed) internal _allowedCashTokens;

Functions

constructor

Construct a new ZeroGovernor contract.

constructor(
    address voteToken_,
    address emergencyGovernorDeployer_,
    address powerTokenDeployer_,
    address standardGovernorDeployer_,
    address bootstrapToken_,
    uint256 standardProposalFee_,
    uint16 emergencyProposalThresholdRatio_,
    uint16 zeroProposalThresholdRatio_,
    address[] memory allowedCashTokens_
) ThresholdGovernor("ZeroGovernor", voteToken_, zeroProposalThresholdRatio_);

Parameters

resetToPowerHolders

One of the valid proposals. Reset the Standard Governor, Emergency Governor, and Power Token to the Power Token holders. This would be used by Zero Token holders in the event that inflation is soon to result in Power Token overflowing, and/or there is a loss of faith in the state of either the Standard Governor or Emergency Governor.

function resetToPowerHolders() external onlySelf;

resetToZeroHolders

One of the valid proposals. Reset the Standard Governor, Emergency Governor, and Power Token to the ZeroToken holders. This would be used by Zero Token holders if they no longer have faith in the current set of PowerToken holders and/or the state of either the Standard Governor or Emergency Governor.

function resetToZeroHolders() external onlySelf;

setCashToken

One of the valid proposals. Sets the Cash Token of the system.

function setCashToken(address newCashToken_, uint256 newProposalFee_) external onlySelf;

Parameters

setEmergencyProposalThresholdRatio

One of the valid proposals. Sets the threshold ratio for Emergency Governor proposals.

function setEmergencyProposalThresholdRatio(uint16 newThresholdRatio_) external onlySelf;

Parameters

setZeroProposalThresholdRatio

One of the valid proposals. Sets the threshold ratio for this governor's proposals.

function setZeroProposalThresholdRatio(uint16 newThresholdRatio_) external onlySelf;

Parameters

isAllowedCashToken

Returns whether token is an allowed Cash Token of the system, as a parameter in setCashToken proposal.

function isAllowedCashToken(address token_) external view returns (bool);

Parameters

Returns

emergencyGovernor

Returns the address of the Emergency Governor.

function emergencyGovernor() public view returns (address);

standardGovernor

Returns the address of the Standard Governor.

function standardGovernor() public view returns (address);

_deployEphemeralContracts

Deploys the ephemeral standardGovernor, emergencyGovernor, and powerToken contracts.

function _deployEphemeralContracts(
    address emergencyGovernorDeployer_,
    address powerTokenDeployer_,
    address standardGovernorDeployer_,
    address bootstrapToken_,
    address cashToken_,
    uint16 emergencyProposalThresholdRatio_,
    uint256 proposalFee_
) internal returns (address standardGovernor_, address emergencyGovernor_, address powerToken_);

Parameters

Returns

_resetContracts

*Redeploy the ephemeral standardGovernor, emergencyGovernor, and powerToken contracts, where:

  • the cash token is the same cash token in the existing standardGovernor

  • the emergencyGovernor threshold ratio is the same threshold ratio in the existing emergencyGovernor

  • the standardGovernor proposal fee is the same proposal fee in the existing standardGovernor*

function _resetContracts(address bootstrapToken_) internal;

Parameters

_revertIfInvalidCalldata

All proposals target this contract itself, and must call one of the listed functions to be valid.

function _revertIfInvalidCalldata(bytes memory callData_) internal pure override;

Parameters

Copyright 2024 M^0 Foundation