fix(stake,treasury): one definition per number across both pages - #284
Merged
Conversation
Three places where the same question got two answers. Orbit nodes printed vault-only TVL while the headline above them added Morpheus stakes on top. A rider backed purely through Morpheus therefore rendered unlit with no figure — Will had $31 behind him and an empty node — the per-node values could not be summed to the headline, and zooming into that rider listed the backers the overview had just denied. The mobile BackerList dropped him entirely on the same `total > 0` test. `OrbitAthlete` now carries `vaultTvl` and `morUsd`, with `total` their sum. The treasury's Sponsorship yield re-derived the DAO's take as the vault fee alone, so it read $0.0024 against /stake's $0.0112 with nothing marking one as a subset. It now prints the graph's own `treasuryUsd` — the identical field /stake shows — and names both halves under it. The per-rider table stays vault-only, since the fee is the only part attributable per rider. Warehouse credits were classified from the withdrawal's own receipt, and a bare withdraw() of balance credited earlier carries no split event, so four Morpheus payouts sat under the generic "Splits" tag. The credit that funded them does name its split, and the amounts match exactly, so an amount-matched scan of the treasury's ledger credits recovers all four. The Subnet Earnings KPI now runs the same classifier as the tile below it rather than a second copy of the old rule. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
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
Three places where the same question got two different answers. All three shared a root cause: a number was re-derived at the point of display instead of read from the shared source.
Changes
Orbit nodes excluded Morpheus stakes —
src/services/stake-graph.tsOrbitAthlete.totalmeant "Morpho vault TVL" but was rendered wherever "how much is backing this rider" was meant. The headline above the orbit addedmorTvlseparately, so the two could not agree. A rider backed purely through Morpheus rendered unlit with no figure at all (Will: $31 behind him, empty node), and zooming into him then listed the backers the overview had just denied. The mobileBackerListdropped him outright on the sametotal > 0test.OrbitAthletenow carriesvaultTvl(the fee-earning Morpho balance) andmorUsd, withtotaltheir sum.StakeGraph.totalbecomes a plain sum ofa.total. No component changes were needed — the orbit, the stat line and the backer list all read the corrected field.Treasury yield disagreed with /stake —
src/components/treasury/SponsorshipYield.tsxThe card re-derived the DAO's take as the vault performance fee alone ($0.0024) while
/stakeprintedtreasuryUsd($0.0112), with nothing marking one as a subset of the other. It now shows the graph's owntreasuryUsd— the identical field — and names both halves under it (Vault fee/MOR rewards). The per-rider table stays vault-only and its TVL column moves tovaultTvl, since the fee is the only part attributable per rider and pairing a yield with a MOR-inclusive TVL invites reading a bogus return rate off two unrelated numbers.Morpheus payouts tagged "Splits" —
src/services/treasury-inflows.tsWarehouse credits were classified from the withdrawal's own receipt. A bare
withdraw()of balance credited earlier carries no split event at all — just the warehouse burn and the ERC-20 transfer — so four subnet payouts totalling ~$27 sat under the generic tag. The credit that funded them does name its split, and the amounts match exactly, soledgerSplitForCreditscans the treasury's ERC-6909 ledger credits in the window before the withdrawal and matches on amount. Ambiguity (two mapped splits, same amount) asserts nothing.Per request, an unattributable warehouse USDC credit then falls back to
subnet— seeUNATTRIBUTED_USDC_FALLBACK, which documents the cost (it is the same shape of assumption that once ran a swap-fee credit under the Morpheus name) and is one constant to delete to restore strict behaviour. ETH/WETH credits never reach it.The
Subnet EarningsKPI now calls the samewarehouseSourceas the inflows feed instead of keeping a second copy of the receipt-only rule — the two sit on one screen and were about to report 38.78 against 66.05.Test plan
pnpm test— 159 passed, including 7 new cases formatchLedgerCreditbuilt from the real log shape (exact match, multi-credit windows, no match, ambiguous, unmapped split, malformed log).subnetby proof — the fallback is not load-bearing for them:7.843441 USDCwithdrawn at block 50182885, credited by0xcc7e…3a4eat 501828758.575767@ 49799306,0.162179@ 49686165,10.689136@ 49683664/api/stake-graphpayload:sum(a.total)now equals the headline exactly (75.05 = 75.05); Willtotal=31.00, vaultTvl=0, morUsd=31.00;treasuryUsd = gnarsAccrued + gnarsMorUsd.pnpm devand exercised both pages. Orbit: Will lit at $31, Yan corrected $2 → $24. Treasury: headline $0.0114 with both components; Morpheus Subnet tile 38.78 → 66.05 USDC, 4 → 8 entries; KPI card matches at 66.05 / 8 claims; the one remaining genericSplitsrow is the ETH one, correctly untouched.pnpm exec tsc --noEmitclean;pnpm lintclean apart from one pre-existing warning inBountiesView.tsx;prettier --checkpasses.Generated with Claude Code