Currently the convex apy resolver uses the llama api to get the apy. The problem here is that while the total number seems accurate it doesnt return the apy per rewardToken. We should use contract reads to calculate the apy per rewardToken.
To calculate the rewards for each convex pool we need to do the following steps:
Get the BaseRewardPool for the stakingToken. (It rewards crv)
Read extraRewards(0) to get the cvx reward contract (Which rewards cvx)
Read rewardRate on the cvx reward Contract and the BaseRewardPool this is the amount of token paid out per second for the whole pool
Reward totalSupply on both contracts
Use the rewardRate per second and totalSupply to arrive at the apy in crv and cvx for the pool.
Note -> Just doing that math manually for some pools didnt give me the apy displayed on llama or the convex frontend. Not sure what i was missing there
Currently the convex apy resolver uses the llama api to get the apy. The problem here is that while the total number seems accurate it doesnt return the apy per rewardToken. We should use contract reads to calculate the apy per rewardToken.
To calculate the rewards for each convex pool we need to do the following steps:
extraRewards(0)
to get the cvx reward contract (Which rewards cvx)rewardRate
on the cvx reward Contract and the BaseRewardPool this is the amount of token paid out per second for the whole pooltotalSupply
on both contractsNote -> Just doing that math manually for some pools didnt give me the apy displayed on llama or the convex frontend. Not sure what i was missing there