Department

Git Source

Inherits: Team, IDepartment

Author: Daniel Yamagata & Jerry Qi & Naveen Ailawadi

A multi-signature wallet whose signers are determined by its ancestors. A department can transfer funds recursively from the treasury to themselves, given there is sufficient approvals and balances. An ancestor is a department or the treasury, which is higher in the organizational hierarchy than 'this'. Unlike the traditional definition, an 'ancestor' does not include 'this', itself.

State Variables

DepartmentStorageLocation

bytes32 private constant DepartmentStorageLocation = 0xbcbd9931e6c2b25760bd06d79dd059ceba389ce5a1832f868178693a75fc3c00;

Functions

_getDepartmentStorage

function _getDepartmentStorage() internal pure returns (DepartmentStorage storage $);

constructor

constructor(address _mezzHub, address _mezzMigrator) Team(_mezzHub, _mezzMigrator);

onlyAncestor

onlyAncestorOrAuthorized

The msg.sender must be 'this' or an ancestor

init

Standardized init function that all departments must inherit

Parameters

Name
Type
Description

initTreasury

address

The address of the treasury

_owners

address[]

The initial signers of the department's multisig

_threshhold

uint256

The initial threshold of the department's multisig

initGuard

address

The address of the guard contract, which should be deployed atomically with the department

initParent

address

The address of the department's parent

params

bytes

Any additional parameters that the department needs to initialize

__Department_init

Sets the initial state for a department and validates inputs

manageOwners

A function to manage the signers of a Gnosis Safe.

Makes external, authorized calls on address(this) that are normally blocked by Mezz Guards. This function is overridden and access-controlled such that the caller must be a Treasury's governor or a department's ancestor Refer to Constants.sol for the given function selectors that can be used as an 'action'

Parameters

Name
Type
Description

functionSelector

bytes4

params

bytes

The abi-encoded parameters to pass to the function

swapGuard

A function to swap the guard of a team contract. Deploys and initializes the guard via the Mezz Deployer.

Makes external, authorized calls on address(this) that are normally blocked by Mezz Guards. This function is overridden and access-controlled such that the caller must be a Treasury's governor or a department's ancestor

insertChild

Inserts 'childToInsert' to the '_children' set. 'childToInsert' must support the module or department interface. Will revert if 'childToInsert' is already in the '_children' set

spend

Recursively transfers an 'amount' of 'asset' from the treasury to the caller, who must be a descendant of the treasury Will revert if the treasury has insufficient funds or the ancestors of 'this' have insufficient approvals

getParent

Returns

Name
Type
Description

<none>

address

The parent, which is either the treasury, a department, a module, or the sentinel parent

treasury

Returns the treasury as an ITreasury interface

name

Returns the name of 'this', which is a string

supportsInterface

ERC165 support

_validateCallerIsAncestor

Reverts if the caller is not an ancestor

_validateCallerIsTeamOrAncestor

Reverts if the caller is not an ancestor or address(this)

upgradeToNewerVersion

Upgrades 'this' to a newer version via the MezzMigrator

Only callable by 'this' or an ancestor

_authorizePatch

Access control for 'resetToPatchedLatestVersion()'. Validation of 'data' is completd in Team.sol

Structs

DepartmentStorage

Last updated