Skip to main content

vesting

IVesting

Contents

Functions

addInvestor

📋    Add investor and receivable amount for future claiming

Can be called only before vesting process starts. If called twice for the same investor, the second call overwrites the data

Declaration
  function addInvestor(
address investor,
uint256 amount,
uint256 iuPercent
) external
Args:
ArgTypeDescription
investoraddressAddress of investor
amountuint256Tokens amount which investor should receive in general
iuPercentuint256Which percent of tokens should be available immediately after vesting cliff (represented with 2 decimals: 1000 = 10.00%)

addInvestors

📋    The same as addInvestor, but for multiple investors

Provided arrays should have the same length

Declaration
  function addInvestors(
address[] investors,
uint256[] amounts,
uint256 iuPercent
) external
Args:
ArgTypeDescription
investorsaddress[]Array of investors
amountsuint256[]Array of receivable amounts
iuPercentuint256Which percent of tokens should be available immediately after vesting cliff (represented with 2 decimals: 1000 = 10.00%)

removeInvestor

📋    Remove investor

Declaration
  function removeInvestor(
address investor
) external
Args:
ArgTypeDescription
investoraddressAddress of investor

claimIuTokens

📋    Claim Initial Unlock tokens immediately after vesting cliff

Can be called once for each investor

Declaration
  function claimIuTokens(
) external

claimLockedTokens

📋    Claim locked tokens

Declaration
  function claimLockedTokens(
) external

getToPayTokens

📋    Get total amount of tokens this contract will pay investors after vesting is started

NOTE: toPayTokens is not updated when tokens are transferred to investors

Declaration
  function getToPayTokens(
) external returns (uint256)
Returns:
TypeDescription
uint256Total tokens

getReleasableLockedTokens

📋    Get current available locked tokens

Declaration
  function getReleasableLockedTokens(
address investor
) external returns (uint256)
Args:
ArgTypeDescription
investoraddressaddress
Returns:
TypeDescription
uint256Amount of tokens ready to be released

getInvestorData

📋    Get investor data

Declaration
  function getInvestorData(
address investor
) external returns (uint256 iuAmount, uint256 releasedLockedTokens, uint256 totalLockedTokens)
Args:
ArgTypeDescription
investoraddressaddress
Returns:
TypeDescription
iuAmountuint256 Initial Unlock token amount
releasedLockedTokensuint256 Released tokens
totalLockedTokensuint256 Total locked tokens

getStartTime

📋    Get vesting start time

Declaration
  function getStartTime(
) external returns (uint256)
Returns:
TypeDescription
uint256start time in seconds from epoch

getPeriodDays

📋    Get vesting period in days

Declaration
  function getPeriodDays(
) external returns (uint256)
Returns:
TypeDescription
uint256vesting period in days

getCliffDays

📋    Get vesting cliff in days

Declaration
  function getCliffDays(
) external returns (uint256)
Returns:
TypeDescription
uint256vesting cliff in days

getClaimingIntervalDays

📋    Get claiming interval in days

Declaration
  function getClaimingIntervalDays(
) external returns (uint256)
Returns:
TypeDescription
uint256claiming interval in days

Events

TokensReceived

📋    An investor received tokens

Params:
ParamTypeIndexedDescription
investoraddressAddress of investor, who received tokens
amountuint256Amount of tokens received
isLockedTokensboolWhether received tokens were locked- or iu-tokens

Vesting

Vesting smart contract allows to grand investors their tokens gradually during some period of time. Before vesting starts, an admin must verify that Vesting smart contract has enough tokens on vesting token (ERC20) balance. Tokens can be claimed whenever convenient, though new tokens are released once per specified Claiming interval. Thus, there would be no available tokens right after previous claiming. Vesting process is linear, meaning that for equal periods of time investors will receive equal amount of tokens (except for vesting cliff). During Vesting cliff no tokens are released. E.g. for 10 days vesting cliff, investors can receive their tokens on 11th day. Initial Unlock (IU) tokens are tokens granted to investors right after cliff date. Claiming interval is a time frequency when users can claim their tokens. If interval is equal 30 days, new tokens will be released and available for claiming every 30 days after cliff date.

To deploy a contract one need to specify address of ERC20 token, which will be vested, vesting start (seconds since epoch time), vesting period (in days), vesting cliff (in days) and claiming interval (in days). To add an investor an admin must specify their address, vesting token amount and percentage of IU tokens of that amount.

NOTE: Investors can be added only before vesting starts. NOTE: Contract is upgradeable to ensure if any security issues are found, they can be patched right away.

Contents

Globals

VarTypeDescription
startuint256
enduint256
periodDaysuint256
cliffDateuint256
claimingIntervalDaysuint256
toPayTokensuint256
RATE_BASEuint256
tokencontract IERC20
_investorsmapping(address => struct Vesting.Investor)

Functions

initialize

📋    initialize function to support upgrading

Declaration
  function initialize(
) public initializer
Modifiers:
Modifier
initializer

addInvestor

📋    Add investor and receivable amount for future claiming

Can be called only before vesting process starts. If called twice for the same investor, the second call overwrites the data

Declaration
  function addInvestor(
address investor,
uint256 amount,
uint256 iuPercent
) public onlyOwner
Modifiers:
Modifier
onlyOwner
Args:
ArgTypeDescription
investoraddressAddress of investor
amountuint256Tokens amount which investor should receive in general
iuPercentuint256Which percent of tokens should be available immediately after vesting cliff (represented with 2 decimals: 1000 = 10.00%)

addInvestors

📋    The same as addInvestor, but for multiple investors

Provided arrays should have the same length

Declaration
  function addInvestors(
address[] investors,
uint256[] amounts,
uint256 iuPercent
) external onlyOwner
Modifiers:
Modifier
onlyOwner
Args:
ArgTypeDescription
investorsaddress[]Array of investors
amountsuint256[]Array of receivable amounts
iuPercentuint256Which percent of tokens should be available immediately after vesting cliff (represented with 2 decimals: 1000 = 10.00%)

removeInvestor

📋    Remove investor

Declaration
  function removeInvestor(
address investor
) public onlyOwner
Modifiers:
Modifier
onlyOwner
Args:
ArgTypeDescription
investoraddressAddress of investor

claimIuTokens

📋    Claim Initial Unlock tokens immediately after vesting cliff

Can be called once for each investor

Declaration
  function claimIuTokens(
) external

claimLockedTokens

📋    Claim locked tokens

Declaration
  function claimLockedTokens(
) external

getToPayTokens

📋    Get total amount of tokens this contract will pay investors after vesting is started

NOTE: toPayTokens is not updated when tokens are transferred to investors

Declaration
  function getToPayTokens(
) external returns (uint256)
Returns:
TypeDescription
uint256Total tokens

getReleasableLockedTokens

📋    Get current available locked tokens

Declaration
  function getReleasableLockedTokens(
address investor
) external returns (uint256)
Args:
ArgTypeDescription
investoraddressaddress
Returns:
TypeDescription
uint256Amount of tokens ready to be released

getInvestorData

📋    Get investor data

Declaration
  function getInvestorData(
address investor
) external returns (uint256 iuAmount, uint256 releasedLockedTokens, uint256 totalLockedTokens)
Args:
ArgTypeDescription
investoraddressaddress
Returns:
TypeDescription
iuAmountuint256 Initial Unlock token amount
releasedLockedTokensuint256 Released tokens
totalLockedTokensuint256 Total locked tokens

getStartTime

📋    Get vesting start time

Declaration
  function getStartTime(
) external returns (uint256)
Returns:
TypeDescription
uint256start time in seconds from epoch

getPeriodDays

📋    Get vesting period in days

Declaration
  function getPeriodDays(
) external returns (uint256)
Returns:
TypeDescription
uint256vesting pedion in days

getCliffDays

📋    Get vesting cliff in days

Declaration
  function getCliffDays(
) external returns (uint256)
Returns:
TypeDescription
uint256vesting cliff in days

getClaimingIntervalDays

📋    Get claiming interval in days

Declaration
  function getClaimingIntervalDays(
) external returns (uint256)
Returns:
TypeDescription
uint256claiming interval in days