feat: integrate TrueFi DAO (indexer + API)#1759
Conversation
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>
Local dev script
…ript Revert "Local dev script"
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>
chore: local dev script
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
💡 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' --" |
There was a problem hiding this comment.
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 👍 / 👎.
| const mockApolloClient = new ApolloClient({ | ||
| link: new ApolloLink(() => new Observable(() => {})), | ||
| cache: new InMemoryCache(), |
There was a problem hiding this comment.
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 👍 / 👎.
…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>
There was a problem hiding this comment.
💡 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".
| case DaoIdEnum.TRUEFI: { | ||
| TrueFiTokenIndexer(token.address, token.decimals); | ||
| TrueFiGovernorIndexer(blockTime); |
There was a problem hiding this comment.
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 👍 / 👎.
| ponder.on(`TrueFiGovernor:VoteCast`, async ({ event, context }) => { | ||
| await voteCast(context, daoId, { | ||
| proposalId: event.args.proposalId.toString(), | ||
| voter: event.args.voter, | ||
| reason: event.args.reason, |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
quorum=for+abstain0x585CcA06...), 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:
0x4C195...)0x23696...)Only ~2.4% of TRU is staked as stkTRU.
Verified against local RPC (full sync to realtime)
proposalVotes()exactlyPending / Follow-up work
apps/dashboard/shared/dao-config/truefi.tsnot created. Needed for frontend.See
apps/indexer/src/indexer/truefi/INTEGRATION.mdfor full details.Test plan
pnpm indexer typecheck— passespnpm indexer lint— passespnpm api typecheck— passespnpm api lint— passes🤖 Generated with Claude Code