[indexer]: index yield vaults to track LP yields#1008
Conversation
|
@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. |
Closes #1001
Indexes the supported ERC-4626 yield vaults so LP yields running simplex can be tracked:
Deposit/Withdrawevents (redeem emits Withdraw) per vault →VaultLedgerEventaudit trail and a runningVaultLpPosition(net principal per LP).convertToAssets(balanceOf(lp))→VaultPositionSnapshot(withyieldEarned), plus a vault-levelVaultSnapshot(totalAssets / totalShares / assetsPerShare).Datasources are generated per configured vault from the existing
yieldVaultsconfig; snapshots dedupe per UTC day. Generic over any ERC-4626 vault, so it also covers our own StreamingYieldVault.