Geode Finance
Search…
⌃K

Telescope Avax

Telescope Avax In Depth

Calculating the "balanceIncrease"

The parameters of the function with which Telescope interacts with the Portal, are given below.// Portal.solfunction reportOracle(uint256 _reportedTimeStamp,uint256 _planetId,uint256[] memory _opIds,uint256[] memory _pBalanceIncreases)
  • _reportedTimeStamp is the exact start time of daemon run on the Telescope.
  • _planetId is unique integer that indicates the corresponding representative.
  • _opIds is an array of unique integers that indicates the each node operator in the planet.
  • _pBalanceIncreases is the array of each total earnings of given operator array. The telescope's main task is to calculate this array.
Each pBank address can earn AVAX in 3 different ways:
  1. 1.
    By staking minimum 2000 AVAX for a validator.
  2. 2.
    By taking a fee from your validator's delegators.
  3. 3.
    By staking minimum 25 AVAX for a delegator.
The data is obtained from a P-Chain API call have also startTime and endTime parameters which indicates the timestamp of when staking will start and end. Telescope uses these parameters to estimate the reward amount in AVAX that the pBank earned by delegators and validators.
  • Being a Validator
// param: potentialReward is calculated by Avalance P-Chain// param: profitSeconds is time difference between previous price update and// the first second of the current update interval(day).// param: totalInSeconds is difference between endTime - startTime for given validator​pureStaking = potentialReward * profitSeconds / totalInSeconds
  • By your Delegators
totalDelegatorReward is calculated for each validator by the iterative sum of each related delegators' potentialReward.// param: totalDelegatorReward is calculated by Avalance P-Chain// param: delegationFee is given by Avalance P-Chain specificly// param: profitSeconds is time difference between previous run and next run.// param: totalInSeconds is difference between endTime - startTime// NOTE: we divide it to 100 because the delegationFee is a percentage​delegatorsProfit = (totalDelegatorReward * delegationFee *profitSeconds / (totalInSeconds)) / 100
  • Being a Delegator
Each validator takes a pre-determined percentage which is called delegationFee of delegator's earning. Therefore, we multiply the reward by ( 100 - delegationFee / 100 ).// param: potentialReward is given by Avalance P-Chain// param: profitSeconds is time difference between previous price update and// the first second of the current update interval(day).// param: delegationFee is given by Avalance P-Chain// param: totalInSeconds is difference between endTime - startTime​delegationProfit = (potentialReward * profitSeconds *(100 - delegationFee)) / (totalInSeconds * 100)

Now, as Telescope knows how much a Pool gained from Staking Operations, the rest is easy:

CurrentSystemBalance = EstimatedStakingRewards + TotalStakedBalance + pBankBalance + PlanetClaimableSurplus - PlanetUnclaimedFees

OldSystemBalance = TotalSupply * price

balanceIncrease = CurrentSystemBalance - OldSystemBalance

PlanetClaimableSurplus is a Portal function, returns how much Avax is waiting to be staked after gAvax is minted for the depositor of a given Planet's staking pool. PlanetUnclaimedFees is the distributed fees that are yet to be claimed by the Planet Maintainers, resulting in "debt" for the system.