Skip to content

[indexer]: index yield vaults to track LP yields#1008

Open
royvardhan wants to merge 3 commits into
mainfrom
roy/indexer-yield-vaults
Open

[indexer]: index yield vaults to track LP yields#1008
royvardhan wants to merge 3 commits into
mainfrom
roy/indexer-yield-vaults

Conversation

@royvardhan

Copy link
Copy Markdown
Collaborator

Closes #1001

Indexes the supported ERC-4626 yield vaults so LP yields running simplex can be tracked:

  • Deposit / Withdraw events (redeem emits Withdraw) per vault → VaultLedgerEvent audit trail and a running VaultLpPosition (net principal per LP).
  • A daily block-handler snapshot prices each LP's live share balance into assets via convertToAssets(balanceOf(lp))VaultPositionSnapshot (with yieldEarned), plus a vault-level VaultSnapshot (totalAssets / totalShares / assetsPerShare).

Datasources are generated per configured vault from the existing yieldVaults config; snapshots dedupe per UTC day. Generic over any ERC-4626 vault, so it also covers our own StreamingYieldVault.

@Wizdave97

Copy link
Copy Markdown
Member

@royvardhan recordLedger drops the event whenever lp isn't already a LiquidityProvider, but those rows are created only by the Hyperbridge phantom handler (a different chain / subql node), so there's no ordering guarantee against these EVM vault events. If a solver deposits before its first phantom bid is indexed, the Deposit is skipped and never backfilled — totalAssetsDeposited is left too low, and since the daily snapshot prices the live balanceOf (which already includes those shares), yieldEarned = assetValue - netPrincipal ends up overstated by the dropped principal, for exactly the LPs this is meant to track.

As a backup when the LiquidityProvider lookup misses, check whether lp is delegated to the our solver accounts before dropping the event — treat a delegated account as ours, so its vault activity is still tracked even before (or without) a LiquidityProvider row.

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.

[indexer] Index supported yield vaults to track LP yields

3 participants