Documentation
Lockers V2
Technical Reference
UniswapV2Locker

UniswapV2Locker

Functions Write

LockLPToken

function lockLPToken (
    address _lpToken,
    uint256 _amount,
    uint256 _unlock_date,
    address payable _referral,
    bool _fee_in_eth,
    address payable _withdrawer
) external payable 

Creates a new lock.

Parameters:
NameTypeDescription
_lpTokenaddressThe UniV2 token address.
_amountuint256Amount of LP tokens to lock.
_unlock_dateuint256The Unix timestamp (in seconds) until unlock.
_referraladdress payableThe referrer address. Use address(0) if there is none.
_fee_in_ethboolIf true, fees will be paid in ETH. Otherwise, in a secondary token like UNCX
_withdraweraddress payableThe user who can withdraw liquidity once the lock expires.

Relock

function relock (
    address _lpToken, 
    uint256 _index, 
    uint256 _lockID, 
    uint256 _unlock_date
) external 

Extends a lock with a new unlock date.

Parameters:
NameTypeDescription
_lpTokenaddressThe liquidity pool token address associated with the locked funds
_indexuint256Index indicating the lock's position in the user's lock array
_lockIDuint256ID of the lock ensuring the correct lock undergoes the extension
_unlock_dateuint256New proposed unlock date (timestamp) for the tokens

Withdraw

function withdraw (
    address _lpToken, 
    uint256 _index, 
    uint256 _lockID, 
    uint256 _amount
) external 

Withdraws a specified amount from a lock.

Parameters:
NameTypeDescription
_lpTokenaddressThe liquidity pool token address from which funds are to be withdrawn
_indexuint256Index of the lock for the user
_lockIDuint256ID of the lock to ensure the correct lock is changed
_amountuint256Amount of tokens to be withdrawn

IncrementLock

function incrementLock(
    address _lpToken, 
    uint256 _index, 
    uint256 _lockID, 
    uint256 _amount
) external 

Increases the amount of tokens per a specific lock.

Parameters:
NameTypeDescription
_lpTokenaddressThe liquidity pool token address associated with the lock.
_indexuint256Index indicating the lock's position in the user's array of locks.
_lockIDuint256ID of the lock to ensure the correct lock is being incremented.
_amountuint256The amount by which the locked tokens should be increased.

SplitLock

function splitLock(
    address _lpToken, 
    uint256 _index, 
    uint256 _lockID, 
    uint256 _amount
) external payable 

Splits a lock into two seperate locks.

Parameters:
NameTypeDescription
_lpTokenaddressThe liquidity pool token address associated with the lock.
_indexuint256Index indicating the lock's position in the user's array of locks.
_lockIDuint256ID of the lock to ensure the correct lock is being split.
_amountuint256The amount of tokens to be allocated to the new split lock.

TransferLockOwnership

function transferLockOwnership (
    address _lpToken, 
    uint256 _index, 
    uint256 _lockID, 
    address payable _newOwner
) external

Transfers a lock to a new owner.

Parameters:
NameTypeDescription
_lpTokenaddressThe liquidity pool token address associated with the lock.
_indexuint256Index indicating the lock's position in the user's array of locks.
_lockIDuint256ID of the lock to ensure the correct lock is being transferred.
_newOwneraddress payableAddress of the new owner to whom the lock ownership should be transferred.

Migrate

function migrate (
    address _lpToken, 
    uint256 _index, 
    uint256 _lockID, 
    uint256 _amount
) external 

Migrates liquidity to uniswap v3.

Parameters:
NameTypeDescription
_lpTokenaddressThe liquidity pool token address that will be migrated to Uniswap V3.
_indexuint256Index of the lock for the user in their list of locks for the specific _lpToken.
_lockIDuint256ID of the lock to ensure the correct lock is affected during migration.
_amountuint256Amount of tokens from the lock to be migrated to Uniswap V3.

Functions View

GetNumLocksForToken

function getNumLocksForToken (address _lpToken) external view returns (uint256)

Retrieves the amount of locks associated with a specific liquidity pool token.

Parameters:
NameTypeDescription
_lpTokenaddressThe address of the liquidity pool token.
Return Values:
TypeDescription
uint256Number of locks associated with the provided liquidity pool token.

GetNumLockedTokens

function getNumLockedTokens () external view returns (uint256) 

Retrieves the total number of unique tokens that have been locked.

Return Values:
TypeDescription
uint256Total number of locked tokens.

GetLockedTokenAtIndex

function getLockedTokenAtIndex (uint256 _index) external view returns (address)

Fetches the address of the locked token at a specified index.

Retrieves the total number of unique tokens that have been locked.

Parameters:
NameTypeDescription
_indexuint256Index to specify which locked token address to retrieve.
Return Values:
TypeDescription
addressAddress of the locked token at the specified index.

GetUserNumLockedTokens

function getUserNumLockedTokens (address _user) external view returns (uint256)

Retrieves the amount of unique tokens locked by a specific user.

Parameters:
NameTypeDescription
_useraddressAddress of the user.
Return Values:
TypeDescription
uint256Number of locked tokens for the specified user.

GetUserLockedTokenAtIndex

function getUserLockedTokenAtIndex (address _user, uint256 _index) external view returns (address)

Fetches the address of the locked token for a specific user at a given index.

Parameters:
NameTypeDescription
_useraddressAddress of the user.
_indexuint256Index to specify which token address to retrieve.
Return Values:
TypeDescription
addressAddress of the locked token at the specified index for the given user.

GetUserNumLocksForToken

function getUserNumLocksForToken (address _user, address _lpToken) external view returns (uint256)

Retrieves the amount of locks a user has for a specific liquidity pool token.

Parameters:
NameTypeDescription
_useraddressAddress of the user.
_lpTokenaddressThe address of the liquidity pool token.
Return Values:
TypeDescription
uint256Number of locks for the specified user and liquidity pool token.

GetWhitelistedUsersLength

 function getWhitelistedUsersLength () external view returns (uint256)

Retrieves the amount of users whitelisted.

Return Values:
TypeDescription
uint256Total number of users in the whitelist.

GetUserLockForTokenAtIndex

function getUserLockForTokenAtIndex (address _user, address _lpToken, uint256 _index) external view 
returns (uint256, uint256, uint256, uint256, uint256, address)

Provides details of a specific lock a user has for a liquidity pool token.

Parameters:
NameTypeDescription
_useraddressAddress of the user.
_lpTokenaddressThe address of the liquidity pool token.
_indexuint256Index indicating the lock's position in the user's array.
Return Values:
NameTypeDescription
lockDateuint256Date when the tokens were locked.
amountuint256Amount of tokens locked.
initialAmountuint256Initial amount of tokens when first locked.
unlockDateuint256Date when the tokens will be unlocked.
lockIDuint256ID of the token lock.
owneraddressAddress of the token lock owner.

GetWhitelistedUserAtIndex

function getWhitelistedUserAtIndex (uint256 _index) external view returns (address)

Retrieves the address of a whitelisted user at a specified index.

Parameters:
NameTypeDescription
_indexuint256Index to specify which whitelisted user address to fetch.
Return Values:
TypeDescription
addressAddress of the whitelisted user at the specified index.

GetUserWhitelistStatus

function getUserWhitelistStatus (address _user) external view returns (bool)

Checks if a user is whitelisted or not.

Parameters:
NameTypeDescription
_useraddressAddress of the user.
Return Values:
TypeDescription
boolBoolean indicating if the specified user is in the whitelist or not.

Events

OnDeposit

  event onDeposit(
    address lpToken,
    address user,
    uint256 amount,
    uint256 lockDate,
    uint256 unlockDate
   )

Emitted on LockLPToken and Relock.

Parameters:
NameTypeDescription
lpTokenaddressThe liquidity pool token associated with the deposit.
useraddressAddress of the user making the deposit.
amountuint256Amount of tokens deposited.
lockDateuint256Date when the tokens were locked.
unlockDateuint256Date when the tokens will be unlocked.

OnWithdraw

  event onWithdraw(
    address lpToken,
    uint256 amount
   )

Emitted on Withdraw.

Parameters:
NameTypeDescription
lpTokenaddressThe liquidity pool token associated with the withdrawal.
amountuint256Amount of tokens withdrawn.