(Updated with WMA & PRD Percentile)

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.

Restaking APR Calculation

Step 1: Retrieve Provider Rewards

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>"

Step 2: Extract Token Denominations and Convert to USD

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:

Step 3: Compute APR for Each Day

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

Step 4: Apply Weighted Moving Average (WMA) to Smooth APR

Instead of using a simple average, we use a 7-day Weighted Moving Average (WMA), giving more weight to recent days.