TokenVestingManagerVotes
The TokenVestingManagerVotes
contract extends the standard TokenVestingManager
with governance capabilities, enabling voting power delegation for vesting recipients. Each vesting schedule deploys an individual Vault
contract that holds tokens and implements the ERC5805 voting interface.
Overview
contract TokenVestingManagerVotes is AccessProtected, ITokenVestingManager
Key Features:
- Governance-enabled vesting with voting power delegation
- Individual Vault contracts for each vesting using EIP-1167 minimal proxies
- Flexible delegation allowing recipients to participate in governance before claiming
- ERC5805 compliance for standard governance integration
- Preserved voting power even during vesting periods
- All standard vesting features from TokenVestingManager
Use Cases:
- DAO governance token distributions
- Community voting power allocation
- Decentralized protocol token vesting
- Governance participation rewards
- Voting-enabled employee compensation
Key Differences from TokenVestingManager:
- Each vesting deploys a separate Vault contract
- Tokens are held in individual Vaults instead of the main contract
- Recipients can delegate voting power immediately
- Compatible with governance frameworks requiring ERC5805
- Slightly higher gas costs due to Vault deployments
Constructor
constructor(
address tokenAddress_,
ITypes.FeeType feeType_,
uint256 fee_,
address feeCollector_,
ITypes.FundingType fundingType_,
address vaultImplementation_
);
Parameters
Name | Type | Description |
---|---|---|
tokenAddress_ | address | - Address of the token to be vested |
feeType_ | ITypes.FeeType | - Fee type for this contract |
fee_ | uint256 | - Fee amount for this contract |
feeCollector_ | address | - Address of the fee collector |
fundingType_ | ITypes.FundingType | - Type of funding for this contract (Full or Partial) |
vaultImplementation_ | address | - Address of the deployed Vault implementation contract |
Requirements:
- Token address must implement IERC5805 interface
- Vault implementation must be a deployed Vault contract
- All addresses must be non-zero
- Token fee percentage cannot exceed 100% (10000 basis points)
State Variables
State Variables
BASIS_POINTS
Basis points for fee calculation
uint256 public constant BASIS_POINTS = 10000;
TOKEN_ADDRESS
Address of the token to be vested
address public immutable TOKEN_ADDRESS;
FEE_TYPE
Fee type for this contract
ITypes.FeeType public immutable FEE_TYPE;
FUNDING_TYPE
Funding type for this contract
ITypes.FundingType public immutable FUNDING_TYPE;
DEPLOYMENT_BLOCK_NUMBER
Block number when this contract was deployed
uint256 public immutable DEPLOYMENT_BLOCK_NUMBER;
FEE
Fee amount for this contract
uint256 public immutable FEE;
VAULT_IMPLEMENTATION
Address of the deployed Vault implementation contract
address public immutable VAULT_IMPLEMENTATION;
numTokensReservedForVesting
Total number of tokens reserved for vesting
uint256 public numTokensReservedForVesting;
numTokensReservedForFee
Number of tokens reserved for fees
uint256 public numTokensReservedForFee;
vestingIdNonce
Nonce to generate vesting IDs
uint256 private vestingIdNonce;
feeCollector
Address of the fee collector
address public feeCollector;
recipients
recipients of the vesting
address[] public recipients;
recipientToIndex
Mapping: recipient address => index+1 in recipients array (0 means not in array)
mapping(address => uint256) private recipientToIndex;
vestingFunding
Mapping: vestingId => funding amount
mapping(bytes32 => uint256) public vestingFunding;
recipientVestings
Holds the vesting ids for each recipient
mapping(address => bytes32[]) public recipientVestings;
vestingToRecipientIndex
Mapping: recipient => vestingId => index+1 in recipientVestings array (0 means not in array)
mapping(address => mapping(bytes32 => uint256)) private vestingToRecipientIndex;
vestingById
Mapping: vestingId => vesting Holds the vesting information for each vesting id
mapping(bytes32 => TokenVestingLib.Vesting) public vestingById;
pendingVestingTransfers
Mapping: vestingId => newOwner Tracks pending ownership transfers for each vesting ID
mapping(bytes32 => address) public pendingVestingTransfers;
vestingVaults
Holds the address of the Vault contract for each vesting ID
mapping(bytes32 => address) public vestingVaults;
Vault System
Vault Deployment
Each vesting automatically deploys a minimal proxy Vault contract:
// Vault deployment happens automatically in _createVesting
address vaultAddress = Clones.clone(VAULT_IMPLEMENTATION);
IVault(vaultAddress).initialize(TOKEN_ADDRESS, _recipient, address(this));
Vault Functions
The deployed Vault contracts provide:
interface IVault {
function release(uint256 amount) external returns (uint256);
function revoke(uint256 amount) external;
function delegate(address delegatee) external;
function getVotes(address account) external view returns (uint256);
function getPastVotes(address account, uint256 timepoint) external view returns (uint256);
function balance() external view returns (uint256);
}
Vesting Management Functions
createVesting
function createVesting(
address _recipient,
uint32 _startTimestamp,
uint32 _endTimestamp,
uint32 _timelock,
uint256 _initialUnlock,
uint32 _cliffReleaseTimestamp,
uint256 _cliffAmount,
uint32 _releaseIntervalSecs,
uint256 _linearVestAmount,
bool _isRevocable
) external onlyAdmin
Creates a new governance-enabled vesting schedule with an individual Vault.
Parameters: (Same as TokenVestingManager)
_recipient
: Beneficiary address_startTimestamp
: Vesting start time (unix timestamp)_endTimestamp
: Vesting end time (unix timestamp)_timelock
: Earliest claim timestamp (0 for no timelock)_initialUnlock
: Tokens immediately available at start_cliffReleaseTimestamp
: When cliff amount becomes available_cliffAmount
: Tokens released at cliff_releaseIntervalSecs
: Frequency of linear releases_linearVestAmount
: Total tokens vested linearly after cliff_isRevocable
: Whether admin can revoke this vesting
Additional Behavior:
- Deploys a new Vault contract as EIP-1167 minimal proxy
- Transfers tokens directly to the Vault (full funding mode)
- Emits
VaultDeployed
event with vault address - Enables immediate voting power delegation
Example:
// Create governance-enabled vesting
vestingManagerVotes.createVesting(
0x123...789, // DAO member address
block.timestamp, // start now
block.timestamp + 2 * 365 * 24 * 3600, // 2 years
0, // no timelock
1000e18, // 1000 tokens initial unlock
block.timestamp + 6 * 30 * 24 * 3600, // 6 months cliff
2000e18, // 2000 tokens at cliff
30 * 24 * 3600, // monthly releases
7000e18, // 7000 tokens linear
false // non-revocable for governance
);
createVestingBatch
function createVestingBatch(
CreateVestingBatchParams calldata params
) external onlyAdmin
Creates multiple governance-enabled vesting schedules, each with its own Vault.
Gas Considerations:
- Each vesting requires Vault deployment
- Batch creation is still more efficient than individual calls
- Recommended for creating 3-5 governance vestings simultaneously
fundVesting
function fundVesting(bytes32 _vestingId, uint256 _fundingAmount) external
Adds funding to an existing vesting's Vault contract (partial funding only).
Behavior:
- Transfers tokens directly to the vesting's Vault
- Maintains governance functionality during funding
- Recipient can delegate voting power for funded tokens immediately
Governance Functions
delegateVotingPower
function delegateVotingPower(bytes32 _vestingId, address _delegatee) external
Delegates voting power from a vesting's Vault to a specified address.
Parameters:
_vestingId
: Unique identifier of the vesting_delegatee
: Address to delegate voting power to
Access: Vesting recipient only
Behavior:
- Calls the Vault's
delegate
function - Delegatee receives voting power for all tokens in the Vault
- Delegation persists until changed or Vault is emptied
- Emits
VotingPowerDelegated
event
Example:
// Delegate voting power to a governance committee
vestingManagerVotes.delegateVotingPower(vestingId, governanceCommitteeAddress);
getVestingVault
function getVestingVault(bytes32 _vestingId) external view returns (address)
Returns the Vault contract address for a specific vesting.
Parameters:
_vestingId
: Unique identifier of the vesting
Returns: Address of the Vault contract holding the vesting's tokens
Claiming Functions
claim
function claim(bytes32 _vestingId) external payable
Claims vested tokens from the vesting's Vault contract.
Behavior:
- Calculates claimable amount using standard vesting logic
- Calls Vault's
release
function to transfer tokens - Tokens are transferred directly from Vault to recipient
- Deducts applicable fees and transfers to fee collector
- Maintains voting power for remaining tokens in Vault
Voting Power Impact:
- Claimed tokens lose voting power (transferred to recipient)
- Remaining tokens in Vault retain voting power
- Delegation persists for remaining tokens
adminClaim
function adminClaim(bytes32 _vestingId) external payable onlyAdmin
Admin-sponsored claiming from Vault contracts.
batchAdminClaim
function batchAdminClaim(bytes32[] memory _vestingIds) external payable onlyAdmin
Batch claiming from multiple Vault contracts.
Vault Query Functions
getVaultBalance
function getVaultBalance(bytes32 _vestingId) external view returns (uint256)
Returns the current token balance in a vesting's Vault.
getVaultVotes
function getVaultVotes(bytes32 _vestingId, address _account) external view returns (uint256)
Returns the current voting power for an account from a specific Vault.
getVaultPastVotes
function getVaultPastVotes(bytes32 _vestingId, address _account, uint256 _timepoint) external view returns (uint256)
Returns historical voting power for an account from a specific Vault.
getVaultDelegate
function getVaultDelegate(bytes32 _vestingId) external view returns (address)
Returns the current delegate for a vesting's Vault.
Administrative Functions
revokeVesting
function revokeVesting(bytes32 _vestingId) external onlyAdmin
Revokes a vesting and recovers unvested tokens from the Vault.
Behavior:
- Calculates unvested amount in the Vault
- Calls Vault's
revoke
function - Transfers unvested tokens back to the contract
- Recipient retains any vested tokens and their voting power
- Vault remains active for any remaining tokens
withdrawAdmin
function withdrawAdmin(uint256 _amountRequested) external onlyAdmin
Withdraws tokens from the main contract (not from individual Vaults).
Note: This function only withdraws tokens held in the main contract, not from individual Vaults.
Events
VaultDeployed
event VaultDeployed(
bytes32 indexed vestingId,
address indexed vaultAddress
);
Emitted when a new Vault is deployed for a vesting.
VotingPowerDelegated
event VotingPowerDelegated(
address indexed vault,
address indexed delegatee
);
Emitted when voting power is delegated from a Vault.
Standard Events: All events from TokenVestingManager are also available:
VestingCreated
VestingFunded
Claimed
VestingRevoked
VestingTransferred
AdminWithdrawn
TokenFeeWithdrawn
GasFeeWithdrawn
Error Handling
Vault-Specific Errors:
VaultUnauthorized()
: Unauthorized access to Vault functionsVaultAlreadyInitialized()
: Attempting to initialize already initialized VaultVaultDeploymentFailed()
: Vault deployment failedVaultZeroAddressDelegate()
: Attempting to delegate to zero address
Standard Errors: All errors from TokenVestingManager apply.
Optimization Strategies:
- Use batch operations when possible
- Consider gas costs when creating many small vestings
- Delegate voting power strategically to minimize transactions
Governance Framework Compatibility
The TokenVestingManagerVotes contract is compatible with:
OpenZeppelin Governor:
contract MyGovernor is Governor {
function getVotes(address account, uint256 blockNumber)
public view override returns (uint256) {
// Vault contracts automatically participate in governance
return token.getPastVotes(account, blockNumber);
}
}
Compound Governor:
- Vaults implement required voting interface
- Historical voting power is tracked
- Compatible with delegation patterns
Custom Governance:
- Access voting power through Vault contracts
- Use
getVotes
andgetPastVotes
functions - Implement custom delegation logic if needed
All available functions
isVestingActive
Reverts if the vesting is not active
modifier isVestingActive(bytes32 _vestingId);
onlyVestingRecipient
Reverts if caller is not the recipient of the vesting
modifier onlyVestingRecipient(bytes32 _vestingId);
onlyFeeCollector
modifier onlyFeeCollector();
constructor
Sets the token address to be vested
constructor(
address tokenAddress_,
ITypes.FeeType feeType_,
uint256 fee_,
address feeCollector_,
ITypes.FundingType fundingType_,
address vaultImplementation_
);
Parameters
Name | Type | Description |
---|---|---|
tokenAddress_ | address | - Address of the token to be vested |
feeType_ | ITypes.FeeType | - Fee type for this contract |
fee_ | uint256 | - Fee amount for this contract |
feeCollector_ | address | - Address of the fee collector |
fundingType_ | ITypes.FundingType | - Type of funding for this contract (Full or Partial) |
vaultImplementation_ | address |
createVesting
Create a new vesting
function createVesting(
address _recipient,
uint32 _startTimestamp,
uint32 _endTimestamp,
uint32 _timelock,
uint256 _initialUnlock,
uint32 _cliffReleaseTimestamp,
uint256 _cliffAmount,
uint32 _releaseIntervalSecs,
uint256 _linearVestAmount,
bool _isRevocable
) external onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_recipient | address | - Address of the recipient |
_startTimestamp | uint32 | - Start timestamp of the vesting |
_endTimestamp | uint32 | - End timestamp of the vesting |
_timelock | uint32 | - Timelock for the vesting |
_initialUnlock | uint256 | - Initial unlock amount |
_cliffReleaseTimestamp | uint32 | - Cliff release timestamp |
_cliffAmount | uint256 | - Cliff amount |
_releaseIntervalSecs | uint32 | - Release interval in seconds |
_linearVestAmount | uint256 | - Linear vest amount |
_isRevocable | bool | - Whether the vesting is revocable |
createVestingBatch
Create a batch of vestings
function createVestingBatch(CreateVestingBatchParams calldata params) external onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
params | CreateVestingBatchParams | - Parameters for creating the vesting batch |
fundVesting
Fund an existing vesting schedule
function fundVesting(bytes32 _vestingId, uint256 _fundingAmount) external isVestingActive(_vestingId) onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Identifier of the vesting to fund |
_fundingAmount | uint256 | - Amount of tokens to add as funding |
fundVestingBatch
Fund multiple vestings in batch
function fundVestingBatch(bytes32[] calldata _vestingIds, uint256[] calldata _fundingAmounts) external onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_vestingIds | bytes32[] | - Array of vesting identifiers to fund |
_fundingAmounts | uint256[] | - Array of funding amounts for each vesting |
claim
Claim vested tokens
function claim(bytes32 _vestingId) external payable onlyVestingRecipient(_vestingId);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Identifier of the vesting |
adminClaim
Admin claims vested tokens on behalf of a recipient (gas sponsoring)
function adminClaim(bytes32 _vestingId) external payable onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Identifier of the vesting |
batchAdminClaim
Admin claims vested tokens for multiple recipients (batch gas sponsoring)
function batchAdminClaim(bytes32[] calldata _vestingIds) external payable onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_vestingIds | bytes32[] | - Array of vesting identifiers to claim |
revokeVesting
Revoke active Vesting
function revokeVesting(bytes32 _vestingId) external onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Vesting Identifier |
batchRevokeVestings
Revoke multiple vestings in batch
More gas efficient than calling revokeVesting multiple times
function batchRevokeVestings(bytes32[] calldata _vestingIds) external onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_vestingIds | bytes32[] | - Array of vesting identifiers to revoke |
withdrawAdmin
Allow the owner to withdraw any balance not currently tied up in Vestings
function withdrawAdmin(uint256 _amountRequested) external onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_amountRequested | uint256 | - Amount to withdraw |
withdrawOtherToken
Withdraw a token which isn't controlled by the vesting contract. Useful when someone accidentally sends tokens to the contract
function withdrawOtherToken(address _otherTokenAddress) external onlyAdmin;
Parameters
Name | Type | Description |
---|---|---|
_otherTokenAddress | address | - the token which we want to withdraw |
initiateVestingTransfer
Initiate the transfer of vesting ownership to a new address
function initiateVestingTransfer(bytes32 _vestingId, address _newOwner)
external
onlyVestingRecipient(_vestingId)
isVestingActive(_vestingId);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | The ID of the vesting to transfer |
_newOwner | address | The address of the new owner |
cancelVestingTransfer
Cancel a pending vesting transfer
function cancelVestingTransfer(bytes32 _vestingId) external onlyVestingRecipient(_vestingId);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | The ID of the vesting with a pending transfer |
acceptVestingTransfer
Accept a vesting transfer as the new owner
function acceptVestingTransfer(bytes32 _vestingId) external isVestingActive(_vestingId);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | The ID of the vesting to accept |
directVestingTransfer
Direct transfer of vesting ownership by admin (for contract compatibility)
This is specifically for compatibility with contracts that cannot call acceptVestingTransfer
function directVestingTransfer(bytes32 _vestingId, address _newOwner)
external
onlyVestingRecipient(_vestingId)
isVestingActive(_vestingId);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | The ID of the vesting to transfer |
_newOwner | address | The address of the new owner |
withdrawTokenFee
Allows only fee collector to withdraw collected token fees
This function is completely separate from distributor admin controls
function withdrawTokenFee(address recipient, uint256 amount) external onlyFeeCollector;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | Address to receive the fee |
amount | uint256 | Amount to withdraw, if 0 withdraws all available fees |
withdrawGasFee
Allows only fee collector to withdraw collected gas fees
This function is completely separate from distributor admin controls
function withdrawGasFee(address recipient, uint256 amount) external onlyFeeCollector;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | Address to receive the fee |
amount | uint256 | Amount to withdraw, if 0 withdraws all available fees |
transferFeeCollectorRole
Updates the fee collector address
Can only be called by the fee collector
function transferFeeCollectorRole(address newFeeCollector) external onlyFeeCollector;
Parameters
Name | Type | Description |
---|---|---|
newFeeCollector | address | Address of the new fee collector |
delegate
Delegate voting power of the vesting's Vault
function delegate(bytes32 _vestingId, address _delegatee)
public
onlyVestingRecipient(_vestingId)
isVestingActive(_vestingId);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | The ID of the vesting |
_delegatee | address | The address to delegate voting power to |
delegateBatch
Delegate voting power of multiple vestings' Vaults in batch
function delegateBatch(bytes32[] calldata _vestingIds, address[] calldata _delegatees) external;
Parameters
Name | Type | Description |
---|---|---|
_vestingIds | bytes32[] | The IDs of the vestings |
_delegatees | address[] | The addresses to delegate voting power to |
getVestingFundingInfo
Get funding information for a vesting
function getVestingFundingInfo(bytes32 _vestingId)
external
view
returns (uint8 fundingType, uint256 totalFunded, uint256 totalRequired);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Identifier of the vesting |
Returns
Name | Type | Description |
---|---|---|
fundingType | uint8 | - Type of funding (Full or Partial) |
totalFunded | uint256 | - Total amount of tokens funded so far |
totalRequired | uint256 | - Total amount of tokens required for full funding |
isVestingFullyFunded
Check if a vesting is fully funded
function isVestingFullyFunded(bytes32 _vestingId) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Identifier of the vesting |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isFullyFunded - True if the vesting is fully funded |
getVestingInfo
Get the vesting information
function getVestingInfo(bytes32 _vestingId) external view returns (TokenVestingLib.Vesting memory);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Identifier of the vesting |
Returns
Name | Type | Description |
---|---|---|
<none> | TokenVestingLib.Vesting | vesting - Vesting information |
getVestedAmount
Get the vested amount for a Vesting, at a given timestamp.
function getVestedAmount(bytes32 _vestingId, uint32 _referenceTimestamp) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | |
_referenceTimestamp | uint32 | Timestamp for which we're calculating |
getClaimableAmount
Get the claimable amount for a vesting
function getClaimableAmount(bytes32 _vestingId) external view returns (uint256 claimable);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Identifier of the vesting |
Returns
Name | Type | Description |
---|---|---|
claimable | uint256 | - The amount of tokens that can be claimed at the current time |
getAllRecipients
Get all recipients
function getAllRecipients() external view returns (address[] memory);
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | recipients - The list of recipients |
getAllRecipientsLength
Get the length of all recipients
function getAllRecipientsLength() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | length - The length of all recipients |
getAllRecipientsSliced
Get all recipients in a range
function getAllRecipientsSliced(uint256 _from, uint256 _to) external view returns (address[] memory);
Parameters
Name | Type | Description |
---|---|---|
_from | uint256 | - The start index (inclusive) |
_to | uint256 | - The end index (exclusive) |
Returns
Name | Type | Description |
---|---|---|
<none> | address[] | recipientsSliced - The list of recipients in the range |
getAllRecipientVestings
Get all vestings for a recipient
function getAllRecipientVestings(address _recipient) external view returns (bytes32[] memory);
Parameters
Name | Type | Description |
---|---|---|
_recipient | address | - The recipient address |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32[] | recipientVestings - The list of vestings for the recipient |
getAllRecipientVestingsSliced
Get all vestings for a recipient in a range
function getAllRecipientVestingsSliced(uint256 _from, uint256 _to, address _recipient)
external
view
returns (bytes32[] memory);
Parameters
Name | Type | Description |
---|---|---|
_from | uint256 | - The start index (inclusive) |
_to | uint256 | - The end index (exclusive) |
_recipient | address | - The recipient address |
Returns
Name | Type | Description |
---|---|---|
<none> | bytes32[] | recipientVestingsSliced - The list of vestings for the recipient in the range |
getAllRecipientVestingsLength
Get the length of all vestings for a recipient
function getAllRecipientVestingsLength(address _recipient) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_recipient | address | - The recipient address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | length - The length of all vestings for the recipient |
getPendingVestingTransfer
Get the pending owner for a vesting transfer
function getPendingVestingTransfer(bytes32 _vestingId) external view returns (address);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | The ID of the vesting |
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of the pending owner if there is one, or zero address |
amountAvailableToWithdrawByAdmin
Amount of tokens available to withdraw by the admin
function amountAvailableToWithdrawByAdmin() public view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The amount of tokens available to withdraw |
isRecipient
Check if a recipient has vestings
function isRecipient(address recipient) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | - The recipient address |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | isRecipient - True if the recipient has vestings |
_createVesting
Internal function to create a new vesting and deploy its vault
function _createVesting(TokenVestingLib.VestingParams memory params) internal returns (address vaultProxy);
Parameters
Name | Type | Description |
---|---|---|
params | TokenVestingLib.VestingParams | - Vesting parameters |
Returns
Name | Type | Description |
---|---|---|
vaultProxy | address | The address of the deployed and initialized Vault proxy. |
_deployAndInitializeVault
Deploys and initializes a new Vault proxy for a vesting schedule.
function _deployAndInitializeVault(address _recipient) internal returns (address vaultProxy);
Parameters
Name | Type | Description |
---|---|---|
_recipient | address | The beneficiary of the vesting schedule. |
Returns
Name | Type | Description |
---|---|---|
vaultProxy | address | The address of the deployed and initialized Vault proxy. |
_claim
Internal function to claim vested tokens
function _claim(bytes32 _vestingId) internal;
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Identifier of the vesting |
_revokeVesting
Internal function to revoke a vesting
function _revokeVesting(bytes32 _vestingId) internal isVestingActive(_vestingId);
Parameters
Name | Type | Description |
---|---|---|
_vestingId | bytes32 | - Vesting Identifier |
_removeVestingFromRecipient
Helper function to remove a vesting ID from a recipient's array
function _removeVestingFromRecipient(address _recipient, bytes32 _vestingId) internal;
Parameters
Name | Type | Description |
---|---|---|
_recipient | address | The address of the recipient |
_vestingId | bytes32 | The ID of the vesting to remove |
_removeRecipient
Helper function to remove a recipient from the recipients array
function _removeRecipient(address _recipient) internal;
Parameters
Name | Type | Description |
---|---|---|
_recipient | address | The address of the recipient to remove |
_isRecipient
Internal function to check if an address is a recipient
function _isRecipient(address recipient) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The address to check |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | True if the address is a recipient, false otherwise |
_checkArrayLengthMismatch
Internal function to check if all array lengths in batch params match the expected length
function _checkArrayLengthMismatch(CreateVestingBatchParams calldata params, uint256 expectedLength) internal pure;
Parameters
Name | Type | Description |
---|---|---|
params | CreateVestingBatchParams | - Batch parameters to validate |
expectedLength | uint256 | - The expected length all arrays should match |