Ellipsis Finance
Search…
LpTokenStaker
LpTokenStaker allows users to stake different LP tokens in order to receive EPS. It is based on the well known Sushi MasterChef contract, with some modifications to how per-pool incentives are calculated:
All pools added to the contract receive an equal APY. This is implemented on a technical level by modifying each pool's allocPoint any time there is a deposit or withdrawal, so the total alloc is equal to the total number of tokens deposited. For non-USD denominated LP tokens, a query to a Chainlink oracle provides a price per-token relative to USD which is then applied as a final modifier to the pool alloc.
The exception to this rule is the pool with pid 0 (the EPS/BNB pancake LP tokens). This pool always receives 20% of the total allocation regardless of it's size.
You can view the source code for LpTokenStaker on Github.

Querying Pool Info

1
poolInfo(uint256 pid) returns (address, uint256, uint256, uint256, uint256)
Copied!
Data about each pool. Returns:
    the address of the LP token staked within the pool.
    The index of the oracle used for pricing the LP tokens (0 for USD assets). This corresponds to the oracles getter.
    The number of allocation points the pool is assigned.
    The last second that rewards were distributed for this pool.
    The total accumulated rewards per share for the pool.
The allocation point numbers are less useful because the modified contract logic ensures all pools maintain a consistent APY. However, the data is left available in the getter to reduce the number of edits to the original contract.
1
rewardsPerSecond() returns (uint256)
Copied!
The current number of reward tokens minted per second.
1
startTime() returns (uint256)
Copied!
The second at which reward tokens are first minted.
1
emissionSchedule(uint256 i) returns (uint128, uint128)
Copied!
Information about future reward rates given as (start offset in seconds, rewards per second). The emission schedule stored in reverse chronological order, whenever the number of seconds beyond startTime exceeds the next emission period offset, a new reward rate is applied.
1
oracles(uint256 i) returns (address)
Copied!
A list of Chainlink oracle addresses, used to provide a base price for each LP token. The value at position 0 is always 0x00 and used to represent USD-denominated pools.

Querying User Info

1
claimableReward(uint256 pid, address user) returns (uint256)
Copied!
Get the currently claimable reward amount for user from pool pid.
1
userInfo(uint256 pid, address user) returns (uint256, uint256)
Copied!
Get the current deposit amount and reward debt for user in pool pid.

Depositing, Claiming Rewards and Withdrawing

1
deposit(uint256 pid, uint256 amount)
Copied!
Deposit LP tokens into the contract. Making a deposit also triggers a claim for pending rewards.
    pid: Pool ID to deposit to.
    amount: Amount of tokens being deposited.
1
withdraw(uint256 pid, uint256 amount)
Copied!
Withdraw LP tokens from the contract. Withdrawing also triggers a claim of any pending rewards.
    pid: Pool ID to withdraw from.
    amount: Amount of tokens being withdrawn.
1
emergencyWithdraw(uint256 pid)
Copied!
Withdraw LP tokens without also claiming rewards. This should only be done in an emergency.
    pid: Pool ID to withdraw from.
1
claim(uint256[] calldata pids)
Copied!
Claim rewards for one or more pools. Note that rewards are not directly sent to the caller, they are instead vested within MultiFeeDistribution.
    pids: An array of pool IDs to claim for.
Last modified 6mo ago