MezzGuard
Last updated
Last updated
Inherits: BaseGuard, Initializable, Credentialed, CommonValidation, IMezzGuard
Author: Daniel Yamagata & Jerry Qi & Naveen Ailawadi
A base contract inherited by guards used in Mezzanine. A 'Guard' refers to .
Mezzanine guards are set up such that adding, swapping, or removing owners, setting a guard, or enabling a module is disabled via the multi-signature funcitonality of the 'controlled'. Instead, particular functions in departments and the treasury must be used to access these functions. Specifically, access control is managed such that only an 'ancestor' or governance can call these functions
Initializes the Mezz Guard's state. Sets the defaults from the deployer
Mezz Guards are initialized atomically as they are deployed
Parameters
initControlled
address
initController
address
contractListDefaults
address[]
The default contracts to add to the contract list
selectorListDefaults
DataTypes.GuardSelector[]
The default selectors to add to the selector list
<none>
bytes
Initializes the Mezz Guard's state. Sets the defaults from the deployer
Adds a guard selector to the selector list, which will either enable or disable the function to be called by 'controlled'. A guard selector is made up of an address and a function selector
Parameters
selectorToAdd
DataTypes.GuardSelector
The contract address and function selector pair to be added to the list
Adds the selector to the list. Updates the index for the selector. Reverts if the selector is already on the list
Removes a guard selector from the selector list, which will either enable or disable the function to be called by 'controlled'. A guard selector is made up of an address and a function selector.
Parameters
selectorToRemove
DataTypes.GuardSelector
A contract address and function selector pair to be removed from the list
Adds a contract to the contract list, which will either enable or disable the function to be called by 'controlled'
Adds the contract to the list. Reverts if the contract is already on the list
Removes a contract from the contract list. Any contract removed from the list will be either enabled or disabled for the 'controlled' to interact with depending on whether the guard is a whitelist or blacklist guard, respectively. This is true no matter the function selector
Returns true if '_to' or the function selector of '_data' for '_to' is on either the contract list or selector list. Otherwise, returns false.
Called by a Safe after the execution of a transaction. Reverts if the transaction failed
Reference: https://github.com/safe-global/safe-smart-account/blob/f03dfae65fd1d085224b00a10755c509a4eaacfe/contracts/Safe.sol#L215-L217
Safe modules are always disabled in the initial version of Mezzanine
Returns the selectors list which may either be whitelisted or blacklisted depending on the guard
Returns the contracts list which may be either whitelisted or blacklisted depending on the guard
Returns
<none>
address
The controlled, which is a team whose guard is likely to be 'this'
Returns
<none>
address
The address which has admin control over the guard. The 'controller' can add or remove functions on both the '_selectorList' and '_contractList'.
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"))
Returns the version of the implementation as a uint256
ERC165 support
*Reverts under the following scenarios:
The '_operation' is a delegate call
The '_data' is an add owner, remove owner, or swap owner on the msg.sender
The '_data' is a set guard
The '_data' is to enable a module*
Returns true if the index of '_listInfo' is not 0, false otherwise
Returns true if the '_to' is on the '_contractList', false otherwise
Validates that the caller is '__controller();
Returns the '_controller'. Can be overridden to return an arbitrary address