Skip to content

feat: integrate TrueFi DAO (indexer + API)#1759

Draft
alextnetto wants to merge 54 commits intomainfrom
feat/truefi-integration
Draft

feat: integrate TrueFi DAO (indexer + API)#1759
alextnetto wants to merge 54 commits intomainfrom
feat/truefi-integration

Conversation

@alextnetto
Copy link
Copy Markdown
Member

@alextnetto alextnetto commented Mar 20, 2026

Summary

  • Indexer: Full TrueFi DAO integration — stkTRU token (8 decimals) + OZ Governor v1 with bravo counting and 2-day TimelockController
  • API: TrueFi client for computed proposal statuses (DEFEATED, SUCCEEDED, NO_QUORUM, ACTIVE, PENDING_EXECUTION) via GovernorBase with quorum=for+abstain
  • Contracts: Governor (0x585CcA06...), Token stkTRU (0x23696914...), Timelock (0x4f4AC7a7...)

Architecture: stkTRU vs TRU

The governor uses stkTRU (staking wrapper) for voting power, not the underlying TRU token. This integration indexes stkTRU for governance, which is correct for proposals/votes/delegation. Key numbers:

Token Supply Role
TRU (0x4C195...) ~1.45B Underlying tradeable token
stkTRU (0x23696...) ~38M Staking wrapper, governance token

Only ~2.4% of TRU is staked as stkTRU.

Verified against local RPC (full sync to realtime)

Data Count
Transfers 5,997
Proposals 71
Votes 627
Accounts 2,012
Delegations 716
  • Token totalSupply matches on-chain exactly
  • All proposal vote tallies match on-chain proposalVotes() exactly
  • Zero data integrity issues (no negative balances, orphaned votes, etc.)

Pending / Follow-up work

  1. TRU token indexing — Circulating supply currently reflects only stkTRU (~38M) not total TRU (~1.45B). CEX/DEX/Lending tracking should be on TRU (the tradeable token). Needs multi-token approach similar to AAVE (AAVE + stkAAVE + aAAVE).
  2. CEX/DEX/Lending addresses — No exchange or DeFi addresses provided yet. Should be researched for TRU once TRU indexing is added.
  3. Dashboard configapps/dashboard/shared/dao-config/truefi.ts not created. Needed for frontend.

See apps/indexer/src/indexer/truefi/INTEGRATION.md for full details.

Test plan

  • pnpm indexer typecheck — passes
  • pnpm indexer lint — passes
  • pnpm api typecheck — passes
  • pnpm api lint — passes
  • Indexer ran to realtime against local RPC with local postgres DB
  • Cross-validated token supply, proposal votes, and delegate aggregates against on-chain state
  • Run API with TrueFi DB and verify proposal status endpoints return computed statuses

🤖 Generated with Claude Code

pikonha and others added 30 commits March 9, 2026 20:03
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move treasury/token env vars to API, add Railway fallback in dev script,
and point client codegen at local gateway endpoint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move treasury/token env vars to API, add Railway fallback in dev script,
and point client codegen at local gateway endpoint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pikonha and others added 10 commits March 19, 2026 12:13
fix: remove header-based DAO resolution from gateful proxy
Add `dotenv --` to indexer, api, gateway, and gateful scripts (matching
dashboard) so the root .env is injected into turbo child processes.

Bundle OpenTelemetry dependencies into the observability package to avoid
the ESM/CJS resolution conflict in @opentelemetry/resources@1.30.x that
broke ponder and other consumers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Step-by-step guide covering all five components (indexer, API, gateway,
dashboard, enum sync) with concrete file paths, code patterns, and a
verification checklist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add indexer support for TrueFi DAO with:
- Governor (0x585CcA06) - OZ Governor v1, bravo counting, 2-day timelock
- Token stkTRU (0x23696914) - ERC20 with delegation, 8 decimals
- Events: ProposalCreated, VoteCast, ProposalQueued/Executed/Canceled,
  Transfer, DelegateChanged, DelegateVotesChanged
- Verified against local RPC: 71 proposals, 627 votes, 5997 transfers,
  token supply matches on-chain exactly

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add TrueFi client extending GovernorBase with:
- Quorum calculation: forVotes + abstainVotes (bravo counting)
- Timelock delay from on-chain TimelockController.getMinDelay()
- Block-relative quorum from governor.quorum(blockNumber)
- Contract addresses, CoinGecko mapping, event relevance config

This ensures proposals show correct computed statuses (DEFEATED,
SUCCEEDED, NO_QUORUM, ACTIVE) instead of raw DB statuses.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 20, 2026

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

Project Deployment Actions Updated (UTC)
anticapture Ready Ready Preview, Comment Mar 20, 2026 11:54am
anticapture-storybook Ready Ready Preview, Comment Mar 20, 2026 11:54am

Request Review

@claude
Copy link
Copy Markdown

claude bot commented Mar 20, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9ef021ab0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"lint:fix": "eslint src --fix",
"dev": "tsx watch cmd/index.ts",
"dev:aave": "tsx watch cmd/aave.ts"
"dev": "sh -c 'dao_id=\"$1\"; if [ -n \"$dao_id\" ] && [ -f \"cmd/$dao_id.ts\" ]; then exec tsx watch \"cmd/$dao_id.ts\"; else exec tsx watch cmd/index.ts; fi' --"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Propagate dao_id into the generic API dev entrypoint

When pnpm api dev <dao_id> falls through to cmd/index.ts (anything without its own cmd/<dao>.ts, such as ens or truefi, and even AAVE if it is passed uppercase), the selected DAO is never exported to the child process. cmd/index.ts still reads DAO_ID from .env via apps/api/src/env.ts:6-14, while scripts/dev.sh:107-116 registers that process as DAO_API_<requested>. In the documented local-fallback path where the Railway service is unavailable, pnpm dev truefi can therefore advertise an ENS/UNI API under DAO_API_TRUEFI, so the gateway serves the wrong DAO's data.

Useful? React with 👍 / 👎.

Comment on lines +17 to +19
const mockApolloClient = new ApolloClient({
link: new ApolloLink(() => new Observable(() => {})),
cache: new InMemoryCache(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make Storybook's Apollo mock settle requests

The Apollo provider introduced here never resolves any operation because its link returns new Observable(() => {}). Components that run Apollo queries during stories now stay permanently loading; for example, EnsAvatar calls useArkhamData(address) whenever an address is supplied (apps/dashboard/shared/components/design-system/avatars/ens-avatar/EnsAvatar.tsx:93-97) and keeps the rendered name in its loading animation while isArkhamDataLoading stays true (...:222-228). As a result, stories like the default ENS avatar never reach their steady state in Storybook.

Useful? React with 👍 / 👎.

alextnetto and others added 3 commits March 20, 2026 11:48
…kill

Add mandatory Step 0 that verifies the governor's voting token on-chain
before writing code. This catches non-standard governance patterns like
vote-escrow (veToken) DAOs where the ERC20 token differs from the
voting token. Also adds an INTEGRATION.md template for per-DAO status
tracking and a new veToken variation row.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Documents the stkTRU vs TRU dual-token architecture, what's integrated,
and what's pending (TRU token indexing for distribution analytics,
CEX/DEX addresses, dashboard config).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5ea8e5a8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +109 to +111
case DaoIdEnum.TRUEFI: {
TrueFiTokenIndexer(token.address, token.decimals);
TrueFiGovernorIndexer(blockTime);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Index TRU alongside stkTRU for TrueFi metrics

This wires TrueFi through the single-token path, so every balance-based API for the new DAO is computed from stkTRU only. The new apps/indexer/src/indexer/truefi/INTEGRATION.md already calls out that the liquid asset is the underlying TRU token and that only about 2.4% is staked; with the code as written, /token, /treasury/*, holder tables, and CEX/DEX/Lending supply all underreport TrueFi by design because they never see the much larger TRU balances. The AAVE branch just below shows the pattern needed here: index the governance wrapper and the liquid token separately.

Useful? React with 👍 / 👎.

Comment on lines +14 to +18
ponder.on(`TrueFiGovernor:VoteCast`, async ({ event, context }) => {
await voteCast(context, daoId, {
proposalId: event.args.proposalId.toString(),
voter: event.args.voter,
reason: event.args.reason,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Handle VoteCastWithParams in the TrueFi governor indexer

If TrueFi voters use any params-based vote path, those votes are dropped here. The ABI added in this commit declares a VoteCastWithParams event (apps/indexer/src/indexer/truefi/abi/governor.ts), but this indexer only subscribes to TrueFiGovernor:VoteCast, so params-based votes never reach voteCast. In that scenario the indexed vote list and proposal tallies diverge from chain state, which then feeds incorrect quorum/status calculations in the API.

Useful? React with 👍 / 👎.

@pikonha pikonha marked this pull request as draft March 20, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants