You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will result in the wrong premiums_apy if one of the premiums have been updated during the last time it ran, which could result in triggering this edge case (which technically should not be possible)
logger.warning("Premiums APY %s is being skipped beacuse it is higher than the total APY.")
How does this happen?
For example, the calc_apy function runs every 24 hours (t=0, t=24, t=48, ..)
t=0 --> tvl=365.000, premiums_per_second=200 which results in 2% APY. (20 USDC yield per day) t=23.99 --> premiums_per_second=400 which results in 4% APY t=24 --> tvl=365.020 , premiums_per_second=400 which results in 4% APY
^ on t=24 the yield is ~2% but the premiums_apy = 4%, causing the edge case to hit.
logger.warning("Premiums APY %s is being skipped beacuse it is higher than the total APY.")
else:
indx.premiums_apy=premiums_apy
ifincentives_apy>indx.apy:
logger.warning("Incentive APY %s is being skipped beacuse it is higher than the total APY.")
else:
indx.incentives_apy=incentives_apy
Potential options
Take into account the weighted premiums_per_second based on recent updates and use the same code structure, so in the example above it would use premiums_per_second=201 for example.
Calculate apy every time a protocol premium is updated
Split apy,premium_apy,incentives_apy in different functions but potentially calculate them against different TVLs?
..?
The text was updated successfully, but these errors were encountered:
When the
calc_apy
functions runs it uses the currentsum_of_premiums
to calculate thepremiums_apy
.sherlock-v2-indexer/indexer.py
Lines 307 to 314 in c255a57
This will result in the wrong
premiums_apy
if one of the premiums have been updated during the last time it ran, which could result in triggering this edge case (which technically should not be possible)sherlock-v2-indexer/indexer.py
Lines 320 to 321 in c255a57
How does this happen?
For example, the
calc_apy
function runs every 24 hours (t=0, t=24, t=48, ..)t=0
-->tvl=365.000
,premiums_per_second=200
which results in 2% APY. (20 USDC yield per day)t=23.99
-->premiums_per_second=400
which results in 4% APYt=24
-->tvl=365.020
,premiums_per_second=400
which results in 4% APY^ on
t=24
the yield is ~2% but thepremiums_apy
= 4%, causing the edge case to hit.Solution
Would include the removal of these checks
sherlock-v2-indexer/indexer.py
Lines 320 to 328 in c255a57
Potential options
premiums_per_second
based on recent updates and use the same code structure, so in the example above it would usepremiums_per_second=201
for example.The text was updated successfully, but these errors were encountered: