This document outlines the methodology used to calculate the Annual Percentage Rate (APR) for both restaking and staking in the Lava Network. The calculations ensure transparency and provide insights into reward expectations.
To estimate provider rewards for a benchmark stake of 10,000 LAVA, execute the following query:
sh
CopyEdit
lavad q subscription estimated-provider-rewards $PROVIDER_ADDRESS 10000000000ulava --node "<https://lava.tendermintrpc.lava.build:443>"
Alternatively, use the REST API:
sh
CopyEdit
curl "<https://lava.lava.build/lavanet/lava/subscription/estimated_provider_rewards/$PROVIDER_ADDRESS/10000000000ulava>"
Instead of manually retrieving token denominations and prices, this data is now available at:
https://jsinfo.mainnet.lavanet.xyz/lava_mainnet_provider_estimated_rewards?type=get&block=latest
This API provides:
Using the collected price data, the APR is calculated as follows:
python
CopyEdit
total_reward = sum(reward_amount * price_per_token for each token)
invested_amount = 10000 * LAVA_PRICE
rate = total_reward / invested_amount
current_day_annual_apr_estimation = ((1 + rate) ** (1/365) - 1) # Updated variable name
Instead of using a simple average, we use a 7-day Weighted Moving Average (WMA), giving more weight to recent days.