DelegateRegistry

Git Source

Inherits: NoncesUpgradeable, StateAware, BoardControlled, Patchable, MezzEIP712, IDelegateRegistry

Author: Daniel Yamagata

A contract used to delegate voting power of a company's non-vesting and vesting shares. Delegates will receive the voting power of the delegator which can subsequently be used in governance

Invariant: the delegate of address(0) will always be address(0)

State Variables

DELEGATION_TYPEHASH

bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

DelegateRegistryStorageLocation

bytes32 private constant DelegateRegistryStorageLocation =
    0xa90ac951d12c63c63be62b72ff9c8457724b4d380ebdd06ffdd610ee98f70300;

Functions

constructor

constructor(address _mezzHub, address _mezzMigrator) StateAware(_mezzHub) Patchable(_mezzMigrator);

_getDelegateRegistryStorage

init

Initializes the delegate registry's state. Called atomically by the Mezz Deployer

__DelegateRegisitry_init

selfDelegate

Self-delegates 'account' under the following conditions:

  • account is not address(0)

  • The delegatee of 'account' is not set

  • The caller is a valid share class or the token timelock

  • 'account' is an EOA or properly supports the 'IMezzSelfDelegator' interface

If any of these conditions are false, the function will make no changes to state and return

delegate

Updates the delegatee of the caller to 'newDelegatee' and updates the state of all share classes and the token timelock

delegateBySig

Updates the delegatee of 'account' to 'newDelegatee' and updates the state of all share classes and the token timelock. A valid 'signature' for 'account' is required, otherwise this function will revert

_delegate

Validate

Updates the voting power of 'newDelegate' for all shares and the Token Timelock. Runs in O(n) The number of shares that a company can have is limited to 15. This is reasonable, preventing the reversion of this function due to the block gas limit

delegates

Returns the delegatee for 'account' if it is set. Otherwise, returns address(0)

version

Returns the version of the implementation as a uint256

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"))

getDelegationTransactionHash

Returns the transaction hash for

_getDelegationStructHash

supportsInterface

ERC165 support

upgradeToNewerVersion

Upgrades 'this' to a newer version via the Mezz Migrator. Only callable by the Treasury, whose signers are the board of directors

Will revert if the protocol state is 'Paused' or 'Frozen'

Parameters

Name
Type
Description

newVersion

uint256

The new version to upgrade to

data

bytes

The data to be passed to the new implementation, which likely should be a reinitializer function if used

_authorizePatch

Access control for 'resetToPatchedLatestVersion()'

Structs

DelegateRegistryStorage

Last updated