-
Notifications
You must be signed in to change notification settings - Fork 63
Add Yield Farming & Rewards to Lending Contract #508
Copy link
Copy link
Open
Description
Component: Contracts (Lending) | Effort: 5-7 days | Priority: MEDIUM
Current State
Depositors earn interest but no additional rewards or yield farming.
Missing Functions
Yield farming functions:
stake_lp_tokens()- Stake LP tokens for rewardsunstake_lp_tokens()- Unstake LP tokensclaim_rewards()- Claim accumulated rewardsget_pending_rewards()- View pending rewardsset_reward_rate()- Set reward emission rate (admin)get_staked_balance()- Get user's staked balance
Why This Matters
- Incentives: Attract more liquidity with rewards
- Competitive: Other protocols offer yield farming
- Growth: Rewards drive TVL growth
- Token utility: Use protocol token for rewards
Tasks
- Add RewardPool struct (total_staked, reward_rate, last_update)
- Add UserStake struct (amount, reward_debt, pending_rewards)
- Implement
stake_lp_tokens()function - Add
unstake_lp_tokens()function - Implement reward calculation logic
- Add
claim_rewards()function - Implement
get_pending_rewards()view - Add
set_reward_rate()(admin only) - Track total rewards distributed
- Add Staked, Unstaked, RewardsClaimed events
- Add tests for yield farming
- Document rewards mechanism
Acceptance Criteria
- Users can stake LP tokens
- Rewards calculated correctly over time
- Rewards claimable
- Reward rate adjustable by admin
- Tests cover reward scenarios
- Documentation explains yield farming
Reactions are currently unavailable