Treasury
Inherits: ITreasury, Team
Author: Daniel Yamagata & Naveen Ailawadi
A Safe-like contract whose signers are a company's board of directors. A Mezzanine company resembles a tree data structure. The 'Treasury' is the root node of the tree, while 'departments' and 'modules' are internal and leaf nodes. A treasury should hold nearly all assets of a company. Funds can be spent recursively by departments and modules given there are sufficcient approvals and balances. The entirety of a company can be queried either directly from the treasury or via a tree traversal algorithm
State Variables
TreasuryStorageLocation
Functions
_getTreasuryStorage
constructor
onlyMezzGovernance
onlyPayrollManager
init
__Treasury_init
capitalStack
Returns the address of the company's capital stack
delegateRegistry
Returns the address of the company's delegate registry
denominationAsset
Returns the address of the denomination asset
All debt by the company will be recorded in terms of the denomination asset This value is immutable
getCommonShares
Returns the address of the company's common shares
A treasury will only have a single set of common shares
getGovernor
Returns the address of the Governor
The Governor is able to manage the signers of the Treasury
getTokenTimelock
Returns the address of the Token Timelock
Used by Mezz Shares to issue and vest shares atomically
getPayrollManager
Returns the address of the Payroll Manager
The Payroll Manager is a shortbound ERC721 contract that manages the payroll of employees. It is able to arbitrarily spend money and common shares from the treasury without approvals. It is controlled by the board of directors (i.e. the Treasury) and a set of admins, who are set by the board
isAddingAsset
Returns true if the treasury is adding an asset, false otherwise. A callback used by the capital stack to prevent the treasury from arbitrarily adding an asset to the capital stack
isRemovingAsset
Returns true if the treasury is removing an asset, false otherwise. A callback used by the capital stack to prevent the treasury from arbitrarily removing an asset from the capital stack
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
swapGuard
A function to swap the guard of a team contract.
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
removeChild
Removes 'childToRemove' from the '_children' set. Will revert if 'childToRemove' is not in the '_children' set
changeGovernor
Deploys and initializes a new governor. Sets the new governor accordingly
Changes the current governor to a new one associated with 'governorCoreId' A treasury cannot change its governor to one with the same core ID
Parameters
Returns
addAssetToCapitalStack
Deploys an asset with 'assetCoreId' via the Mezz Deployer and adds it to the seniority level with 'seniorityLevelIndex' in the capital stack. If the asset supports the Mezz Shares interface, adds it to the company's shares. Adds a document to the Document Registry with 'assetDocumentName' and 'assetDocumentUri'. The 'owner' of the document will be the capital stack. The name and URI can be updated retroactively at any time.
Parameters
removeAssetFromCapitalStack
Removes an asset from the capital stack. The 'removable()' function of 'assetToRemove()' must return true for this function to succeed. The conditions for removal are bespoke to each asset. For example, the total supply of a share class must be zero for it to be removed. If 'assetToRemove' supports the Mezz Shares interface, it will be removed from the company's shares. The document associated with the asset will be updated to null
spendPayroll
Transfers an 'amount' of an 'asset' to the payroll module. Only callable by the payroll module. The asset must either be a whitelisted denomination asset or the company's common shares. Returns the amount of the asset paid to the recipient, inclusive of ERC20 transfer fees.
This function bypasses all of the treasury's ERC20 allowances. This was designed in a manner to prevent the board from needing to manually setting approvals for payroll
Parameters
Returns
spend
Transfers 'amount' of asset to the caller, who must be a child. Sends any set fees for the treasury implementation to the fee controller
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
name
Returns the name of 'this', which is a string
symbol
Returns the symbol for the company
getParent
Returns the parent of 'this'. If 'this' is a department or module, returns the team that directly controls 'this'. If 'this' is the Treasury, returns the sentinel parent, which is address(0x1)
Returns
getShares
Returns the addresses for the company's share classes as an address array
isValidShares
Returns true if 'sharesToCheck' is a valid share class for the company, false otherwise
Parameters
outstandingSupply
Returns the summation of the outstanding supply for all share classes. This does not include any vesting or treasury shares
fullyDilutedSupply
Returns the summation of the fully diluted supply for all share classes. This includes authorized, vesting, and treasury shares
_validateCallerIsPayrollManager
_validateCallerIsGovernance
_authorizePatch
Access control for 'resetToPatchedLatestVersion()'. Validation of 'data' is completd in Team.sol
supportsInterface
ERC165 support
Structs
TreasuryStorage
Last updated