Skip to content

AAVE Integration#1688

Open
pikonha wants to merge 57 commits intodevfrom
feat/aave-indexer
Open

AAVE Integration#1688
pikonha wants to merge 57 commits intodevfrom
feat/aave-indexer

Conversation

@pikonha
Copy link
Member

@pikonha pikonha commented Mar 4, 2026

No description provided.

@pikonha pikonha self-assigned this Mar 4, 2026
@pikonha pikonha added the feature New feature or request label Mar 4, 2026
@vercel
Copy link

vercel bot commented Mar 4, 2026

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

Project Deployment Actions Updated (UTC)
anticapture Ready Ready Preview, Comment Mar 13, 2026 6:37pm
anticapture-storybook Ready Ready Preview, Comment Mar 13, 2026 6:37pm

Request Review

Copy link
Collaborator

@isadorable-png isadorable-png left a comment

Choose a reason for hiding this comment

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

Image
  • Stage badge is not aligned.

Image - Use the tab of default size (font should be 14px). - Also add a minimum width to the badge so it can be a "square" - the "1" badge is looking weird.
Image - remove this extra gap on the title.
Image - Aave token value is wrong, it not $0, but $113.00 - Links on the right side are also wrong, please correct it. It does not make sense "aave" and "aave". - The bottom row should have a "fill" behavior, otherwise there will be a empty space below, check example: Image --- Image - Is this using the correct blank slate component? it seems a bit off and the paragraph line height is wrong. It should be 20px, otherwise is kinda hard to read.
Image - If the balance is 0, show 0. Not "-".
Image Image
  • Why is delegates table different from what we have now?
  • We don't show balance, delegation received is called "voting power".
  • What is "total"?
  • Balance sorting is not working.

Copy link

@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: d4860b051b

ℹ️ 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 +72 to +74
.onConflictDoUpdate((current) => ({
amount: current.amount + value,
}));

Choose a reason for hiding this comment

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

P1 Badge Preserve token identity when upserting AAVE transfers

aaveTransfer is called for AAVE, stkAAVE, and aAAVE events, but this upsert merges rows on conflict by adding amount without preserving token separation. Because transfers are keyed by (transactionHash, fromAccountId, toAccountId), two transfers of different AAVE token variants between the same accounts in one transaction collapse into one row with a summed amount and the first token's metadata, which corrupts transfer history and downstream token-level reporting.

Useful? React with 👍 / 👎.

Comment on lines +231 to +233
conditions.push(
gt(accountBalance.balance, BigInt(amountfilter.minAmount)),
);

Choose a reason for hiding this comment

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

P2 Badge Filter AAVE balances by aggregated account totals

This repository returns account-level balances by summing multiple token rows, but the amount filter is applied to each individual account_balance.balance row before aggregation. For AAVE accounts split across AAVE/stkAAVE/aAAVE, fromValue/toValue can exclude valid accounts (or partially include balances) even when their combined balance satisfies the filter, so /balances responses become inconsistent with the returned aggregated balance field.

Useful? React with 👍 / 👎.

Comment on lines +109 to +111
addresses: delegateAddresses,
limit: delegateAddresses.length || 1,
},

Choose a reason for hiding this comment

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

P2 Badge Cap delegate balance lookups to the API limit

The delegate balance lookup sets limit to delegateAddresses.length, so after enough infinite-scroll pages this will exceed the backend /balances limit cap (100) defined in the account-balance request schema. At that point the balance query fails validation, and the table falls back to zero balances, which makes the displayed balance/delegation split incorrect for loaded delegates.

Useful? React with 👍 / 👎.

Copy link

@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: 8715f64208

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

orderBy === "variation"
? sql`ABS(COALESCE(${variationSubquery.absoluteChange}, 0))`
: orderBy === "signedVariation"
? orderDirectionFn(

Choose a reason for hiding this comment

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

P1 Badge Remove nested sort direction for signedVariation ordering

When orderBy is signedVariation, this branch already applies orderDirectionFn(...), but the whole expression is then wrapped by orderDirectionFn(...) again at line 201. That produces a double direction modifier (ASC ASC / DESC DESC) for the generated SQL, so AAVE /voting-powers requests with orderBy=signedVariation can fail instead of returning results (the delegates table uses this sort mode in its variation toggle).

Useful? React with 👍 / 👎.

Copy link

@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: 5715fa07ac

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +109 to +113
historicalVotingPower(app, votingPowerService);
votingPowers(app, votingPowerService);
accountBalances(app, env.DAO_ID, accountBalanceService);
transfers(app, new TransfersService(new TransfersRepository(pgClient)));
dao(app, daoService);

Choose a reason for hiding this comment

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

P1 Badge Register DAO overview endpoints in the AAVE API entrypoint

This entrypoint only mounts balances/voting/delegation/transfer/dao routes, but the AAVE overview page still executes useDaoOverviewData (useTokenData, useActiveSupply, useAverageTurnout, and treasury queries) from apps/dashboard/features/dao-overview/hooks/useDaoOverviewData.ts. In apps/api-gateway/src/resolvers/rest.ts, missing DAO routes cause targetClient[fieldName] to throw Endpoint ... is not available, so /aave overview requests fail and metrics silently degrade to fallback zeros (for example token price/treasury values).

Useful? React with 👍 / 👎.

Comment on lines +191 to +194
if (activeTab === TABS.FULLY_ANALYZED) {
return (
<ActiveTokensCell
daoId={row.getValue("dao") as DaoIdEnum}

Choose a reason for hiding this comment

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

P2 Badge Reset active-token sort state when rendering Not Reviewed tab

The activeTokensSort map is populated only when ActiveTokensCell renders, but this branch is skipped on the Not Reviewed tab while sorting remains enabled for the same column. After switching tabs, sorting by "Active Tokens in Governance" reads stale row-index values from the previous tab (createSortingFn(activeTokensSort)), so Not Reviewed rows are ordered by unrelated data instead of their current state.

Useful? React with 👍 / 👎.

Copy link

@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: 39d399bd67

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +124 to +127
historicalVotingPower(app, votingPowerService);
votingPowers(app, votingPowerService);
accountBalances(app, env.DAO_ID, accountBalanceService);
transfers(app, new TransfersService(new TransfersRepository(pgClient)));

Choose a reason for hiding this comment

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

P2 Badge Register accountInteractions in AAVE API entrypoint

The new AAVE holders page still renders the token-holder drawer's TopInteractions tab (via HoldersAndDelegatesDrawer), and that tab calls the accountInteractions GraphQL query, but this entrypoint never mounts the accountInteractions controller. In practice, opening that tab for AAVE yields an endpoint-not-available error from the gateway instead of interaction data. Please either register accountInteractions(...) in this server or explicitly disable that tab for AAVE.

Useful? React with 👍 / 👎.

offchainProposalById(id: String!): offchainProposalById_200_response

"""Returns a list of offchain (Snapshot) votes"""
votesOffchain(skip: NonNegativeInt, limit: Float = 10, orderBy: queryInput_votesOffchain_orderBy = timestamp, orderDirection: queryInput_votesOffchain_orderDirection = desc, voterAddresses: JSON, fromDate: Float, toDate: Float): votesOffchain_200_response

Choose a reason for hiding this comment

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

P2 Badge Route offchain vote queries through DAO-aware resolvers

These new schema fields expose offchain vote queries, but apps/api-gateway/src/resolvers/rest.ts does not include votesOffchain or votesOffchainByProposalId in daoItemQueries (it only includes offchainProposals/offchainProposalById). That means the new vote fields skip the per-DAO dispatch path that uses anticapture-dao-id, so in multi-DAO deployments they can resolve against the wrong backing DAO source. Add both vote fields to the DAO-dispatched resolver list.

Useful? React with 👍 / 👎.

@pikonha pikonha requested a review from isadorable-png March 13, 2026 12:37
Copy link

@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: 4505735b38

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

`,
balance: balanceSubquery.totalBalance,
})
.from(accountPower)

Choose a reason for hiding this comment

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

P1 Badge Query AAVE account detail from combined account set

/voting-powers/{accountId} currently reads from accountPower only, so any AAVE address that has wallet balance but no account_power row falls into the zero-value fallback even though the list endpoint includes it via balance data. In practice this makes account-level voting power lookups inconsistent with /voting-powers and returns incorrect zeros for holder addresses in views that call votingPowerByAccountId.

Useful? React with 👍 / 👎.

Copy link

@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: ca7cf73da1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +23 to +26
await context.db.insert(token).values({
id: address,
name: daoId,
decimals,

Choose a reason for hiding this comment

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

P1 Badge Store distinct identifiers for each AAVE token row

This setup stores all three AAVE-family contracts with the same token.name (daoId), but the API still resolves token properties by name via TokenRepository.getTokenPropertiesByName() (findFirst on token.name). After indexing AAVE + stkAAVE + aAAVE, /token (and overview token metrics that depend on it) can read an arbitrary row instead of a deterministic/combined value, producing unstable or incorrect token stats.

Useful? React with 👍 / 👎.

Comment on lines +260 to +262
.onConflictDoUpdate((current) => ({
delegationsCount: current.delegationsCount + 1,
votingPower: current.votingPower + delegatorBalance.balance,

Choose a reason for hiding this comment

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

P2 Badge Count unique delegators instead of per-token delegations

This increments delegationsCount on every AAVE DelegateChanged event, but aaveDelegateChanged is wired for v3AAVE, v3stkAAVE, and v3aAAVE. A single wallet delegating multiple AAVE token variants to the same delegate will be counted multiple times, so delegationsCount (used by /voting-powers and the dashboard “Delegators” column) no longer represents unique delegator accounts.

Useful? React with 👍 / 👎.

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.

3 participants