Saltar al contenido principal
Superteam Brasil
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:

  1. Final balance after N epochs with compound rewards
  2. Effective APY accounting for compounding
  3. 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 result
Final balance should be greater than initial stake
Entrada: 100, 7.5, 2.5, 146Esperado: typeof result.finalBalance === 'number' && result.finalBalance > 100
Total rewards should be positive
Entrada: 100, 7.5, 2.5, 146Esperado: typeof result.totalRewards === 'number' && result.totalRewards > 0

Discusión