Integrate Rewards for Earn Products
Vault depositors on Morpho can earn rewards beyond base lending yield. Integrating rewards display and claiming is essential for providing competitive APY and maximizing user returns.
What's Unique for Earn Products
When building earn products, understand that vault depositors earn rewards from two sources:
- Direct Vault Campaigns: Rewards distributed directly to vault depositors
- Forwarded Market Campaigns: Rewards from underlying markets where the vault allocates liquidity
Net APY = Vault Native APY + Vault Campaign Rewards APR + Forwarded Market Rewards APR
Integration Steps
Follow the centralized rewards tutorials with vault-specific considerations:
Step 1: Fetch Vault Rewards Data
Follow: Fetch Rewards Data
Vault-specific notes:- Query both
state.rewards
andstate.allocation[].market.state.rewards
- Calculate weighted average for market rewards based on allocation
- Use
supplyAssetsUsd
to determine weights - Alternatively, use
netApy
convenience field for simple total APY
Step 2: Display Rewards in Your UI
Follow: Integrate Rewards Display
Vault-specific notes:- Prominently display Net APY (native + all rewards)
- Show breakdown: base yield vs. rewards
- List reward tokens with their respective APRs
- Optionally show which markets contribute to forwarded rewards
Step 3: Enable Reward Claiming
Follow: Claim Rewards
Important: The claiming process is identical for all Morpho users (vault depositors, borrowers, market suppliers). Both Merkl and URD use the same claiming flow regardless of how rewards were earned.
Complete Integration Example
For a full working reference implementation:
See: Complete Rewards Integration Guide
This guide includes production-ready code using the morpho-merkl-recipe.
Quick Reference
Task | Main Tutorial | Vault-Specific Consideration |
---|---|---|
Understanding rewards | Reward Campaigns | Understand forwarding mechanism |
Distribution system | Distribution Systems | Same Merkl/URD for all users |
Fetch rewards | Fetch Rewards Data | Query two API locations, manual aggregation |
Display rewards | Integrate Display | Show total APY breakdown |
Claim rewards | Claim Rewards | Same process for all users |
Need Help?
- Conceptual questions: Rewards for Lenders Concept
- Main rewards guide: Rewards Integration Guide
- Technical support: help.morpho.org
- Example code: morpho-merkl-recipe