my question is - how to get actual APR on Ethereum for delegators? So, knowing the APR we'll be able to estimate the reward for users.
1 Answer
Well depending of how you distribute rewards, but you should probably store rewards distributed and available to users and then do something like:
uint256 currentAprNumerator = reward * 36500;
uint256 currentAprDenominator = stakedAmountOf[account] * stakingDurationInDays;
if (currentAprDenominator == 0) {
return 0;
}
uint256 currentApr = currentAprNumerator / currentAprDenominator;