Skip to content

feat(treasury): In DeFi — net worth by right, not token-in-wallet - #291

Merged
sktbrd merged 1 commit into
r4topunk:mainfrom
sktbrd:feat/treasury-defi-positions
Aug 23, 2026
Merged

feat(treasury): In DeFi — net worth by right, not token-in-wallet#291
sktbrd merged 1 commit into
r4topunk:mainfrom
sktbrd:feat/treasury-defi-positions

Conversation

@sktbrd

@sktbrd sktbrd commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements the shared three-surface spec (Gnars/SkateHive/SOPA) on /treasury: the page now shows stock (what the treasury owns in protocol positions) next to the flow it already attributes.

  • New "In DeFi" card (right column, under Token Holdings): rider-vault shares held by the treasury (convertToAssets of the treasury's OWN share balance — never totalAssets), treasury's SplitsWarehouse balances, its verified percentage of undistributed non-vault split balances, and MOR staked in the Gnars Builders subnet (treasury + interim multisig), each with its exit path (permissionless / via proposal / locked until date).
  • One truth, reused: the vault-fee-accrued row is the stake graph's own gnarsAccrued — the same figure the Sponsorship card prints. No second computation.
  • Unknown ≠ 0: every read is individually wrapped; a failure renders amber "read failed" and flags the card total as a floor. A legitimate zero renders $0 — and the vault-shares zero carries a one-line explanation (the treasury never deposits into vaults; supporters do; its right is the fee) so a future reader doesn't "fix" it into rendering depositors' money as DAO net worth.
  • Total KPI = wallet + DeFi, with "In wallet X · In DeFi Y" named beneath it (both locales, BRL-aware). DeFi read failure keeps the wallet total with a visible marker.

Today's honest numbers: In wallet ~$34.4k · In DeFi $0.01 (fee shares parked in rider splits; everything else legitimately zero — measured on-chain, cross-checked independently by the operator).

Changes

  • src/services/treasury-defi.ts (+ tests for the unknown-propagation fold)
  • src/components/treasury/TreasuryDefi.tsx, TreasuryKpiRow.tsx, page.tsx
  • messages/{en,pt-br}/treasury.jsondefi block + KPI keys, both locales

Test plan

  • 163 tests pass (4 new); tsc / eslint / prettier clean
  • Runtime captures EN+PT: card rendering all five positions with legit-zero styling and the vault explainer; Total KPI reconciling to the cent with the note
  • On-chain measurement matches the operator's independent one (all 7 vaults: 0 treasury shares)

Generated with Claude Code

Stock next to the flow: a new card reads every protocol position the
treasury owns directly from chain state — ERC-4626 vault shares held by
the treasury (convertToAssets of ITS balance, never totalAssets, which
is everyone's money), its SplitsWarehouse balances, its verified share
of undistributed non-vault split balances, and MOR staked in the Gnars
Builders subnet. The vault-fee-in-splits row REUSES the stake graph's
gnarsAccrued — one truth shared with the Sponsorship card.

Spec rules wired in: a failed read renders as a failure (amber), never
as 0; a legitimate zero renders as $0 with liquidity context; the
vault-shares zero carries its explanation (the treasury never deposits
— supporters do) so nobody 'fixes' it into rendering depositor money.
The Total KPI becomes wallet + DeFi with the split named beneath it,
and an incomplete DeFi read keeps the total as a labeled floor.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 23, 2026

Copy link
Copy Markdown

@sktbrd is attempting to deploy a commit to the r4to's projects Team on Vercel.

A member of the Team first needs to authorize it.

@sktbrd
sktbrd merged commit 20b4280 into r4topunk:main Aug 23, 2026
1 of 3 checks passed
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.

1 participant