Governance

https://github.com/Into-the-Fathom/fathom-dao-smart-contracts/blob/master/contracts/dao/governance/MainTokenGovernor.sol

The MainTokenGovernor is an advanced governance contract integrates multiple functionalities including proposal management, token governance, timelock control, and emergency stops. It extends several OpenZeppelin contracts to create a robust governance framework.

Structs

ProposalCore

  • voteStart (Timers.BlockNumber): The block number marking the start of the voting period.

  • voteEnd (Timers.BlockNumber): The block number marking the end of the voting period.

  • executed (bool): Indicates whether the proposal has been executed.

  • canceled (bool): Indicates whether the proposal has been canceled.

  • expireTimestamp (uint256): A timestamp after which the proposal can no longer be executed.

Storage Variables

isSupportedToken (mapping(address => bool)): Tracks whether a token is supported for operations like relay or recovery.

listOfSupportedTokens (address[]): A dynamic list of all tokens that have been added as supported, allowing for enumeration and iteration through supported tokens.

isConfirmed (mapping(uint256 => bool)): Maps proposal IDs to their confirmation status, indicating whether a proposal has been confirmed by the multisig.

isProposalExecuted (mapping(uint256 => bool)): Maps proposal IDs to a boolean indicating whether they have been executed. Ensures a proposal can't be executed more than once.

Set Functions

relayERC20

  • Arguments:

    • target (address): The address of the token to relay.

    • data (bytes): The data payload for the relay transaction.

  • Description: Allows the governance system to relay ERC20 tokens that might have been sent to the contract by mistake. It ensures only supported tokens can be relayed.

relayNativeToken

  • Arguments:

    • target (address): The address of the recipient or contract.

    • value (uint256): The amount of native tokens (e.g., ETH) to send.

    • data (bytes): The data payload for the relay transaction.

  • Description: Similar to relayERC20 but for native blockchain tokens like ETH, ensuring that any mistakenly sent native tokens can be returned or used in governance operations.

propose

  • Arguments:

    • targets (address[]): Addresses of contracts called under the proposal.

    • values (uint256[]): List of values (in wei) for each call.

    • calldatas (bytes[]): Calldata to be sent to each target.

    • description (string): Human-readable description of the proposal.

  • Returns: uint256 (proposalId)

  • Description: Initiates a new proposal in the governance system.

cancelProposal

  • Arguments:

    • targets (address[])

    • values (uint256[])

    • calldatas (bytes[])

    • descriptionHash (bytes32)

  • Returns: uint256

  • Description: Cancels a proposal, can only be accessed by Multisig.

emergencyStop

  • Description: Halts all contract functions effectively, only callable by Multisig, can also recover and send all supported tokens and native tokens to the multisig's address.

addSupportingToken

  • Arguments:

    • _token (address): Address of the token to add as supported.

  • Description: Adds a token to the list of supported tokens for relay or recovery operations.

removeSupportingToken

  • Arguments:

    • _token (address): Address of the token to remove from supported list.

  • Description: Removes a token from the list of supported tokens, disallowing any future relay or recovery operations for it.

Events

TokenSupported

  • Arguments: None.

  • Description: Emitted when a token is added to the list of supported tokens for relay operations.

TokenUnsupported

  • Arguments: None.

  • Description: Emitted when a token is removed from the list of supported tokens.

ProposalQueued

  • Parameters:

    • proposalId (uint256): ID of the proposal that has been queued.

    • eta (uint256): Estimated time of execution for the proposal.

  • Description: Emitted when a proposal is successfully queued in the timelock to be executed later.

ProposalExecuted

  • Parameters:

    • proposalId (uint256): ID of the proposal that has been executed.

  • Description: Emitted when a proposal is successfully executed.

ConfirmProposal

  • Parameters:

    • signer (address): Address of the signer who confirmed the proposal.

    • proposalId (uint256): ID of the confirmed proposal.

  • Description: Emitted when a proposal is confirmed by a multisig signer.

RevokeConfirmation

  • Parameters:

    • signer (address): Address of the signer who revoked the confirmation.

    • proposalId (uint256): ID of the proposal whose confirmation was revoked.

  • Description: Emitted when the confirmation of a proposal is revoked by a multisig signer.

MaxTargetUpdated

  • Parameters:

    • newMaxTargets (uint256): New maximum number of targets allowed in a proposal.

    • oldMaxTargets (uint256): Old maximum number of targets that was previously allowed.

  • Description: Emitted when the maximum number of targets that can be included in a proposal is updated.

ProposalLifetimeUpdated

  • Parameters:

    • newProposalLifetime (uint256): The new duration (in seconds) that a proposal remains valid.

    • oldProposalLifetime (uint256): The old duration that a proposal was valid.

  • Description: Emitted when the lifespan of proposals is updated.

BlocklistStatusUpdated

  • Parameters:

    • account (address): Address of the account whose blocklist status was updated.

    • isBlocklisted (bool): New blocklist status of the account.

  • Description: Emitted when the blocklist status of an account is updated to either restrict or allow proposal creation by that account.

Last updated

Copyright© Fathom App 2024.