Vesting
Technical Reference
Token Vesting

Token Vesting

Functions Write

PayForFreeTokenLocks

function payForFreeTokenLocks(
    address _token
) external payable

Permits to pay a once off fee to have free use of the lockers for the token.

Parameters:
NameTypeDescription
_tokenaddressThe address of the token to be locked for free.

EditZeroFeeWhitelist

function editZeroFeeWhitelist(
    address _token,
    bool _add
) external

Callable by UNCX_ADMINS or whitelisted contracts.

Parameters:
NameTypeDescription
_tokenaddressThe address of the token to be added or removed from the whitelist.
_addboolIndicates if the token should be added (true) or removed (false) from the whitelist.

Lock

function lock(
    address _token,
    LockParams[] calldata _lock_params
) external

Creates one or multiple locks for the specified token.

Parameters:
TypeDescription
LockParamsAn object that contains: owner (address), amount (uint256), startEmission (uint256), endEmission (uint256), and condition (address).

Withdraw

function withdraw(
    uint256 _lockID,
    uint256 _amount
) external

Withdraws a specified amount from a lock.

Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock from which tokens will be withdrawn.
_amountuint256The desired amount of tokens to be withdrawn.

Relock

function relock(uint256 _lockID, uint256 _unlock_date) external

Extends a lock with a new unlock date, if lock is Type 2 it extends the emission end date.

Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock which needs to have its unlock date extended.
_unlock_dateuint256The new unlock date. If the lock is Type 2, this extends the emission end date.

IncrementLock

function incrementLock(
    uint256 _lockID, 
    uint256 _amount
) external 

Increases the amount of tokens per a specific lock.

Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock which will have its token amount increased.
_amountuint256The amount of additional tokens to be added to the specified lock.

TransferLockOwnership

function transferLockOwnership(
    uint256 _lockID, 
    address payable _newOwner
) external 

Transfers a lock to a new owner.

Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock whose ownership will be transferred.
_newOwneraddress payableThe address of the new owner to whom the lock will be transferred.

SplitLock

function splitLock(
    uint256 _lockID, 
    uint256 _amount
) external 

Splits a lock into two seperate locks.

Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock which will be split.
_amountuint256The amount in tokens which will form one part of the split lock.

Migrate

function migrate(
    uint256 _lockID, 
    uint256 _option
) external 

Migrates to the next locker version.

Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock which will be migrated to the next locker version.
_optionuint256An option for migration. The exact meaning would depend on the migration logic.

RevokeCondition

function revokeCondition(
    uint256 _lockID
) external 

Revokes premature unlock conditions.

Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock whose premature unlock condition will be revoked.

Functions View

TestCondition

function testCondition (address condition) external view returns (bool)
Parameters:
NameTypeDescription
conditionaddressThe condition's address to test on the frontend UI.
Return Values:
TypeDescription
boolThe result of the condition tested in the frontend UI.

GetWithdrawableShares

function getWithdrawableShares (uint256 _lockID) public view returns (uint256)
Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock for which shares are being queried.
Return Values:
TypeDescription
uint256The withdrawable share amount from the lock.

GetWithdrawableTokens

function getWithdrawableTokens (uint256 _lockID) external view returns (uint256)
Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock for which tokens are being queried.
Return Values:
TypeDescription
uint256The current amount in tokens that can be withdrawn.

ConvertSharesToTokens

function convertSharesToTokens (address _token, uint256 _shares) external view returns (uint256)
Parameters:
NameTypeDescription
_tokenaddressThe token's address.
_sharesuint256The number of shares to convert.
Return Values:
TypeDescription
uint256The equivalent amount of tokens for the provided shares.

convertTokensToShares

function convertTokensToShares (address _token, uint256 _tokens) external view returns (uint256)
Parameters:
NameTypeDescription
_tokenaddressThe token's address.
_tokensuint256The number of tokens to convert.
Return Values:
TypeDescription
uint256The equivalent amount of shares for the provided tokens.

GetLock

 function getLock (
    uint256 _lockID
) external view returns (
    uint256, address, 
    uint256, uint256, 
    uint256, uint256, 
    uint256, uint256, 
    address, address
)
Parameters:
NameTypeDescription
_lockIDuint256The ID of the lock being queried.
Return Values:

GetNumLockedTokens

function getNumLockedTokens () external view returns (uint256)
Return Values:
TypeDescription
uint256Number of locked tokens.

GetTokenAtIndex

function getTokenAtIndex (uint256 _index) external view returns (address) 
Parameters:
NameTypeDescription
_indexuint256The index of the token queried.
Return Values:
TypeDescription
addressToken's address at the given index.

GetTokenLocksLength

function getTokenLocksLength (address _token) external view returns (uint256)
Parameters:
NameTypeDescription
_tokenaddressThe token's address.
Return Values:
TypeDescription
uint256Token Lock ID at the specified index.

GetTokenLockIDAtIndex

function getTokenLockIDAtIndex (address _token, uint256 _index) external view returns (uint256)
Parameters:
NameTypeDescription
_tokenaddressThe token's address.
_indexuint256The index of the lock queried.
Return Values:
TypeDescription
uint256Token Lock ID at the specified index.

GetUserLockedTokensLength

function getUserLockedTokensLength (address _user) external view returns (uint256)
Parameters:
NameTypeDescription
_useraddressThe user's address queried.
Return Values:
TypeDescription
uint256Number of tokens locked by the user.

GetUserLockedTokenAtIndex

function getUserLockedTokenAtIndex (address _user, uint256 _index) external view returns (address)
Parameters:
NameTypeDescription
_useraddressThe user's address queried.
_indexuint256The index of the token queried.
Return Values:
TypeDescription
addressToken address at the specified index for the user.

GetUserLocksForTokenLength

function getUserLocksForTokenLength (address _user, address _token) external view returns (uint256)
Parameters:
NameTypeDescription
_useraddressThe user's address.
_tokenaddressThe token's address.
Return Values:
TypeDescription
uint256Number of locks for a token for the user.

GetUserLockIDForTokenAtIndex

function getUserLockIDForTokenAtIndex (address _user, address _token, uint256 _index) external view returns (uint256)
Parameters:
NameTypeDescription
_useraddressThe user's address.
_tokenaddressThe token's address.
_indexuint256The index of the lock queried.
Return Values:
TypeDescription
uint256Lock ID for a token at the specified index for the user.

GetZeroFeeTokensLength

function getZeroFeeTokensLength () external view returns (uint256)
Return Values:
TypeDescription
uint256Length of no fee tokens.

GetZeroFeeTokenAtIndex

function getZeroFeeTokensLength () external view returns (uint256)
Parameters:
NameTypeDescription
_indexuint256The index of the token queried.
Return Values:
TypeDescription
addressNo fee token at the given index.

TokenOnZeroFeeWhitelist

function tokenOnZeroFeeWhitelist (address _token) external view returns (bool)
Parameters:
NameTypeDescription
_tokenaddressThe token's address.
Return Values:
TypeDescription
boolWhether the token is on the no fee whitelist.

GetTokenWhitelisterLength

function getTokenWhitelisterLength () external view returns (uint256)
Return Values:
TypeDescription
uint256Length of token whitelisters.

GetTokenWhitelisterAtIndex

function getTokenWhitelisterAtIndex (uint256 _index) external view returns (address)
Parameters:
NameTypeDescription
_indexuint256The index of the whitelister queried.
Return Values:
TypeDescription
addressToken whitelister at the given index.

GetTokenWhitelisterStatus

function getTokenWhitelisterStatus (address _user) external view returns (bool)
Parameters:
NameTypeDescription
_useraddressThe user's address whose status is queried.
Return Values:
TypeDescription
boolWhitelister status of the specified user.

Events

OnLock

event onLock(
    uint256 lockID, 
    address token, 
    address owner, 
    uint256 amountInTokens, 
    uint256 amountInShares, 
    uint256 startEmission, 
    uint256 endEmission, 
    address unlockCondition
)
Parameters:
NameTypeDescription
lockIDuint256ID of the lock.
tokenaddressToken address.
owneraddressAddress of the lock owner.
amountInTokensuint256Amount of tokens in the lock.
amountInSharesuint256Amount of shares in the lock.
startEmissionuint256Start time of emission.
endEmissionuint256End time of emission.
unlockConditionaddressAddress of the unlock condition contract.

OnWithdraw

event onWithdraw(
    uint256 lockID, 
    address lpToken, 
    uint256 amountInTokens, 
    uint256 amountInShares
)
Parameters:
NameTypeDescription
lockIDuint256ID of the lock.
lpTokenaddressLP token address.
amountInTokensuint256Amount of tokens withdrawn.
amountInSharesuint256Amount of shares withdrawn.

OnRelock

event onRelock(
    uint256 lockID, 
    address token, 
    uint256 unlockDate
)
Parameters:
NameTypeDescription
lockIDuint256ID of the lock.
tokenaddressToken address.
unlockDateuint256New unlock date.

OnTransferLock

event onTransferLock(
    uint256 lockIDFrom, 
    uint256 lockIDto, 
    address oldOwner, 
    address newOwner
)
Parameters:
NameTypeDescription
lockIDFromuint256Original lock ID.
lockIDtouint256New lock ID.
oldOwneraddressOriginal owner of the lock.
newOwneraddressNew owner of the lock.

OnSplitLock

event onSplitLock(
    uint256 fromLockID, 
    uint256 toLockID, 
    uint256 amountInTokens, 
    uint256 amountInShares
)
Parameters:
NameTypeDescription
fromLockIDuint256Original lock ID.
toLockIDuint256New lock ID after split.
amountInTokensuint256Amount of tokens in the new lock.
amountInSharesuint256Amount of shares in the new lock.

OnMigrate

event onMigrate(
    uint256 lockID, 
    uint256 amountInTokens
)
Parameters:
NameTypeDescription
lockIDuint256ID of the lock being migrated.
amountInTokensuint256Amount of tokens being migrated.

OnConditionRevoke

event onConditionRevoke(
    uint256 lockID, 
    address tokenAddress
)
Parameters:
NameTypeDescription
lockIDuint256ID of the lock.
tokenAddressaddressToken address of the lock.