This repository was archived by the owner on Mar 11, 2025. It is now read-only.
SPL Stake Pool and CLI - v0.6.1
·
3901 commits
to master
since this release
Summary of changes
Program
Add last_epoch_total_lamports
and last_epoch_pool_token_supply
fields on
the stake pool. These fields are updated every epoch with the previous epoch's
values, to facilitate APR calculations in wallets.
The basic calculation goes:
let pool_token_value = stake_pool.total_lamports as f64 / stake_pool.pool_token_supply as f
64;
let last_epoch_pool_token_value = stake_pool.last_epoch_total_lamports as f64 / stake_pool.
last_epoch_pool_token_supply as f64;
let epoch_rate = pool_token_value / last_epoch_pool_token_value - 1.0;
const SECONDS_PER_EPOCH: f64 = DEFAULT_SLOTS_PER_EPOCH as f64 * DEFAULT_S_PER_SLOT;
const EPOCHS_PER_YEAR: f64 = SECONDS_PER_DAY as f64 * 365.25 / SECONDS_PER_EPOCH;
let yearly_estimated_rate = epoch_rate * EPOCHS_PER_YEAR;