Wallet for core vesting escrow functionality (VestingEscrowWallet.sol)

View Source: contracts/modules/Wallet/VestingEscrowWallet.solโ€‹

โ†— Extends: VestingEscrowWalletStorage, Walletโ€‹

VestingEscrowWallet

Enums

State

enum State {
CREATED,
STARTED,
COMPLETED
}

Events

event AddSchedule(address indexed _beneficiary, bytes32 _templateName, uint256 _startTime);
event ModifySchedule(address indexed _beneficiary, bytes32 _templateName, uint256 _startTime);
event RevokeAllSchedules(address indexed _beneficiary);
event RevokeSchedule(address indexed _beneficiary, bytes32 _templateName);
event DepositTokens(uint256 _numberOfTokens, address _sender);
event SendToTreasury(uint256 _numberOfTokens, address _sender);
event SendTokens(address indexed _beneficiary, uint256 _numberOfTokens);
event AddTemplate(bytes32 _name, uint256 _numberOfTokens, uint256 _duration, uint256 _frequency);
event RemoveTemplate(bytes32 _name);
event TreasuryWalletChanged(address _newWallet, address _oldWallet);

Functions

Constructor

function (address _securityToken, address _polyAddress) public nonpayable Module

Arguments

Name

Type

Description

_securityToken

address

Address of the security token

_polyAddress

address

Address of the polytoken

getInitFunction

โคพ overrides IModule.getInitFunctionโ€‹

This function returns the signature of the configure function

function getInitFunction() public pure
returns(bytes4)

Arguments

Name

Type

Description

configure

Used to initialize the treasury wallet address

function configure(address _treasuryWallet) public nonpayable onlyFactory

Arguments

Name

Type

Description

_treasuryWallet

address

Address of the treasury wallet

changeTreasuryWallet

Used to change the treasury wallet address

function changeTreasuryWallet(address _newTreasuryWallet) public nonpayable

Arguments

Name

Type

Description

_newTreasuryWallet

address

Address of the treasury wallet

_setWallet

function _setWallet(address _newTreasuryWallet) internal nonpayable

Arguments

Name

Type

Description

_newTreasuryWallet

address

โ€‹

depositTokens

Used to deposit tokens from treasury wallet to the vesting escrow wallet

function depositTokens(uint256 _numberOfTokens) external nonpayable withPerm

Arguments

Name

Type

Description

_numberOfTokens

uint256

Number of tokens that should be deposited

_depositTokens

function _depositTokens(uint256 _numberOfTokens) internal nonpayable

Arguments

Name

Type

Description

_numberOfTokens

uint256

โ€‹

sendToTreasury

Sends unassigned tokens to the treasury wallet

function sendToTreasury(uint256 _amount) public nonpayable withPerm

Arguments

Name

Type

Description

_amount

uint256

Amount of tokens that should be send to the treasury wallet

getTreasuryWallet

Returns the treasury wallet address

function getTreasuryWallet() public view
returns(address)

Arguments

Name

Type

Description

pushAvailableTokens

Pushes available tokens to the beneficiary's address

function pushAvailableTokens(address _beneficiary) public nonpayable withPerm

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary who will receive tokens

pullAvailableTokens

Used to withdraw available tokens by beneficiary

function pullAvailableTokens() external nonpayable whenNotPaused

Arguments

Name

Type

Description

addTemplate

Adds template that can be used for creating schedule

function addTemplate(bytes32 _name, uint256 _numberOfTokens, uint256 _duration, uint256 _frequency) external nonpayable withPerm

Arguments

Name

Type

Description

_name

bytes32

Name of the template will be created

_numberOfTokens

uint256

Number of tokens that should be assigned to schedule

_duration

uint256

Duration of the vesting schedule

_frequency

uint256

Frequency of the vesting schedule

_addTemplate

function _addTemplate(bytes32 _name, uint256 _numberOfTokens, uint256 _duration, uint256 _frequency) internal nonpayable

Arguments

Name

Type

Description

_name

bytes32

โ€‹

_numberOfTokens

uint256

โ€‹

_duration

uint256

โ€‹

_frequency

uint256

โ€‹

removeTemplate

Removes template with a given name

function removeTemplate(bytes32 _name) external nonpayable withPerm

Arguments

Name

Type

Description

_name

bytes32

Name of the template that will be removed

getTemplateCount

Returns count of the templates those can be used for creating schedule

function getTemplateCount() external view
returns(uint256)

Returns

Count of the templates

Arguments

Name

Type

Description

getAllTemplateNames

Gets the list of the template names those can be used for creating schedule

function getAllTemplateNames() external view
returns(bytes32[])

Returns

bytes32 Array of all template names were created

Arguments

Name

Type

Description

addSchedule

Adds vesting schedules for each of the beneficiary's address

function addSchedule(address _beneficiary, bytes32 _templateName, uint256 _numberOfTokens, uint256 _duration, uint256 _frequency, uint256 _startTime) external nonpayable withPerm

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary for whom it is scheduled

_templateName

bytes32

Name of the template that will be created

_numberOfTokens

uint256

Total number of tokens for created schedule

_duration

uint256

Duration of the created vesting schedule

_frequency

uint256

Frequency of the created vesting schedule

_startTime

uint256

Start time of the created vesting schedule

_addSchedule

function _addSchedule(address _beneficiary, bytes32 _templateName, uint256 _numberOfTokens, uint256 _duration, uint256 _frequency, uint256 _startTime) internal nonpayable

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_templateName

bytes32

โ€‹

_numberOfTokens

uint256

โ€‹

_duration

uint256

โ€‹

_frequency

uint256

โ€‹

_startTime

uint256

โ€‹

addScheduleFromTemplate

Adds vesting schedules from template for the beneficiary

function addScheduleFromTemplate(address _beneficiary, bytes32 _templateName, uint256 _startTime) external nonpayable withPerm

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary for whom it is scheduled

_templateName

bytes32

Name of the exists template

_startTime

uint256

Start time of the created vesting schedule

_addScheduleFromTemplate

function _addScheduleFromTemplate(address _beneficiary, bytes32 _templateName, uint256 _startTime) internal nonpayable

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_templateName

bytes32

โ€‹

_startTime

uint256

โ€‹

modifySchedule

Modifies vesting schedules for each of the beneficiary

function modifySchedule(address _beneficiary, bytes32 _templateName, uint256 _startTime) external nonpayable withPerm

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary for whom it is modified

_templateName

bytes32

Name of the template was used for schedule creation

_startTime

uint256

Start time of the created vesting schedule

_modifySchedule

function _modifySchedule(address _beneficiary, bytes32 _templateName, uint256 _startTime) internal nonpayable

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_templateName

bytes32

โ€‹

_startTime

uint256

โ€‹

revokeSchedule

Revokes vesting schedule with given template name for given beneficiary

function revokeSchedule(address _beneficiary, bytes32 _templateName) external nonpayable withPerm

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary for whom it is revoked

_templateName

bytes32

Name of the template was used for schedule creation

_deleteUserToTemplates

function _deleteUserToTemplates(address _beneficiary, bytes32 _templateName) internal nonpayable

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_templateName

bytes32

โ€‹

_deleteTemplateToUsers

function _deleteTemplateToUsers(address _beneficiary, bytes32 _templateName) internal nonpayable

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_templateName

bytes32

โ€‹

revokeAllSchedules

Revokes all vesting schedules for given beneficiary's address

function revokeAllSchedules(address _beneficiary) public nonpayable withPerm

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary for whom all schedules will be revoked

_revokeAllSchedules

function _revokeAllSchedules(address _beneficiary) internal nonpayable

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

getSchedule

Returns beneficiary's schedule created using template name

function getSchedule(address _beneficiary, bytes32 _templateName) external view
returns(uint256, uint256, uint256, uint256, uint256, enum VestingEscrowWallet.State)

Returns

beneficiary's schedule data (numberOfTokens, duration, frequency, startTime, claimedTokens, State)

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary who will receive tokens

_templateName

bytes32

Name of the template was used for schedule creation

_getScheduleState

function _getScheduleState(address _beneficiary, bytes32 _templateName) internal view
returns(enum VestingEscrowWallet.State)

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_templateName

bytes32

โ€‹

getTemplateNames

Returns list of the template names for given beneficiary's address

function getTemplateNames(address _beneficiary) external view
returns(bytes32[])

Returns

List of the template names that were used for schedule creation

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary

getScheduleCount

Returns count of the schedules were created for given beneficiary

function getScheduleCount(address _beneficiary) external view
returns(uint256)

Returns

Count of beneficiary's schedules

Arguments

Name

Type

Description

_beneficiary

address

Address of the beneficiary

_getAvailableTokens

function _getAvailableTokens(address _beneficiary, uint256 _index) internal view
returns(uint256)

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_index

uint256

โ€‹

_getReleasedTokens

function _getReleasedTokens(address _beneficiary, uint256 _index) internal view
returns(uint256)

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_index

uint256

โ€‹

pushAvailableTokensMulti

Used to bulk send available tokens for each of the beneficiaries

function pushAvailableTokensMulti(uint256 _fromIndex, uint256 _toIndex) public nonpayable withPerm

Arguments

Name

Type

Description

_fromIndex

uint256

Start index of array of beneficiary's addresses

_toIndex

uint256

End index of array of beneficiary's addresses

addScheduleMulti

Used to bulk add vesting schedules for each of beneficiary

function addScheduleMulti(address[] _beneficiaries, bytes32[] _templateNames, uint256[] _numberOfTokens, uint256[] _durations, uint256[] _frequencies, uint256[] _startTimes) public nonpayable withPerm

Arguments

Name

Type

Description

_beneficiaries

address[]

Array of the beneficiary's addresses

_templateNames

bytes32[]

Array of the template names

_numberOfTokens

uint256[]

Array of number of tokens should be assigned to schedules

_durations

uint256[]

Array of the vesting duration

_frequencies

uint256[]

Array of the vesting frequency

_startTimes

uint256[]

Array of the vesting start time

addScheduleFromTemplateMulti

Used to bulk add vesting schedules from template for each of the beneficiary

function addScheduleFromTemplateMulti(address[] _beneficiaries, bytes32[] _templateNames, uint256[] _startTimes) public nonpayable withPerm

Arguments

Name

Type

Description

_beneficiaries

address[]

Array of beneficiary's addresses

_templateNames

bytes32[]

Array of the template names were used for schedule creation

_startTimes

uint256[]

Array of the vesting start time

revokeSchedulesMulti

Used to bulk revoke vesting schedules for each of the beneficiaries

function revokeSchedulesMulti(address[] _beneficiaries) public nonpayable withPerm

Arguments

Name

Type

Description

_beneficiaries

address[]

Array of the beneficiary's addresses

modifyScheduleMulti

Used to bulk modify vesting schedules for each of the beneficiaries

function modifyScheduleMulti(address[] _beneficiaries, bytes32[] _templateNames, uint256[] _startTimes) public nonpayable withPerm

Arguments

Name

Type

Description

_beneficiaries

address[]

Array of the beneficiary's addresses

_templateNames

bytes32[]

Array of the template names

_startTimes

uint256[]

Array of the vesting start time

_checkSchedule

function _checkSchedule(address _beneficiary, bytes32 _templateName) internal view

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_templateName

bytes32

โ€‹

_isTemplateExists

function _isTemplateExists(bytes32 _name) internal view
returns(bool)

Arguments

Name

Type

Description

_name

bytes32

โ€‹

_validateTemplate

function _validateTemplate(uint256 _numberOfTokens, uint256 _duration, uint256 _frequency) internal view

Arguments

Name

Type

Description

_numberOfTokens

uint256

โ€‹

_duration

uint256

โ€‹

_frequency

uint256

โ€‹

_sendTokens

function _sendTokens(address _beneficiary) internal nonpayable

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_sendTokensPerSchedule

function _sendTokensPerSchedule(address _beneficiary, uint256 _index) internal nonpayable

Arguments

Name

Type

Description

_beneficiary

address

โ€‹

_index

uint256

โ€‹

getPermissions

โคพ overrides IModule.getPermissionsโ€‹

Return the permissions flag that are associated with VestingEscrowWallet

function getPermissions() public view
returns(bytes32[])

Arguments

Name

Type

Description