Earning
The callable surface for the four yield paths. Concept: Stability Pool, FEE staking, FLX staking, LP staking. Mechanics of the fee split: Fees.
Stability Pool
Per branch, on StabilityPool.
StabilityPool.provideToSP(uint256 _amount, address _frontEndTag) // address(0) = no tag
StabilityPool.withdrawFromSP(uint256 _amount) // _amount = 0 → claim only
provideToSPrequires the caller to hold and approve_amountRD._frontEndTagis recorded on first deposit and inherited by later deposits; to switch tags, fully withdraw and re-deposit.withdrawFromSPpays out accumulated collateral gain and FEE, then returns_amountRD (clamped to your deposit). Pass0to claim rewards without touching the deposit.BorrowerOperations.moveCollateralGainToTrove(_user, _coll, _upperHint, _lowerHint)routes a collateral gain into your trove on the same branch instead of paying it out.
Front-end registration and kickback: see Front-end operators.
LP staking
Singleton LPStaking (stake the Balancer BPT). No lockup, no tier.
LPStaking.deposit(uint256 amount) // approve BPT first
LPStaking.withdraw(uint256 amount) // or withdrawAll(); settles FEE + RD
LPStaking.claimRewards() // settle FEE + RD without changing stake
Two reward streams, both via a reward-per-share index:
F_FEE_global = ∫ (FEE_stream_rate / total_staked) dt // LpIssuance emission
F_RD_global = RD_inflows_per_share since last update // routed borrow fees
my_pending_FEE = my_stake × (F_FEE_global − snapshot_FEE)
my_pending_RD = my_stake × (F_RD_global − snapshot_RD)
FEE staking
Singleton FEEStaking. Earns borrow interest in RD; lockup tiers set the reward multiplier.
FEEStaking.stake(uint256 _FEEamount) // top up; keeps current tier; reverts if lockup expired
FEEStaking.stakeWithTier(uint256 _FEEamount, uint8 _tier) // new position / re-lock / switch tier (up only)
- Tier constants:
TIER_0/1/2_MULTIPLIER,TIER_0/1/2_LOCKUP(7d / 30d / 60d). Each stake extends the lockup tonow + tier_lockup. - Unstake only after the lockup expires; before expiry you can still claim pending RD. Any state-touching call (e.g.
stake(0)) settles rewards. - Gotcha:
stake()reverts on an expired position (forces an explicitstakeWithTierre-lock) and on a tier mismatch.
FLX staking
Singleton FLXStaking. Earns a fixed FEE pot streamed linearly over 365 days. No lockup.
FLXStaking.stake(uint256 amount) // approve FLX first; also settles accrued FEE
FLXStaking.unstake(uint256 amount) // settles accrued FEE
FLXStaking.getClaimableFEE(address) // view: pending FEE
There is no separate claim function — accrued FEE is paid out whenever you stake or unstake.
F_FEE_global = ∫ (stream_rate / total_FLX_staked) dt
my_pending = my_FLX_staked × (F_FEE_global − snapshot)