Liquidity Farming
FarmPool
FarmPool allows to deposit liquidity points (LP) and allocates reward tokens each second among all LP stakeholder. Reward allocation is proportional to user's share of LP. User can deposit LP or exit (withdraw + claim reward) at any time. FarmPool is active until all reward is allocated and can be restarted for the next farming cycle
lpToken
address of LP token
rewardToken
address of reward token
lpStakeBalance
returns total amount of staked LP
lpFeeBalance
returns balance of accumulated LP fee
rewardBalance
returns total amount of reward token
poolReward
returns pool reward for current farming cycle
farmPeriod
returns period (in seconds) of current farming cycle
farmStartTime
returns start time of current farming cycle
farmEndTime
returns end time of current farming cycle
lastAllocationTime
returns time of last reward allocation
activeUsers
returns number of active users with LP shares
rewardPerSec
returns pool reward allocated each second
accumPerLP
returns accummulated reward per LP
userInfo
mapping to store user's info - amount of LP staked and claimed reward
constructor
farming pool constructor
Parameters
_lpToken
address
address of LP token
_rewardToken
address
address of reward token
_rewardPerSec
uint256
start
admin function to start farming cycle
Parameters
_warmUpPeriod
uint256
war up period (delay) before starting farm pool
_from
address
address of the wallet to transfer a reward from
_reward
uint256
farming reward in tokens
depositLP
external function to deposit LP tokens
Parameters
_lpAmount
uint256
amount of LP tokens to deposit
withdrawLP
external function to withdraw LP tokens
1% fee is applied
Parameters
_lpAmount
uint256
amount of LP tokens to withdraw
claimReward
external function to claim reward (transfer to user's wallet)
transferLP
admin function to transfer LP tokens to recipient's wallet
it is possible to transfer LP tokens only when farming is inactive
Parameters
_recipient
address
address of recipient's wallet
getReward
extrnal view function to get user's total reward
isStarted
view function to check if farming is started
pool in "started" state till all reward is allocated
isActive
view function to check if farming is active
pool is in "active" state when it is "started" and passed warm-up period
Last updated