Last updated
Last updated
Inherits: Patchable, StateAware, VotesDelegator, AdminControlled, MezzERC721Upgradeable, ITokenTimelock
Author: Daniel Yamagata & Naveen Ailawadi
This contract is used to vest a company's shares for a period of time. It is used by a company's Common Shares and Preferred Shares. The voting power of vesting shares can be delegated and used in governance
*Invariants:
_erc20Vesting[token] is always greater than or equal to _erc20Released[token]
_vestingScheduleByTokenId[tokenId].amount is always greater than or equal to _erc20ReleasedByTokenId[tokenId][shares]. This is inclusive of when the token's data is deleted upon vesting completion or when the vesting is canceled*
The Token Timelock should not receive the native token used to pay for gas All native tokens transferred to this contract will be locked forever and effectively burned
Initializes the token timelock contract
Parameters
Returns the address of the treasury, whose signers are the company's board of directors
Vest shares for a recipient according to a vesting schedule. Vesting is cancellable by the board or a set of admins determined by the board depending on if it is obligatory
'data.shares' must be tracked by the treasury, otherwise the function call will revert. This function uses an ERC721 safe transfer, which is susceptible to reentrancy. It follows the CEI pattern accordingly. There is no validation of 'data.startDate' being in the past. It is the responsibility of the caller to ensure its validity. If the start date is in the past farther than 'data.duration', the shares will be instantly vested. The max start date is two years into the future, at which point the shares will begin to vest
Parameters
Returns
Releases vested tokens to the owner of an ERC721. Can be called by anyone
This function is not access controlled. Any account can release vested shares for any token ID Vested shares are transferred to the owner of the token
Parameters
Returns
Cache and Validate
This function is primarily used by the Payroll Manager when an employee resigns at a timepoint
Returns
Cancels the vesting for a given token. Releases any vested shares and burns the remaining amount allocated to the token.
This function will revert if the caller is not the token owner nor an admin. If the caller is an admin, this function will revert if the token is obligatory
Parameters
Returns
If the owner is the payroll manager, transfer the vesting shares back to the treasury Otherwise, burn the shares. This is done to prevent the treasury from having to re-authorize and re-issue shares that were allocated to employees but subsequently canceled
Extends the vesting duration for the given 'tokenId'. Only callable by the token owner
This function will revert if the token does not exist
Parameters
Returns
Increases the vesting amount for 'tokenId' by 'equityExtension'
This function is not access controlled. It is callable by anyone This function will revert if the token does not exist
Parameters
Returns
Updates the delegate of 'delegator' from 'fromDelegate' to 'toDelegate'. Only callable by the Delegate Registry
Returns whether or not a given token is obligatory
Parameters
Returns
Returns true if the token was canceled, false otherwise
Returns true if the token has completed its vesting, false otherwise
Returns true if the token exists, false otherwise
Returns the vesting schedule for the given token
Parameters
Returns
Returns the remaining vesting amount for the given token
The remaining vesting amount refers to the difference between the shares attributed to the vesting schedule and how much has been released
Returns the Unix-timestamp in seconds at which the vesting schedule will complete
Returns the amount of shares that have been released for a given token
Parameters
Returns
Returns the amount of shares that are releasable for a given token. 'Releasable' refers to the amount of shares that have vested and have not yet been released
Parameters
Returns
Returns the current number of voting units for 'account' based on 'shares'
The return value does not adjust for the voting weight of 'shares'
Returns the voting units for 'account' based on 'shares' at the given 'timepoint'
The return value does not adjust for the voting weight of 'shares'. This function will revert if 'timepoint' is in the present or the future
Returns the current amount of 'shares' that are vesting for 'account'
Returns the cumlative amount of shares that are vesting or have been vested in the token timelock
Parameters
Returns
Returns the cumlative amount of shares that have been released from the token timelock
Parameters
Returns
Returns the name of the token timelock
Returns the symbol of the token timelock
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
Releases the '_releasableAmount' of vested shares to the owner of the token 'Releasable' refers to the amount vested minus the amount already released
Parameters
Returns the amount of tokens that are 'releasable' for a given token 'Releasable' refers to the amount vested minus the amount already released
Parameters
Returns
Calculates the vested amount of shares for a given vesting schedule. Does not check the released amount of shares Precision loss is possible, but extremely unlikely since shares will always have 18 decimals
Parameters
Returns
Burn a token with 'tokenId' and deletes it corresponding data in storage
Parameters
*Reverts if:
The caller is not the token owner or an admin
If the caller is an admin and the token is obligatory*
Asserts that the invariants hold true. Panics otherwise
Parameters
Overridden updated from '_ERC721Upgradeable' such that the voting units of a delegate is updated on token transfer, including burning
Returns
Transfers the voting units of 'shares' from the delegatee of 'from' to the delegatee of 'to'
Moves delegated votes of 'shares' from one delegate to another
ERC165 support
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
Access control for 'resetToPatchedLatestVersion()'