yearn / seafood

Seafood
https://seafood.yearn.watch
13 stars 21 forks source link

Chore: Factor vaultRpc out of v2 Average APY calculation #127

Open murderteeth opened 1 year ago

murderteeth commented 1 year ago

The current apy code has vaultRpc passed into the compute function, then calls pricePerShare at different historic points, for example: https://github.com/yearn/dashboard_ui/blob/208a9fdf9bb3a48406dbec58646a8a7991069e10/src/apy/v2/averaged.ts#L19

Better would be to make those pps calls ahead of computation, passing in an array of historic pps instead of vaultRpc. This way the pps history is available for other methods of computing APY and makes the compute function more testable.