feat: compound v3 APY using on-chain profitMaxUnlockTime#354
Merged
matheus1lva merged 1 commit intomainfrom Mar 5, 2026
Merged
feat: compound v3 APY using on-chain profitMaxUnlockTime#354matheus1lva merged 1 commit intomainfrom
matheus1lva merged 1 commit intomainfrom
Conversation
Instead of hardcoding 52 weekly compounding periods for all vaults, v3 APY now compounds based on the vault's profitMaxUnlockTime read on-chain: n = seconds_per_year / profitMaxUnlockTime. For ~7 day unlocks this yields ~52 periods/year. Falls back to daily (365) if profitMaxUnlockTime is 0 or the read fails. V2 vaults remain unchanged at 52. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
profitMaxUnlockTimeread on-chain instead of a hardcoded 52 weekly periodsn = 31,556,952 / profitMaxUnlockTime(e.g., ~52 for 7-day unlock windows)profitMaxUnlockTimeis 0 or the RPC call failsContext
Per feedback from juniordevbot: the compounding periods should reflect the vault's actual
profitMaxUnlockTimerather than assuming weekly (52). Most v3 vaults use ~7 day unlock periods, but this varies per vault.Changed files
packages/ingest/abis/yearn/lib/apy.ts— addedgetCompoundingPeriods()function, v3 path uses it instead of hardcoded 52Test plan
abis.local.yamlto index a v3 vault:manuals.local.yamlso the vault is created as a thing:In the terminal UI (pane 2), select
Ingest→fanout abisto trigger indexing. Run it multiple times for full initialization.Trigger APY recalculation via
Ingest→fanout replaysin the terminal UIWatch the ingest pane for APY processing logs — look for
🧮 apy-bwd-delta-ppsentries. IfprofitMaxUnlockTimeread fails, you'll see:Expected:
grossAprvalues should be present and reasonable. For vaults with ~7 dayprofitMaxUnlockTime, values should be very close to the previous 52-period calculation.profitMaxUnlockTimeon-chain:Expected: e.g.,
604800(7 days) →31556952 / 604800 ≈ 52.18periods/year🤖 Generated with Claude Code