Vesting-Escrow-Wallet
Vesting Escrow Wallet
Introduced in
2.1.0
Contract name
VestingEscrowWallet.sol
Compatible protocol version
^3.0.0
Type
Wallet Module
How it works
This module will allow approved staff to create a token (ST) vesting schedule for employees and/or affiliates so that tokens get delivered to their wallets as contractually defined. Admin can send tokens to and then select the address that would be able to withdraw them according to their specific vesting schedule.
Key functionalities (as defined in the Smart Contract)
Initialization
This module should be configured by the treasury wallet address. You will need to call the configure function of this contract during creation. Note that the treasury wallet can be changed later by the owner.
Managing templates
The Admin can add a new template or delete an existing template (if a template isn’t used by any schedule) at any time using the following functions:
Adding a Template
This function is used to add a template, without the given beneficiary address. This template can be reused by the issuer for the different beneficiary addresses.
Required checks
Template name shouldn’t be empty
*
_name
should be unique.number of tokens should be greater than zero.
_frequency
should be the factor of duration._periodCount
should be the factor of the_numberOfTokens
.granularity of the token
should be the factor ofamountPerPeriod
.
Removing template
This function is used to remove templates and their respective names. Note: Please take into consideration that the template can't be removed if at least one schedule already uses it. /**
@notice Removes template with a given name
@param _name Name of the template that will be removed
*/
function removeTemplate(bytes32 _name) external withPerm(ADMIN)
Required checks
The template should already exist in the contract storage.
The template shouldn’t be used by any schedules.
Managing schedules
These functions allow for the admin/issuer to add a new schedule, modify or revoke existing schedule at any time using the following functions:
Add Schedule
This function is used for creating vesting schedules for each beneficiary.
Required checks
The beneficiary address shouldn’t be empty.
Template name shouldn’t be empty.
Template name should be unique.
Number of tokens should be positive value.
Frequency should be a factor of the duration.
Period count should be factor of
_numberOfTokens
.Granularity should be the factor of
amountPerPeriod
Schedule with an appropriate template name shouldn’t be added to the beneficiary address
Startime shouldn’t be in the past
Add Schedule Multi
This function is used to bulk add respective vesting schedules for each of the beneficiaries.
Required checks
All restrictions are same as above.
All arrays should have the same length
Adding Schedule From Template
This function is for adding vesting schedules from a template for each beneficiary.
Required checks
The beneficiary address shouldn’t be empty.
Template should be already created
Schedule with an appropriate template name shouldn’t be added to the beneficiary address
startTime shouldn’t be in the past
Add Schedule From Template Multi
This function is used to bulk add the vesting schedules from a template for each of the beneficiaries.
Required checks
The same restrictions applied as above.
All arrays should have the same length
Revoking schedule
This function is used to revoke a beneficiary’s schedule.
Required checks
The beneficiary address shouldn’t be empty
Schedule with the given template name should be already added to the beneficiary address
Revoking Schedules Multi
This function is used to bulk revoke vesting schedules for each of the beneficiaries.
Revoke all schedules
This function is used to revoke all of the beneficiaries'schedules.
Required checks
Beneficiary address shouldn’t be empty
Modify Schedule
This function is used to modify vesting schedules for each beneficiary. Note that only the start time for the schedule can be changed. If you need to modify other fields you have to remove and then add a schedule.
Required checks
The beneficiary address shouldn’t be empty
Schedule with the given template name should be already added to the beneficiary address
startTime shouldn’t be in the past
Given schedule shouldn’t be already started
Modify Schedule Multi
This function is used to bulk modify vesting schedules for each of the beneficiaries.
Required checks
All arrays should have the same length
Depositing/withdrawing tokens
An admin/issuer can deposit tokens to the wallet and withdraw tokens from it. Depositing can be done by any delegate using an account with tokens. On the other hand, when tokens get withdraw from the contract, the receiver always is the treasury wallet.
Deposit Tokens
This function used for the issuer to deposit tokens from their treasury.
Required checks
_numberOf Tokens
should be a positive value
Send To Treasury
This function allows the issuer to send the unassigned tokens to their treasury.
Required checks
_amount
should be greater than zero._amount
shouldn’t be greater than unassigned tokens.
Change Treasury Wallet
This function is used to change the treasury wallet address. Please note that only the issuer can change the treasury wallet.
Required checks
Treasury wallet address shouldn’t be empty
Push Available Tokens
This function allows the issuer to push available tokens to the respective beneficiaries.This function is used when any employee/beneficiary did not withdraw its available tokens then issuer/admin has the right to forcefully push the tokens to the beneficiary address.
Pull Available Tokens
This function allows beneficiaries to withdraw available tokens as per their schedule calculations.
Push Available Tokens Multi
This function allows the issuer to bulk send available tokens for each beneficiary. To avoid out of gas
issue we are using the indexing process so the issuer can push tokens to given index range.
Required checks
_toIndex
should be within the bounds of the beneficiary array
Getters
Get schedule data
This function is called to return a specific beneficiary’s schedule.
Getting Template Names
This function is used to return a list of template names as well as for which have been used for schedule creation for some beneficiaries.
Required checks
Beneficiary address shouldn’t be empty
Get schedule count
This function is used to return the count of a beneficiary’s schedules.
Required checks
Beneficiary address shouldn’t be empty
Get schedule count by template
It returns schedule count for a given template.
Get template count
This function returns the count of the templates contract has.
Get template names
This function allows the issuer to get a list of the template names that they have set up.
Get treasury wallet
This function allows to retrieves the treasury wallet address. If VEW
has its own treasury wallet address then this function returns that otherwise, it returns the global treasury wallet address.
Get all beneficiaries
Returns the list of beneficiaries.
Get Available tokens
Returns the quantity of the token that can be withdrawn from the contract at the moment.
Last updated
Was this helpful?