DelegateRegistry
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
DelegateRegistryStorageLocation
Functions
constructor
_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
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