User Methods
vEPOCH contract user methods
Methods
Add Reward Tokens
Description: Allows anyone to add reward tokens (which will be distributed proportionally)
Inputs:
_tokenAmount - The number of reward tokens to deposit
Calculate Rewards Earned
Description: View function allowing computation of the total number of reward tokens earned for a given deposit ID.
Inputs:
_depositId - The deposit ID you wish to query rewards for
Claim Yield
Description: Allows deposit owners to claim reward tokens earned for a single deposit
Inputs:
_depositId - The deposit ID you wish to claim rewards/yield for
Claim Yield (multiple)
Description: Allows deposit owners to claim reward tokens earned for multiple deposits at once
Inputs:
_depositIds - an array of deposit IDs you wish to claim rewards for
Calculate Ve Tokens
Description: Returns the veTokens minted for a given tokenAmount and duration
Inputs:
_tokenAmount - The number of EPOCH-LP
_duration - The duration of the lock in seconds
Note: This function will return values for durations longer than the max deposit duration but this does not mean users can deposit for longer than the max deposit duration.
Deposit
Description: Function used to enter the vEPOCH ecosystem. Allows depositing of EPOCH-LP for a given lock duration.
Inputs:
_tokenAmount - The number of EPOCH-LP tokens to deposit (in wei)
_duration - The duration to lock these tokens in seconds
_behalfOf - The address that will own this deposit
DANGER: The depositor will lose all control of vEPOCH and EPOCH-LP if this parameter is set to anything other than the depositor's address.
Withdraw Forfeit
Description: Allows depositors to exit the system before their lock duration has ended by forfeiting some number of reward tokens. This method allows for partial withdrawals.
Inputs:
_depositId - The deposit ID to withdraw from
_depositTokenToRemove - The number of EPOCH-LP tokens to remove from the deposit (in wei)
Withdraw
Description: Allows depositors to exit the system after their lock duration has ended. There will be no reward tokens forfeit when using this function. This method allows for partial withdrawals.
Inputs:
_depositId - The deposit ID to withdraw from
_tokenAmount - The number of EPOCH-LP tokens to remove from the deposit (in wei)
Extend Deposit
Description: Allows depositors to extend their deposit lock duration in exchange for more vEPOCH which increases reward distribution.
Inputs:
_depositID - The deposit ID to extend
_secondsToExtend - The number of seconds to extend this deposit by
Note: The deposit can never exceed the maximum lock duration.
Transfer Deposit Ownership
Description: Allows depositors to transfer the ownership of their deposit which includes both vEPOCH and the underlying EPOCH-LP that is locked in the contract.
Inputs:
_depositId - The deposit ID to transfer
_newOwner - The new owner of this deposit
DANGER: Once a deposit has been transferred, there is NO WAY to reverse this. Transferring ownership will irrevocably transfer BOTH vEPOCH and the underlying EPOCH-LP.
State Variables
Deposits
Input: Deposit ID
The contract can be queried by deposit ID to determine the owner, deposit timestamp, lock duration and deposit token balance (EPOCH-LP) of a given deposit.
Deposit Count
Returns the number of deposits to date. This should be used with "deposits" above to retrieve all deposit data off-chain.
Max Deposit Duration
Returns the current maximum deposit duration.
The maximum deposit duration. This was initially set to 730 days but is currently set to 365 days.
Deposit Token
Returns the address for the deposit token.
The deposit token is EPOCH-LP, an 80/20 EPOCH/WETH Balancer WeightedPool token.
Max Deposit Duration Locked
Returns true or false depending on whether the max deposit duration is locked permanently. If this returns true, the DAO (owner) will not be able to update the maximum deposit duration.
Authorised Locked
Returns true or false depending on whether the authorised feature is locked permanently. If this returns true, the DAO (owner) will not be able to toggle the authorised status of addresses.
Find out more about authorised in the admin methods.
Authorised
Input: address
Returns true or false when provided with an address. This returned state determines whether an address is authorised to transfer vEPOCH.
Reward Token
Returns the address for the reward token.
The reward token is EPOCH.
Reward Staking Power
Returns the staking power for a given deposit ID.
Input: Deposit ID
The vEPOCH reward distribution mechanism uses this value to determine the proportional share a given deposit should earn when rewards are distributed. Note that addresses do not earn proportionally but instead, deposits earn proportionally. The owner of a given deposit is then allowed to claim these reward tokens.
The returned value from this function is equivalent to the number of vEPOCH tokens minted for a given deposit.
Reward Tokens Claimed
This mapping will return the number of reward tokens claimed from each deposit ID.
Input: Deposit ID
This variable is used in the contract to compute the number of reward tokens that must be paid back by a depositor if they wish to withdraw forfeit.
Last updated