-
Notifications
You must be signed in to change notification settings - Fork 12
Extend vault snapshot strategies with name, APR, and status #317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add enriched composition field to vault snapshots (V2 and V3) that merges strategy metadata with debt information. Aligns V3 debt fields with yDaemon expectations for API compatibility. Changes: - Add composition field with strategy name, status, netAPR, and debt data - V3: Include activation, lastReport, performanceFee, totalGain/Loss in debts - Implement status computation (active/inactive/unallocated) using queue context - Add batch query helper for strategy snapshots to optimize performance - Preserve existing strategies and debts fields for backward compatibility Strategy name coalesces: metadata → snapshot → "Unknown" Status logic uses both debt allocation and queue membership
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Do we still need the |
Yeah that makes sense. For the edge we can remove. Fair enough. Ill keep debt as a backwards compat on the hook, but expose only composition in the edge api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mb. is this ready to review?
regarding the debts field. it will be more code to remove it from the rest response. it's ok to leave it in.
Yeah i was working on other things and did a docker compose down, which wiped my db T.T. Despite, yeah that's ready for review then, since its fine to leave debts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #318
* Add optional chaining for vault and strategy meta lookups Co-Authored-By: Claude Opus 4.5 <[email protected]> * Add performance object to erc4626 snapshot hook Co-Authored-By: Claude Opus 4.5 <[email protected]> * Rename netAPR to latestReportApr and add performance data to vault snapshot hook strategy composition Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
Summary
Enhances vault snapshot REST API to include enriched strategy data similar to yDaemon's output format. Adds a new
compositionfield that merges debt information with strategy metadata (name, netAPR, status) while preserving existingstrategiesanddebtsfields for backward compatibility. Also aligns V3 debt fields with yDaemon expectations by adding previously missing fields.Closes #314
How to review
CompositionSchemadefinitions in both V2 and V3 vault snapshot hookspackages/ingest/abis/yearn/3/vault/snapshot/hook.tsextractComposition()implementation in both hooks, focusing on:Test plan
Manual: Tested with V3 vault Dusfer USDC on chain 1
curl http://localhost:3001/api/rest/snapshot/1/0xAC64c681102E23f4114bC6fC873499267aeb9eA8Response excerpt:
{ "address": "0xAC64c681102E23f4114bC6fC873499267aeb9eA8", "name": "Dusfer USDC", "strategies": ["0x694E47AFD14A64661a04eee674FB331bCDEF3737"], "debts": [{ "strategy": "0x694E47AFD14A64661a04eee674FB331bCDEF3737", "activation": "1747897187", "lastReport": "1753333739", "currentDebt": "508677", "currentDebtUsd": 0.5086, "performanceFee": "500", "totalGain": "0", "totalLoss": "0" }], "composition": [{ "address": "0x694E47AFD14A64661a04eee674FB331bCDEF3737", "name": "Morpho Gauntlet USDC Prime Compounder", "status": "active", "netAPR": null, "activation": "1747897187", "lastReport": "1753333739", "currentDebt": "508677", "currentDebtUsd": 0.5086, "maxDebt": "115792089237316195423570985008687907853269984665640564039457584007913129639935", "maxDebtUsd": 1.157920892373162e+71, "performanceFee": "500", "totalGain": "0", "totalGainUsd": 0, "totalLoss": "0", "totalLossUsd": 0 }] }