Skip to content

feat(aave-v3): add Aptos chain support#2474

Merged
0xkr3p merged 3 commits intoDefiLlama:masterfrom
mpsc0x:feat/aave-aptos-support
Mar 18, 2026
Merged

feat(aave-v3): add Aptos chain support#2474
0xkr3p merged 3 commits intoDefiLlama:masterfrom
mpsc0x:feat/aave-aptos-support

Conversation

@mpsc0x
Copy link
Contributor

@mpsc0x mpsc0x commented Mar 12, 2026

Added aave-v3 on aptos adaptor

Summary by CodeRabbit

  • New Features

    • Added Aptos V3 protocol support: APY calculations and TVL metrics for Aptos-based reserves are now included in overall APY aggregation.
  • Chores

    • Added Aptos SDK dependency to enable the new Aptos data integration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dd8fb95a-e2fc-47cb-ba53-ff0f58b93ca2

📥 Commits

Reviewing files that changed from the base of the PR and between 7759bcb and a5b4b36.

⛔ Files ignored due to path filters (1)
  • src/adaptors/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • src/adaptors/package.json

📝 Walkthrough

Walkthrough

Adds Aptos V3 data support to the Aave V3 adaptor: introduces an Aptos SDK dependency, implements getApyAptos() to fetch reserves and base currency data, compute TVL/APY metrics, and merges Aptos results into the existing APY aggregation flow.

Changes

Cohort / File(s) Summary
Root Dependency
package.json
Added @aave/aave-v3-aptos-ts-sdk ^0.0.61.
Adaptor Dependency
src/adaptors/package.json
Added @aave/aave-v3-aptos-ts-sdk ^0.0.61 to adaptor runtime dependencies.
Aave V3 Adaptor
src/adaptors/aave-v3/index.js
Imported Aptos SDK components and DEFAULT_MAINNET_CONFIG; added RAY constant; implemented getApyAptos() to fetch reservesData and baseCurrencyData, compute price, liquidity, tvlUsd, totalSupplyUsd, totalBorrowUsd, APYs and pool objects; integrated getApyAptos() into Promise.allSettled aggregation alongside existing sources.

Sequence Diagram(s)

sequenceDiagram
    participant Aggregator as APY Aggregator
    participant AptosFn as getApyAptos()
    participant SDK as Aptos SDK (Provider / UiPoolDataProviderClient)
    participant Pricing as Market Price Service
    participant Response as APY Results

    Aggregator->>AptosFn: invoke getApyAptos()
    activate AptosFn
    AptosFn->>SDK: init provider & request reservesData
    SDK-->>AptosFn: reservesData
    AptosFn->>SDK: request baseCurrencyData
    SDK-->>AptosFn: baseCurrencyData
    AptosFn->>Pricing: request market prices
    Pricing-->>AptosFn: price data
    AptosFn->>AptosFn: compute tvlUsd, supply, borrow, apy (use RAY)
    AptosFn-->>Response: mapped pool APY objects
    deactivate AptosFn
    Response-->>Aggregator: return Aptos APY data
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped to Aptos with a curious twitch,

Fetching reserves, prices — a tidy little stitch.
TVLs and APYs I lined up in rows,
Merged them to the aggregator — watch the data grow!
A cheerful rabbit dance for every new flow.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding Aptos chain support to the aave-v3 adapter, which is reflected in the code additions across package.json and index.js.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes with custom instructions.

Set the reviews.auto_title_instructions setting to generate a title for your PR based on the changes in the PR with custom instructions.

@llamatester
Copy link

The aave-v3 adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 1918 passed, 1918 total
Snapshots: 0 total
Time: 0.658 s
Ran all test suites.

Nb of pools: 213
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬─────────────────────┬────────────────────┬────────────────────────┬──────────────────────────────────────────────────┬────────────────────┬─────────────────────┬────────────────┬───────────────────────┬────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────┬────────────┬──────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol              │ tvlUsd             │ apyBase                │ underlyingTokens                                 │ totalSupplyUsd     │ totalBorrowUsd      │ debtCeilingUsd │ apyBaseBorrow         │ ltv    │ url                                                                                                                             │ borrowable │ mintedCoin │ poolMeta │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼─────────────────────┼────────────────────┼────────────────────────┼──────────────────────────────────────────────────┼────────────────────┼─────────────────────┼────────────────┼───────────────────────┼────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────┼────────────┼──────────┤
│ 0       │ '0xbdfa7b7893081b35fb54027489e2bc7a38275129-ethereum' │ 'ethereum' │ 'aave-v3' │ 'weETH'             │ 4684327673.036204  │ 0.00009323393359259271 │ [ '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee' ] │ 4685118813.249978  │ 791140.2137737274   │ null           │ 1.0039398565314095    │ 0.775  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 1       │ '0x0b925ed163218f6662a35e0f0371ac234f9e9371-ethereum' │ 'ethereum' │ 'aave-v3' │ 'wstETH'            │ 3205444968.379292  │ 0.0014184051111760005  │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ 3345214156.6748934 │ 139769188.29560137  │ null           │ 0.052227408045503465  │ 0.785  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 2       │ '0x5ee5bf7ae06d1be5997a1a72006fe6c607ec6de8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WBTC'              │ 2821129463.2171407 │ 0.004002180570502199   │ [ '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' ] │ 2892005756.193871  │ 70876292.97673035   │ null           │ 0.32659025137122566   │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x2260fac5e5542a773aa44fbcfedf7c193bc2c599&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 3       │ '0x23878914efe38d27c4d67ab83ed1b93a74d4086a-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDT'              │ 1883790097.5058227 │ 1.6780463518117616     │ [ '0xdAC17F958D2ee523a2206206994597C13D831ec7' ] │ 5457860153.520505  │ 3574070056.0146823  │ null           │ 2.8471949707366733    │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xdac17f958d2ee523a2206206994597c13d831ec7&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 4       │ '0x5c647ce0ae10658ec44fa4e11a51c96e94efd1dd-ethereum' │ 'ethereum' │ 'aave-v3' │ 'cbBTC'             │ 1847238406.339482  │ 0.0018611751289849903  │ [ '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' ] │ 1869686085.6314104 │ 22447679.29192829   │ null           │ 0.31003175751707285   │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 5       │ '0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDC'              │ 1215704860.228698  │ 1.7639595913251422     │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3699751088.307084  │ 2484046228.0783863  │ null           │ 2.919188557113594     │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 6       │ '0x4579a27af00a62c0eb156349f31b345c08386419-ethereum' │ 'ethereum' │ 'aave-v3' │ 'sUSDe'             │ 951307849.0751673  │ 0                      │ [ '0x9D39A5DE30e57443BfF2A8307A4256c8797A3497' ] │ 951307744.4205061  │ -104.65466117858887 │ null           │ 0                     │ 0      │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x9d39a5de30e57443bff2a8307a4256c8797a3497&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 7       │ '0x2d62109243b87c4ba3ee7ba1d91b0dd0a074d7b1-ethereum' │ 'ethereum' │ 'aave-v3' │ 'rsETH'             │ 857215720.6673732  │ 1.5265325052632787e-7  │ [ '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7' ] │ 857307837.2002432  │ 92116.53287005424   │ null           │ 0.0016714228244218028 │ 0      │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa1290d69c65a6fe4df752f95823fae25cb99e5a7&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 8       │ '0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WETH'              │ 678805521.4835974  │ 1.7503476509190319     │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 6107575915.708844  │ 5428770394.225246   │ null           │ 2.3167138922952946    │ 0.805  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 9       │ '0x53349cbed7a3f851f0722bf3fa8f1b93fa939bef-plasma'   │ 'plasma'   │ 'aave-v3' │ 'PT-sUSDE-9APR2026' │ 561343154.1485553  │ 0                      │ [ '0xab509448ad489e2E1341e25CC500f2596464Cc82' ] │ 561343154.1485553  │ 0                   │ null           │ 0                     │ 0.0005 │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xab509448ad489e2e1341e25cc500f2596464cc82&marketName=proto_plasma_v3'  │ false      │ null       │ null     │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴─────────────────────┴────────────────────┴────────────────────────┴──────────────────────────────────────────────────┴────────────────────┴─────────────────────┴────────────────┴───────────────────────┴────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────┴────────────┴──────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/adaptors/aave-v3/index.js (1)

220-220: Consider using lowercase for chain identifier consistency.

Other chains in this adaptor use lowercase identifiers (e.g., 'ethereum', 'optimism'). Using 'Aptos' with a capital letter may cause inconsistencies in downstream processing or pool lookups.

♻️ Suggested change
-        chain: 'Aptos',
+        chain: 'aptos',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/adaptors/aave-v3/index.js` at line 220, The chain identifier in the
adaptor object currently uses a capitalized string ('Aptos'); change it to the
lowercase form ('aptos') to match other adaptors and avoid downstream lookup
mismatches—locate the object/property where chain: 'Aptos' is set in
src/adaptors/aave-v3/index.js and update the value to 'aptos' (ensure any
related comparisons or tests expect lowercase as well).
package.json (1)

17-17: Consider pinning to an exact version to avoid unexpected breaking changes.

The @aave/aave-v3-aptos-ts-sdk package at version ^0.0.61 is a pre-release (0.0.x). Using the caret allows patch updates that may introduce breaking changes. Pin to 0.0.61 exactly for stability.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 17, Change the dependency declaration for
"@aave/aave-v3-aptos-ts-sdk" from a caret range to an exact version by replacing
"^0.0.61" with "0.0.61" in package.json; after updating package.json, run your
package manager (npm/yarn/pnpm) to update the lockfile so the exact version is
recorded.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/adaptors/aave-v3/index.js`:
- Around line 203-206: The priceUsd calculation is dividing by marketRefDecimals
(the count) instead of the decimal factor; update the computation in the
priceUsd assignment to divide r.priceInMarketReferenceCurrency by
10**marketRefDecimals (or Math.pow(10, marketRefDecimals)) before multiplying by
marketRefPriceUsd so that you use the decimal factor rather than the raw
decimals count (refer to priceUsd, r.priceInMarketReferenceCurrency,
marketRefDecimals, marketRefPriceUsd).

---

Nitpick comments:
In `@package.json`:
- Line 17: Change the dependency declaration for "@aave/aave-v3-aptos-ts-sdk"
from a caret range to an exact version by replacing "^0.0.61" with "0.0.61" in
package.json; after updating package.json, run your package manager
(npm/yarn/pnpm) to update the lockfile so the exact version is recorded.

In `@src/adaptors/aave-v3/index.js`:
- Line 220: The chain identifier in the adaptor object currently uses a
capitalized string ('Aptos'); change it to the lowercase form ('aptos') to match
other adaptors and avoid downstream lookup mismatches—locate the object/property
where chain: 'Aptos' is set in src/adaptors/aave-v3/index.js and update the
value to 'aptos' (ensure any related comparisons or tests expect lowercase as
well).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ee5e38d1-ea7d-4725-9879-d8a24dfc3eb0

📥 Commits

Reviewing files that changed from the base of the PR and between a4309cb and dffe191.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • src/adaptors/aave-v3/index.js

@mpsc0x mpsc0x force-pushed the feat/aave-aptos-support branch from dffe191 to a31e98c Compare March 16, 2026 08:32
@llamatester
Copy link

The aave-v3 adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 1882 passed, 1882 total
Snapshots: 0 total
Time: 0.612 s
Ran all test suites.

Nb of pools: 209
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬─────────────────────┬────────────────────┬───────────────────────┬──────────────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────┬───────────────────────┬────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────┬────────────┬──────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol              │ tvlUsd             │ apyBase               │ underlyingTokens                                 │ totalSupplyUsd     │ totalBorrowUsd     │ debtCeilingUsd │ apyBaseBorrow         │ ltv    │ url                                                                                                                             │ borrowable │ mintedCoin │ poolMeta │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼─────────────────────┼────────────────────┼───────────────────────┼──────────────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼───────────────────────┼────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────┼────────────┼──────────┤
│ 0       │ '0xbdfa7b7893081b35fb54027489e2bc7a38275129-ethereum' │ 'ethereum' │ 'aave-v3' │ 'weETH'             │ 5048091252.11506   │ 0.0000950911761671179 │ [ '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee' ] │ 5048960781.143163  │ 869529.0281028748  │ null           │ 1.0040180265725822    │ 0.775  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 1       │ '0x0b925ed163218f6662a35e0f0371ac234f9e9371-ethereum' │ 'ethereum' │ 'aave-v3' │ 'wstETH'            │ 3550930708.7400064 │ 0.0013523176744679477 │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ 3701959316.1884685 │ 151028607.448462   │ null           │ 0.05099618540553631   │ 0.785  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 2       │ '0x5ee5bf7ae06d1be5997a1a72006fe6c607ec6de8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WBTC'              │ 2961314652.3560305 │ 0.003998792567722361  │ [ '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' ] │ 3035663322.0026393 │ 74348669.64660883  │ null           │ 0.326537724583762     │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x2260fac5e5542a773aa44fbcfedf7c193bc2c599&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 3       │ '0x5c647ce0ae10658ec44fa4e11a51c96e94efd1dd-ethereum' │ 'ethereum' │ 'aave-v3' │ 'cbBTC'             │ 1902908466.1269753 │ 0.001901918507277619  │ [ '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' ] │ 1926461045.920339  │ 23552579.79336381  │ null           │ 0.311129484694885     │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 4       │ '0x23878914efe38d27c4d67ab83ed1b93a74d4086a-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDT'              │ 1783161841.8887308 │ 1.7104350910448591    │ [ '0xdAC17F958D2ee523a2206206994597C13D831ec7' ] │ 5262285640.02592   │ 3479123798.137189  │ null           │ 2.8745412512890414    │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xdac17f958d2ee523a2206206994597c13d831ec7&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 5       │ '0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDC'              │ 1121507680.6927035 │ 1.869817794151134     │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3632614398.098235  │ 2511106717.405532  │ null           │ 3.005505531739574     │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 6       │ '0x2d62109243b87c4ba3ee7ba1d91b0dd0a074d7b1-ethereum' │ 'ethereum' │ 'aave-v3' │ 'rsETH'             │ 941102596.6787499  │ 1.5296739584488066e-7 │ [ '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7' ] │ 941203831.732225   │ 101235.05347502232 │ null           │ 0.0016731417521093097 │ 0      │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa1290d69c65a6fe4df752f95823fae25cb99e5a7&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 7       │ '0x4579a27af00a62c0eb156349f31b345c08386419-ethereum' │ 'ethereum' │ 'aave-v3' │ 'sUSDe'             │ 910113247.8034341  │ 0                     │ [ '0x9D39A5DE30e57443BfF2A8307A4256c8797A3497' ] │ 910113247.8034341  │ 0                  │ null           │ 0                     │ 0      │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x9d39a5de30e57443bff2a8307a4256c8797a3497&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 8       │ '0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WETH'              │ 715403794.2867787  │ 1.7266791773652745    │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 6610503036.957937  │ 5895099242.671159  │ null           │ 2.2779121988037687    │ 0.805  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 9       │ '0x53349cbed7a3f851f0722bf3fa8f1b93fa939bef-plasma'   │ 'plasma'   │ 'aave-v3' │ 'PT-sUSDE-9APR2026' │ 558319983.9425292  │ 0                     │ [ '0xab509448ad489e2E1341e25CC500f2596464Cc82' ] │ 558319983.9425292  │ 0                  │ null           │ 0                     │ 0.0005 │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xab509448ad489e2e1341e25cc500f2596464cc82&marketName=proto_plasma_v3'  │ false      │ null       │ null     │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴─────────────────────┴────────────────────┴───────────────────────┴──────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────┴───────────────────────┴────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────┴────────────┴──────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

const tvlUsd = totalSupplyUsd - totalBorrowUsd;

return {
pool: `${r.underlyingAsset}-aptos`.toLowerCase(),
Copy link
Contributor

Choose a reason for hiding this comment

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

if available can we use the atoken address rather than underlying?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if available can we use the atoken address rather than underlying?

Yes, fixed that. Thanks for noticing.

@llamatester
Copy link

The aave-v3 adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 1918 passed, 1918 total
Snapshots: 0 total
Time: 0.621 s
Ran all test suites.

Nb of pools: 213
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬─────────────────────┬────────────────────┬────────────────────────┬──────────────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────┬──────────────────────┬────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────┬────────────┬──────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol              │ tvlUsd             │ apyBase                │ underlyingTokens                                 │ totalSupplyUsd     │ totalBorrowUsd     │ debtCeilingUsd │ apyBaseBorrow        │ ltv    │ url                                                                                                                             │ borrowable │ mintedCoin │ poolMeta │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼─────────────────────┼────────────────────┼────────────────────────┼──────────────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼──────────────────────┼────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────┼────────────┼──────────┤
│ 0       │ '0xbdfa7b7893081b35fb54027489e2bc7a38275129-ethereum' │ 'ethereum' │ 'aave-v3' │ 'weETH'             │ 5083252619.394917  │ 0.00009775972081594716 │ [ '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee' ] │ 5084152657.32549   │ 900037.9305734634  │ null           │ 1.0041303225310119   │ 0.775  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 1       │ '0x0b925ed163218f6662a35e0f0371ac234f9e9371-ethereum' │ 'ethereum' │ 'aave-v3' │ 'wstETH'            │ 3742351546.4540415 │ 0.0012873200849478196  │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ 3897488727.1963353 │ 155137180.74229383 │ null           │ 0.04975555808754048  │ 0.785  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 2       │ '0x5ee5bf7ae06d1be5997a1a72006fe6c607ec6de8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WBTC'              │ 3005020943.9548445 │ 0.00415033880696158    │ [ '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' ] │ 3082828065.316841  │ 77807121.36199665  │ null           │ 0.32887402594346843  │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x2260fac5e5542a773aa44fbcfedf7c193bc2c599&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 3       │ '0x5c647ce0ae10658ec44fa4e11a51c96e94efd1dd-ethereum' │ 'ethereum' │ 'aave-v3' │ 'cbBTC'             │ 1894545266.0317423 │ 0.0019101000902971652  │ [ '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' ] │ 1918079428.5585017 │ 23534162.526759386 │ null           │ 0.3113491371135885   │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 4       │ '0x23878914efe38d27c4d67ab83ed1b93a74d4086a-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDT'              │ 1562008182.903936  │ 1.8929376537839568     │ [ '0xdAC17F958D2ee523a2206206994597C13D831ec7' ] │ 5130045071.88788   │ 3568036888.9839444 │ null           │ 3.0240113187795914   │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xdac17f958d2ee523a2206206994597c13d831ec7&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 5       │ '0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDC'              │ 1157543504.377666  │ 1.8463895433681432     │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3697262766.8306437 │ 2539719262.4529777 │ null           │ 2.9866167734786746   │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 6       │ '0x2d62109243b87c4ba3ee7ba1d91b0dd0a074d7b1-ethereum' │ 'ethereum' │ 'aave-v3' │ 'rsETH'             │ 970253513.6127524  │ 1.5276486516269467e-7  │ [ '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7' ] │ 970357815.319466   │ 104301.70671355724 │ null           │ 0.001672033755279603 │ 0      │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa1290d69c65a6fe4df752f95823fae25cb99e5a7&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 7       │ '0x4579a27af00a62c0eb156349f31b345c08386419-ethereum' │ 'ethereum' │ 'aave-v3' │ 'sUSDe'             │ 902549611.0117126  │ 0                      │ [ '0x9D39A5DE30e57443BfF2A8307A4256c8797A3497' ] │ 902549611.0117126  │ 0                  │ null           │ 0                    │ 0      │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x9d39a5de30e57443bff2a8307a4256c8797a3497&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 8       │ '0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WETH'              │ 816565459.5219083  │ 1.684367560723258      │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 6849318061.063104  │ 6032752601.541195  │ null           │ 2.249829400959486    │ 0.805  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 9       │ '0x53349cbed7a3f851f0722bf3fa8f1b93fa939bef-plasma'   │ 'plasma'   │ 'aave-v3' │ 'PT-sUSDE-9APR2026' │ 553230837.2316577  │ 0                      │ [ '0xab509448ad489e2E1341e25CC500f2596464Cc82' ] │ 553230837.2316577  │ 0                  │ null           │ 0                    │ 0.0005 │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xab509448ad489e2e1341e25cc500f2596464cc82&marketName=proto_plasma_v3'  │ false      │ null       │ null     │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴─────────────────────┴────────────────────┴────────────────────────┴──────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────┴──────────────────────┴────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────┴────────────┴──────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/adaptors/aave-v3/index.js (1)

203-205: ⚠️ Potential issue | 🔴 Critical

Critical: Price calculation still divides by decimals count instead of decimal factor.

The past review comment indicated this was addressed, but the code still divides by marketRefDecimals (the count, e.g., 8) instead of 10 ** marketRefDecimals (the factor, e.g., 10^8 = 100,000,000). This produces prices that are orders of magnitude too high, causing incorrect TVL, supply, and borrow values.

🐛 Proposed fix
       const priceUsd =
-        (Number(r.priceInMarketReferenceCurrency) / marketRefDecimals) *
+        (Number(r.priceInMarketReferenceCurrency) / 10 ** marketRefDecimals) *
         marketRefPriceUsd;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/adaptors/aave-v3/index.js` around lines 203 - 205, The computed priceUsd
uses marketRefDecimals (the integer count) instead of the decimal scaling
factor; change the division to use 10 ** marketRefDecimals (or Math.pow(10,
marketRefDecimals)) so priceUsd = (Number(r.priceInMarketReferenceCurrency) /
(10 ** marketRefDecimals)) * marketRefPriceUsd; update the expression in the
price calculation (look for the priceUsd variable and
r.priceInMarketReferenceCurrency / marketRefDecimals) to use the correct decimal
factor to avoid values being orders of magnitude off.
🧹 Nitpick comments (1)
src/adaptors/aave-v3/index.js (1)

220-220: Consider using utils.formatChain('aptos') for consistency.

Other Aptos adapters in the codebase (e.g., tortuga, thalaswap) use utils.formatChain('aptos') rather than hardcoding the chain name. While functionally equivalent (both produce 'Aptos'), using the utility function maintains consistency and centralizes chain name normalization.

♻️ Proposed fix
-        chain: 'Aptos',
+        chain: utils.formatChain('aptos'),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/adaptors/aave-v3/index.js` at line 220, Replace the hardcoded chain:
'Aptos' value with utils.formatChain('aptos') in the adapter object in
src/adaptors/aave-v3/index.js (the object/property named "chain"); if
utils.formatChain is not in scope, add the appropriate import/require for the
shared utils module so utils.formatChain('aptos') can be used for consistent
chain name normalization with other Aptos adapters.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/adaptors/aave-v3/index.js`:
- Around line 203-205: The computed priceUsd uses marketRefDecimals (the integer
count) instead of the decimal scaling factor; change the division to use 10 **
marketRefDecimals (or Math.pow(10, marketRefDecimals)) so priceUsd =
(Number(r.priceInMarketReferenceCurrency) / (10 ** marketRefDecimals)) *
marketRefPriceUsd; update the expression in the price calculation (look for the
priceUsd variable and r.priceInMarketReferenceCurrency / marketRefDecimals) to
use the correct decimal factor to avoid values being orders of magnitude off.

---

Nitpick comments:
In `@src/adaptors/aave-v3/index.js`:
- Line 220: Replace the hardcoded chain: 'Aptos' value with
utils.formatChain('aptos') in the adapter object in
src/adaptors/aave-v3/index.js (the object/property named "chain"); if
utils.formatChain is not in scope, add the appropriate import/require for the
shared utils module so utils.formatChain('aptos') can be used for consistent
chain name normalization with other Aptos adapters.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1032891a-7a8d-4261-bb91-6b0dd1fa4f83

📥 Commits

Reviewing files that changed from the base of the PR and between a31e98c and 7759bcb.

📒 Files selected for processing (1)
  • src/adaptors/aave-v3/index.js

@0xkr3p
Copy link
Contributor

0xkr3p commented Mar 18, 2026

hi @mpsc0x can you install the package in /adaptors too? thanks

@mpsc0x
Copy link
Contributor Author

mpsc0x commented Mar 18, 2026

hi @mpsc0x can you install the package in /adaptors too? thanks

@0xkr3p done

@llamatester
Copy link

The aave-v3 adapter exports pools:

Test Suites: 1 passed, 1 total
Tests: 1918 passed, 1918 total
Snapshots: 0 total
Time: 0.606 s
Ran all test suites.

Nb of pools: 213
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬───────────┬─────────────────────┬────────────────────┬────────────────────────┬──────────────────────────────────────────────────┬────────────────────┬────────────────────┬────────────────┬──────────────────────┬────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬────────────┬────────────┬──────────┐
│ (index) │ pool                                                  │ chain      │ project   │ symbol              │ tvlUsd             │ apyBase                │ underlyingTokens                                 │ totalSupplyUsd     │ totalBorrowUsd     │ debtCeilingUsd │ apyBaseBorrow        │ ltv    │ url                                                                                                                             │ borrowable │ mintedCoin │ poolMeta │
├─────────┼───────────────────────────────────────────────────────┼────────────┼───────────┼─────────────────────┼────────────────────┼────────────────────────┼──────────────────────────────────────────────────┼────────────────────┼────────────────────┼────────────────┼──────────────────────┼────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼────────────┼────────────┼──────────┤
│ 0       │ '0xbdfa7b7893081b35fb54027489e2bc7a38275129-ethereum' │ 'ethereum' │ 'aave-v3' │ 'weETH'             │ 4756861985.63333   │ 0.00009756849651480808 │ [ '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee' ] │ 4757702589.852918  │ 840604.219587326   │ null           │ 1.0041222763865063   │ 0.775  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 1       │ '0x0b925ed163218f6662a35e0f0371ac234f9e9371-ethereum' │ 'ethereum' │ 'aave-v3' │ 'wstETH'            │ 3492988216.62306   │ 0.0012973978610835728  │ [ '0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0' ] │ 3638377379.4433193 │ 145389162.8202591  │ null           │ 0.04994993392862264  │ 0.785  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 2       │ '0x5ee5bf7ae06d1be5997a1a72006fe6c607ec6de8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WBTC'              │ 2886258458.1831775 │ 0.004230580009772273   │ [ '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599' ] │ 2962182913.3907495 │ 75924455.20757198  │ null           │ 0.33010028276373843  │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x2260fac5e5542a773aa44fbcfedf7c193bc2c599&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 3       │ '0x5c647ce0ae10658ec44fa4e11a51c96e94efd1dd-ethereum' │ 'ethereum' │ 'aave-v3' │ 'cbBTC'             │ 1831927706.6907606 │ 0.001897079972683724   │ [ '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' ] │ 1854552694.6591074 │ 22624987.968346834 │ null           │ 0.31099946163052333  │ 0.73   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 4       │ '0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDC'              │ 950547606.5463269  │ 2.06794385631778       │ [ '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' ] │ 3481404913.380415  │ 2530857306.8340883 │ null           │ 3.160729953419318    │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 5       │ '0x2d62109243b87c4ba3ee7ba1d91b0dd0a074d7b1-ethereum' │ 'ethereum' │ 'aave-v3' │ 'rsETH'             │ 916027990.363233   │ 1.5276486516269467e-7  │ [ '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7' ] │ 916126462.8576669  │ 98472.49443387985  │ null           │ 0.001672033755279603 │ 0      │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xa1290d69c65a6fe4df752f95823fae25cb99e5a7&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 6       │ '0x4579a27af00a62c0eb156349f31b345c08386419-ethereum' │ 'ethereum' │ 'aave-v3' │ 'sUSDe'             │ 900100158.7160963  │ 0                      │ [ '0x9D39A5DE30e57443BfF2A8307A4256c8797A3497' ] │ 900100158.7160963  │ 0                  │ null           │ 0                    │ 0      │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0x9d39a5de30e57443bff2a8307a4256c8797a3497&marketName=proto_mainnet_v3' │ false      │ null       │ null     │
│ 7       │ '0x23878914efe38d27c4d67ab83ed1b93a74d4086a-ethereum' │ 'ethereum' │ 'aave-v3' │ 'USDT'              │ 811072563.1077412  │ 2.5821588459297034     │ [ '0xdAC17F958D2ee523a2206206994597C13D831ec7' ] │ 4321799878.935258  │ 3510727315.8275166 │ null           │ 3.5318871223721766   │ 0.75   │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xdac17f958d2ee523a2206206994597c13d831ec7&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 8       │ '0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8-ethereum' │ 'ethereum' │ 'aave-v3' │ 'WETH'              │ 764092355.9153215  │ 1.6853791593749925     │ [ '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2' ] │ 6423411521.869174  │ 5659319165.953853  │ null           │ 2.250504903189471    │ 0.805  │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&marketName=proto_mainnet_v3' │ true       │ null       │ null     │
│ 9       │ '0x53349cbed7a3f851f0722bf3fa8f1b93fa939bef-plasma'   │ 'plasma'   │ 'aave-v3' │ 'PT-sUSDE-9APR2026' │ 548417564.8218517  │ 0                      │ [ '0xab509448ad489e2E1341e25CC500f2596464Cc82' ] │ 548417564.8218517  │ 0                  │ null           │ 0                    │ 0.0005 │ 'https://app.aave.com/reserve-overview/?underlyingAsset=0xab509448ad489e2e1341e25cc500f2596464cc82&marketName=proto_plasma_v3'  │ false      │ null       │ null     │
└─────────┴───────────────────────────────────────────────────────┴────────────┴───────────┴─────────────────────┴────────────────────┴────────────────────────┴──────────────────────────────────────────────────┴────────────────────┴────────────────────┴────────────────┴──────────────────────┴────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴────────────┴────────────┴──────────┘
This adapter contains some pools with <10k TVL, these pools won't be shown in DefiLlama

@0xkr3p 0xkr3p merged commit eb9c951 into DefiLlama:master Mar 18, 2026
2 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.

3 participants