Skip to content

Conversation

@matheus1lva
Copy link
Collaborator

@matheus1lva matheus1lva commented Jan 26, 2026

Summary

Enhances vault snapshot REST API to include enriched strategy data similar to yDaemon's output format. Adds a new composition field that merges debt information with strategy metadata (name, netAPR, status) while preserving existing strategies and debts fields for backward compatibility. Also aligns V3 debt fields with yDaemon expectations by adding previously missing fields.

Closes #314

How to review

  1. Schema changes first: Review CompositionSchema definitions in both V2 and V3 vault snapshot hooks
  2. V3 debt alignment: Check the new fields added to V3 debts (activation, lastReport, performanceFee, totalGain/Loss) in packages/ingest/abis/yearn/3/vault/snapshot/hook.ts
  3. Composition logic: Review extractComposition() implementation in both hooks, focusing on:
    • Name coalescing logic (metadata → snapshot → "Unknown")
    • Status computation using debt and queue context
    • Batch query helper for strategy snapshots
  4. Backward compatibility: Verify existing fields remain unchanged

Test plan

  • Manual: Tested with V3 vault Dusfer USDC on chain 1

    • Request: curl http://localhost:3001/api/rest/snapshot/1/0xAC64c681102E23f4114bC6fC873499267aeb9eA8
    • Verified composition field contains enriched strategy data
    • Strategy name: "Morpho Gauntlet USDC Prime Compounder" (fetched from metadata)
    • Status correctly computed as "active" (currentDebt: 508677 > 0)
    • netAPR field present and null (no harvest data yet)
    • All debt fields properly included (activation, lastReport, performanceFee, totalGain/Loss)

    Response 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
      }]
    }

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
@vercel
Copy link

vercel bot commented Jan 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
kong Ready Ready Preview, Comment Jan 28, 2026 2:27pm

Request Review

@rossgalloway
Copy link
Collaborator

Do we still need the debts field if everything within it is also contained in composition? Can we just call the composition field debts and remove the old debts field?

@matheus1lva
Copy link
Collaborator Author

matheus1lva commented Jan 26, 2026

Do we still need the debts field if everything within it is also contained in composition? Can we just call the composition field debts and remove the old debts field?

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

@murderteeth murderteeth self-requested a review January 27, 2026 05:28
Copy link
Collaborator

@murderteeth murderteeth left a 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.

@murderteeth murderteeth self-requested a review January 27, 2026 05:55
@matheus1lva
Copy link
Collaborator Author

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

Copy link
Collaborator

@murderteeth murderteeth left a 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]>
@matheus1lva matheus1lva merged commit 577bd20 into main Jan 28, 2026
3 checks passed
@murderteeth murderteeth deleted the feat/extend-vault branch January 28, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend vault snapshot strategies with name, APR, and status

4 participants