Staking Contracts

Allows staking Uniswap trading pair liquidity pool tokens in exchange for FXS rewards.

⚠️ This page only applies to very early farms, though many newer farms share features and function names ⚠️

Based on Synthetix's staking contract:

https://docs.synthetix.io/incentives/

Description

Frax users are able to stake in select Uniswap liquidity pool tokens in exchange for FXS rewards. Future pools and incentives can be added by governance.

Deployment

Liquidity Pool Tokens (LP)

Uniswap FRAX/WETH LP: 0xFD0A40Bc83C5faE4203DEc7e5929B446b07d1C76

Uniswap FRAX/USDC LP: 0x97C4adc5d28A86f9470C70DD91Dc6CC2f20d2d4D

Uniswap FRAX/FXS LP: 0xE1573B9D29e2183B1AF0e743Dc2754979A40D237

Uniswap FXS/WETH LP: 0xecBa967D84fCF0405F6b32Bc45F4d36BfDBB2E81

Staking Contracts

Uniswap FRAX/WETH staking: 0xD875628B942f8970De3CcEaf6417005F68540d4f

Uniswap FRAX/USDC staking: 0xa29367a3f057F3191b62bd4055845a33411892b6

Uniswap FRAX/FXS staking: 0xda2c338350a0E59Ce71CDCED9679A3A590Dd9BEC

Uniswap FXS/WETH staking (deprecated): 0xDc65f3514725206Dd83A8843AAE2aC3D99771C88

State Variables

Instance of the FRAX contract.

Instance for the reward token.

Instance for the staking token.

Block when the staking period will finish.

Maximum reward per second.

Reward period, in seconds.

Last timestamp where the contract was updated / state change.

Actual reward per token in the current period.

Maximum boost / weight multiplier for locked stakes.

The time, in seconds, to reach locked_stake_max_multiplier .

Minimum staking time for a locked staked, in seconds.

String version is locked_stake_min_time_str .

Maximum boost / weight multiplier from the collateral ratio (CR). This is applied to both locked and unlocked stakes.

Keeps track of when an address last collected a reward. If they collect it some time later, they will get the correct amount because rewardPerTokenStored is constantly varying.

Current rewards balance for a given address.

Total amount of pool tokens staked .

_staking_token_supply with the time and CR boosts accounted for. This is not an actual amount of pool tokens, but rather a 'weighed denominator'.

Balance of pool tokens staked for a given address.

_balances , but with the time and CR boosts accounted for, like _staking_token_boosted_supply.

Gives a list of locked stake lots for a given address.

A locked stake 'lot'.

View Functions

totalSupply

Get the total number of staked liquidity pool tokens.

stakingMultiplier

Get the time-based staking multiplier, given the secs length of the stake.

crBoostMultiplier

Get the collateral ratio (CR) - based staking multiplier.

stakingTokenSupply

same as totalSupply().

balanceOf

Get the amount of staked liquidity pool tokens for a given account.

boostedBalanceOf

Get the boosted amount of staked liquidity pool tokens for a given account. Boosted accounts for the CR and time-based multipliers.

lockedBalanceOf

Get the amount of locked staked liquidity pool tokens for a given account .

unlockedBalanceOf

Get the amount of unlocked / free staked liquidity pool tokens for a given account .

lockedStakesOf

Return an array of all the locked stake 'lots' for

stakingDecimals

Returns the decimals() for stakingToken .

rewardsFor

Get the amount of FXS rewards for a given account .

lastTimeRewardApplicable

Used internally to keep track of rewardPerTokenStored .

rewardPerToken

The current amount of FXS rewards for staking a liquidity pool token.

earned

Returns the amount of unclaimed FXS rewards for a given account .

getRewardForDuration

Calculates the FXS reward for a given rewardsDuration period.

Mutative Functions

stake

Stakes some Uniswap liquidity pool tokens. These tokens are freely withdrawable and are only boosted by the crBoostMultiplier().

stakeLocked

Stakes some Uniswap liquidity pool tokens and also locks them for the specified secs . In return for having their tokens locked, the staker's base amount will be multiplied by a linear time-based multiplier, which ranges from 1 at secs = 0 to locked_stake_max_multiplier at locked_stake_time_for_max_multiplier. The staked value is also multiplied by the crBoostMultiplier() . This multiplied value is added to _boosted_balances and acts as a weighted amount when calculating the staker's share of a given period reward.

withdraw

Withdraw unlocked Uniswap liquidity pool tokens.

withdrawLocked

Withdraw locked Uniswap liquidity pool tokens. Will fail if the staking time for the specific kek_id staking lot has not elapsed yet.

getReward

Claim FXS rewards.

exit

Withdraw all unlocked pool tokens and also collect rewards.

renewIfApplicable

Renew a reward period if the period's finish time has completed. Calls retroCatchUp() .

retroCatchUp

Renews the period and updates periodFinish , rewardPerTokenStored , and lastUpdateTime .

Restricted Functions

notifyRewardAmount

This notifies people (via the event RewardAdded ) that the reward is being changed.

recoverERC20

Added to support recovering LP Rewards from other systems to be distributed to holders.

setRewardsDuration

Set the duration of the rewards period.

setLockedStakeMaxMultiplierUpdated

Set the maximum multiplier for locked stakes.

setLockedStakeTimeForMaxMultiplier

Set the time, in seconds, when the locked stake multiplier reaches locked_stake_max_multiplier .

setLockedStakeMinTime

Set the minimum time, in seconds, of a locked stake.

setMaxCRBoostMultiplier

aaa

initializeDefault

Intended to only be called once in the lifetime of the contract. Initializes lastUpdateTime and periodFinish .

Modifiers

updateReward

Calls retroCatchUp() , if applicable, and otherwise syncs rewardPerTokenStored and lastUpdateTime . Also, syncs the rewards and userRewardPerTokenPaid for the provided account .

Last updated

Was this helpful?