MezzShares
Inherits: StateAware, VotesDelegator, Asset, ModifiedERC20VotesUpgradeable, IMezzShares
Author: Daniel Yamagata & Naveen Ailawadi
A base contract for share classes in the Mezzanine Protocol. Each share class has a voting weight, which is used to calculate voting power in governance. The 'governor' of a company must authorize shares before they can be issued. Shares can only be issued by the company's treasury, whose signers are the board of directors.
This contract is intended to be inherited and extended by specific share types. The clock() and CLOCK_MODE() differ from ERC20VotesUpgradeable. Mezz Shares uses block.timestamp in place of block.number This is due to the fact that block production times vary by chain, making block.number an unreliable measure of time for this implementation. _transferVotingUnits() has been overridden such that _totalCheckpoints is decremented when shares are transferred to the treasury and incremented when shares are transferred from the treasury
State Variables
MezzSharesStorageLocation
Functions
_getMezzSharesStorage
constructor
__MezzShares_init
treasury
Returns the address of the treasury, whose signers are the company's board of directors
authorizedShares
Returns the number of authorized shares
Returns
<none>
uint256
The number of authorized shares
votingWeight
Returns the voting weight of the shares
'votingWeight' is how much voting power each share has in governance
Returns
<none>
uint256
The voting weight
authorizeShares
Authorizes the specified number of shares
Increments 'authorizedShares' by 'amount'. Only callable by the Mezz Governor
Parameters
amount
uint256
The number of shares to authorize
issueShares
Issues a number of shares to an account or vests shares to the account via the Token Timelock
Decrements 'authorizedShares' by 'value'. Only callable by the Treasury. This function will revert if 'duration' is zero and 'cliff', 'initialUnlock', 'startDate, and 'obligatory' are not null
Parameters
recipient
address
The account to issue or vest shares to
amount
uint256
The number of shares to issue
duration
uint32
The duration of the vesting period in seconds
cliff
uint32
The time in seconds after the start date that the initial unlock occurs
initialUnlock
uint256
The number of shares that unlock at the cliff
startDate
uint48
The start date of the vesting period as a Unix-timestamp in seconds
obligatory
bool
Whether the shares' vesting is obligatory or not
Returns
<none>
uint256
The token timelock's address if the shares are vested, otherwise zero
burn
Burns the sender's shares by 'amount'
Called by the Token Timelock when vesting is canceled
Parameters
amount
uint256
The number of shares to burn
updateDelegate
Updates the delegate of 'delegator' from 'fromDelegate' to 'toDelegate'. Only callable by the Delegate Registry
outstandingSupply
Returns the number of shares outstanding. The outstanding shares are the total supply minus the treasury shares and shares that are vesting in the Token Timelock.
fullyDilutedSupply
Returns the fully diluted supply of shares, which include the number of authorized shares
delegates
Returns the delegate for 'account' that is set in the delegate registry
delegateBySig
Overridden 'delegateBySig()' such that it always revert
delegate
Overridden 'delegate()' such that it always reverts
_delegate
name
Returns the name of the asset as a string
symbol
Returns the symbol of the asset as a string
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
removable
Returns true if the total supply of shares is zero, false otherwise
This function is queried by the treasury and capital stack to see if shares can be removed. To get a total supply of zero, all outstanding shares should be burned
clock
Returns the block.timestamp as a uint48
EIP-6372 implementation. block.timestamp is used over block.number
CLOCK_MODE
Returns a URL-query-like string as specified in EIP-6372
Timestamp is used over block.number
_getVotingUnits
_maxSupply
_update
Override _update(...), which is used on transfers in OZ's ERC20Votes implementation, such that delegatation is automatically completed for the receiver, if not already set
Parameters
from
address
The address from which the tokens are being transferred
to
address
The address to which the tokens are being transferred
value
uint256
The amount of tokens being transferred
_transferVotingUnits
Overridden _transferVotingUnits() from OpenZeppelin's VotesUpgradeable.sol Decrements _totalCheckpoints when shares are transferred to the treasury Increments _totalCheckpoints when shares are transferred from the treasury
supportsInterface
ERC165 support
Structs
MezzSharesStorage
Last updated