Atrás
+40 XP
8/12
Staking Rewards Calculator
Build a staking rewards calculator that computes compound interest over multiple epochs.
Your calculator should compute:
- Final balance after N epochs with compound rewards
- Effective APY accounting for compounding
- Total rewards earned over the staking period
This is the math behind every staking dashboard and validator calculator. Master compound interest to build accurate DeFi UIs.
Casos de Prueba
Should return object with finalBalance, totalRewards, effectiveApy
Entrada:
100, 7.5, 2.5, 146Esperado: typeof result === 'object' && 'finalBalance' in result && 'totalRewards' in result && 'effectiveApy' in resultFinal balance should be greater than initial stake
Entrada:
100, 7.5, 2.5, 146Esperado: typeof result.finalBalance === 'number' && result.finalBalance > 100Total rewards should be positive
Entrada:
100, 7.5, 2.5, 146Esperado: typeof result.totalRewards === 'number' && result.totalRewards > 0