Section 14 of 15
LQTYStaking: Fee Distribution and Borrowing Fees
Key takeaway:
LQTYStakingis the protocol's revenue distribution contract. Stakers lock LQTY tokens; in return they earn the borrowing fees (paid in LUSD) and the redemption fees (paid in ETH). The accounting uses two additive running sums:F_LUSD = F_LUSD + (fee × 1e18) / totalLQTYStakedper borrowing event,F_ETH = F_ETH + (fee × 1e18) / totalLQTYStakedper redemption. A staker's pending gain isstake × (F_current - F_snapshot) / 1e18. This is the additive counterpart to the Stability Pool's multiplicativeP— same per-share-reward idea, opposite shape. Side-by-side these two contracts are a textbook illustration of why the choice between additive and multiplicative depends on whether the underlying stake decays.
What You Are Building
Three things wire up:
LQTYStaking— the staking contract withstake,unstake,increaseF_LUSD,increaseF_ETH, and the lazy-readgetPendingETHGain/getPendingLUSDGain.- Real
_triggerBorrowingFeein BorrowerOperations — replaces the stub from sections 7 and 8. Mints the fee to LQTYStaking and callsincreaseF_LUSD. - LQTYToken stub — a simple ERC-20 with a
sendToLQTYStakinghelper that lets LQTYStaking pull tokens from a staker without anapprove(mirroring theLUSDToken.sendToPoolpattern from section 3).
The LQTY emission curve (CommunityIssuance) is out of scope per the module's scoping decision — we keep LQTY as a stake-tracking unit and skip the time-based issuance to Stability Pool depositors.
Your Code
Requirements
Sign up free — keep reading + earn 15 Lynx
Zealynx Academy is free. Track your progress, earn Lynx, and climb the leaderboard.
Sign up free to continueAlready have an account? Log in