StartupGovernor

Git Source

Inherits: MezzGovernor, MezzEIP712, NoncesUpgradeable, IStartupGovernor

Author: Daniel Yamagata

A governance contract that enables the execution of arbitrary transactions by a super-majority of a treasury's signers. A super majority is counted as two-thirds of the signers rounded upwards. Below is a table with a few examples.

Signers
Super Majority

2

2

3

2

4

3

5

4

6

4

The execution of transactions requires an arbitrary deadline. If this deadline passes, the transaction will revert even if provided the correct number of signatures.

State Variables

EXECUTE_TYPEHASH

bytes32 public constant EXECUTE_TYPEHASH =
    keccak256("Execute(address target,uint256 value,bytes data,uint256 deadline,uint256 nonce)");

Functions

constructor

init

Intializes the Governor's state

Parameters

Name
Type
Description

initTreasury

address

The address of the Treasury that the Governor is in charge of

<none>

bytes

__Startup_Governor_init

The 'params' argument is maintained in case future versions require additional initialization parameters

executeTx

Executes an arbitrary transaction. Requires a super majority of board members to sign off

Signatures must be packed in ascending order of the public addresses of the signers and must be packed into a single variable.

Parameters

Name
Type
Description

target

address

The target address to execute the transaction on

value

uint256

The amount of native currency to send with the transaction

data

bytes

The calldata of the transaction

signatures

bytes

The signatures of the board members

deadline

uint256

Returns

Name
Type
Description

<none>

bytes

The return data of the transaction

_checkNSignatures

Validates the 'signatures' and the number of required signatures for 'safeCache', '_hash', and '_hashData'

_execute

Executes a call on a given 'target' with 'data' and 'value'. Reverts if the call fails or the target's code length is zero

getExecuteTransactionHash

Returns the transaction hash of the encoded execute data.

This hash is the one to be signed by a private key. Signatures should then be packed in ascending order by the public keys of the owners when calling executeTx()

Parameters

Name
Type
Description

execute

DataTypes.StartupGovernorExecute

The StartupGovernorExecute struct to hash

encodeExecuteData

Encodes a StartupGovernorExecute struct hash following the EIP-191 signed typed data standard

Reference: https://eips.ethereum.org/EIPS/eip-191

Parameters

Name
Type
Description

execute

DataTypes.StartupGovernorExecute

The StartupGovernorExecute struct to hash and subsequently encode

getExecuteStructHash

Returns the hash of a StartupGovernorExecute struct following the EIP-712 encoding standards

Reference: https://eips.ethereum.org/EIPS/eip-712

Parameters

Name
Type
Description

execute

DataTypes.StartupGovernorExecute

The StartupGovernorExecute struct to hash

coreId

Returns the coreId of the implementation as a bytes32

The core ID is the keccak256 hash of the contract name followed by a version under the following syntax: "mezzanine.coreId.ContractName.vX" For example, the core ID of the 2nd version of the Treasury would be the following: keccak256(abi.encodePacked("mezzanine.coreId.Treasury.v2"))

version

Returns the version of the implementation as a uint256

onERC721Received

Reference: https://eips.ethereum.org/EIPS/eip-721

onERC1155Received

Reference: https://eips.ethereum.org/EIPS/eip-1155

onERC1155BatchReceived

Reference: https://eips.ethereum.org/EIPS/eip-1155

supportsInterface

ERC165 support

Last updated