Skip to content

add basalt-vault yield adapter#2841

Open
andrepurr wants to merge 1 commit into
DefiLlama:masterfrom
andrepurr:basalt-vault-adapter
Open

add basalt-vault yield adapter#2841
andrepurr wants to merge 1 commit into
DefiLlama:masterfrom
andrepurr:basalt-vault-adapter

Conversation

@andrepurr

@andrepurr andrepurr commented Jul 22, 2026

Copy link
Copy Markdown

Basalt Vault — delta-neutral GMX v2 GM (BTC/USD) vaults on Arbitrum, hedged with a WBTC borrow on Dolomite. TVL adapter is already merged (protocol id 8191, slug basalt-vault, DefiLlama-Adapters #19907).

One aggregate pool across all user vaults:

  • tvlUsd: net equity (GM collateral - WBTC debt) read from DolomiteMargin on-chain
  • apyBase: live net apy = GM trailing-7d realized fee apr (same GMX subgraph + math as the gmx-v2-perps adapter) minus the Dolomite WBTC borrow rate (getMarketInterestRate), each leg weighted by the actual on-chain leverage, then net of the protocol's 20% performance fee on profit

test: 11/11 pass
sample pool right now: tvlUsd ~118k, apyBase ~8.7% net (7.5% gm fee apr x 2.05 leverage - 4.4% wbtc borrow apr x 1.05, x 0.8 after the 20% performance fee)

Summary by CodeRabbit

  • New Features
    • Added support for tracking Basalt Vault on Arbitrum.
    • Reports the vault’s total value locked and estimated base APY.
    • APY calculations account for GMX fee earnings, borrowing costs, and performance fees.
    • Aggregates data across eligible vaults and excludes inactive vault positions.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds an Arbitrum Basalt Vault adapter that discovers vaults, values Dolomite positions, derives GM fee APR from GMX data, calculates aggregate TVL and net APY, and exports adapter metadata.

Changes

Basalt Vault APY Adapter

Layer / File(s) Summary
On-chain integration helpers
src/adaptors/basalt-vault/index.js
Defines Arbitrum addresses, ABI fragments, and helpers for single and batched contract calls.
GM fee APR calculation
src/adaptors/basalt-vault/index.js
Queries trailing seven-day GMX fee growth and converts it into annualized GM fee APR.
Vault aggregation and adapter export
src/adaptors/basalt-vault/index.js
Discovers vaults, values Dolomite collateral and WBTC surplus or debt, calculates TVL and performance-fee-adjusted APY, and exports adapter metadata.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant apy
  participant BasaltFactory
  participant Dolomite
  participant GMXSubgraph
  apy->>BasaltFactory: Enumerate GM token vaults
  apy->>Dolomite: Read positions, prices, and borrow rate
  apy->>GMXSubgraph: Query trailing seven-day GM fee data
  apy-->>apy: Calculate TVL and net APY
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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 a Basalt Vault yield adapter.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@andrepurr

Copy link
Copy Markdown
Author

updated: apyBase is now net of the protocol's 20% performance fee on profit — sample right now ~8.6% (10.8% strategy net x 0.8). tests still 11/11.

@github-actions

Copy link
Copy Markdown

The basalt-vault adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬─────────────┬────────────────────┬────────────────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────────┬───────────────────┐
│ (index) │ pool                                                  │ chain      │ project        │ symbol      │ tvlUsd             │ apyBase            │ underlyingTokens                                 │ poolMeta                                             │ url               │
├─────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼─────────────┼────────────────────┼────────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────────┼───────────────────┤
│ 0       │ '0x08e466fb09617d16ed27da9ea43ba601665f3b89-arbitrum' │ 'Arbitrum' │ 'basalt-vault' │ 'WBTC-USDC' │ 118000.12789022204 │ 10.786822340674753 │ [ '0x47c031236e19d024b42f8AE6780E44A573170703' ] │ 'Delta-neutral GM BTC/USD, WBTC-hedged via Dolomite' │ 'https://btva.io' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴─────────────┴────────────────────┴────────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────────┴───────────────────┘

@andrepurr
andrepurr force-pushed the basalt-vault-adapter branch 2 times, most recently from a1042a2 to 5649cca Compare July 22, 2026 19:08
@github-actions

Copy link
Copy Markdown

The basalt-vault adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬─────────────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────────┬───────────────────┐
│ (index) │ pool                                                  │ chain      │ project        │ symbol      │ tvlUsd             │ apyBase           │ underlyingTokens                                 │ poolMeta                                             │ url               │
├─────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼─────────────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────────┼───────────────────┤
│ 0       │ '0x08e466fb09617d16ed27da9ea43ba601665f3b89-arbitrum' │ 'Arbitrum' │ 'basalt-vault' │ 'WBTC-USDC' │ 117983.09615639191 │ 8.631184636278475 │ [ '0x47c031236e19d024b42f8AE6780E44A573170703' ] │ 'Delta-neutral GM BTC/USD, WBTC-hedged via Dolomite' │ 'https://btva.io' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴─────────────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────────┴───────────────────┘

@github-actions

Copy link
Copy Markdown

The basalt-vault adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬─────────────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────────┬───────────────────┐
│ (index) │ pool                                                  │ chain      │ project        │ symbol      │ tvlUsd             │ apyBase           │ underlyingTokens                                 │ poolMeta                                             │ url               │
├─────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼─────────────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────────┼───────────────────┤
│ 0       │ '0x08e466fb09617d16ed27da9ea43ba601665f3b89-arbitrum' │ 'Arbitrum' │ 'basalt-vault' │ 'WBTC-USDC' │ 117982.85394155227 │ 8.629804711527001 │ [ '0x47c031236e19d024b42f8AE6780E44A573170703' ] │ 'Delta-neutral GM BTC/USD, WBTC-hedged via Dolomite' │ 'https://btva.io' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴─────────────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────────┴───────────────────┘

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/adaptors/basalt-vault/index.js`:
- Line 88: Update the annualization calculation in the fee computation to use
the full 365/7 factor instead of Math.floor(365 / 7), preserving the documented
math and parity with gmx-v2-perps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 696ca88f-3349-47eb-9893-7ad13d1159c8

📥 Commits

Reviewing files that changed from the base of the PR and between 83ee686 and 5649cca.

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

Comment thread src/adaptors/basalt-vault/index.js
@andrepurr
andrepurr force-pushed the basalt-vault-adapter branch from 5649cca to e2e8ef8 Compare July 23, 2026 07:04
@github-actions

Copy link
Copy Markdown

The basalt-vault adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬─────────────┬───────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬──────────────────────────────────────────────────────┬───────────────────┐
│ (index) │ pool                                                  │ chain      │ project        │ symbol      │ token │ tvlUsd             │ apyBase           │ underlyingTokens                                 │ poolMeta                                             │ url               │
├─────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼─────────────┼───────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼──────────────────────────────────────────────────────┼───────────────────┤
│ 0       │ '0x08e466fb09617d16ed27da9ea43ba601665f3b89-arbitrum' │ 'Arbitrum' │ 'basalt-vault' │ 'WBTC-USDC' │ null  │ 118289.64837420103 │ 8.937503879646787 │ [ '0x47c031236e19d024b42f8AE6780E44A573170703' ] │ 'Delta-neutral GM BTC/USD, WBTC-hedged via Dolomite' │ 'https://btva.io' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴─────────────┴───────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴──────────────────────────────────────────────────────┴───────────────────┘

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/adaptors/basalt-vault/index.js`:
- Line 16: Update the graphql-request import used by the Basalt vault adapter to
avoid CommonJS loading against the pinned ESM-only v7 dependency. Either align
the dependency version with the existing CommonJS adapter pattern or replace the
import with a supported ESM boundary, while preserving the adapter’s GraphQL
request behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ebbf8a8-278d-4aef-a147-138ae3d4c179

📥 Commits

Reviewing files that changed from the base of the PR and between 5649cca and e2e8ef8.

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

Comment thread src/adaptors/basalt-vault/index.js Outdated
@andrepurr
andrepurr force-pushed the basalt-vault-adapter branch from e2e8ef8 to d74de3b Compare July 23, 2026 07:23
@github-actions

Copy link
Copy Markdown

The basalt-vault adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬─────────────┬───────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────┬───────────────────┐
│ (index) │ pool                                                  │ chain      │ project        │ symbol      │ token │ tvlUsd             │ apyBase           │ underlyingTokens                                 │ poolMeta                                                                  │ url               │
├─────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼─────────────┼───────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────┼───────────────────┤
│ 0       │ '0x08e466fb09617d16ed27da9ea43ba601665f3b89-arbitrum' │ 'Arbitrum' │ 'basalt-vault' │ 'WBTC-USDC' │ null  │ 118342.80962574811 │ 8.932083264760983 │ [ '0x47c031236e19d024b42f8AE6780E44A573170703' ] │ 'Delta-neutral GM BTC/USD, WBTC-hedged on Dolomite — isolated NFT vaults' │ 'https://btva.io' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴─────────────┴───────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────┴───────────────────┘

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/adaptors/basalt-vault/index.js`:
- Around line 85-86: Update the fee-APR calculation around the start and recent
cumulative fee values to detect missing query rows before converting them to
numbers. If either res.start or res.recent is empty, skip or short-circuit the
APR calculation instead of defaulting the missing value to 0; preserve normal
delta calculation when both series are present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 45f7e46b-7ddc-4eab-88a5-f7b97565f8aa

📥 Commits

Reviewing files that changed from the base of the PR and between e2e8ef8 and d74de3b.

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

Comment thread src/adaptors/basalt-vault/index.js Outdated
@andrepurr
andrepurr force-pushed the basalt-vault-adapter branch from d74de3b to 145973f Compare July 23, 2026 14:28
@github-actions

Copy link
Copy Markdown

The basalt-vault adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬─────────────┬───────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬───────────────────────────────────────────────────────────────────────────┬───────────────────┐
│ (index) │ pool                                                  │ chain      │ project        │ symbol      │ token │ tvlUsd             │ apyBase           │ underlyingTokens                                 │ poolMeta                                                                  │ url               │
├─────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼─────────────┼───────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼───────────────────────────────────────────────────────────────────────────┼───────────────────┤
│ 0       │ '0x08e466fb09617d16ed27da9ea43ba601665f3b89-arbitrum' │ 'Arbitrum' │ 'basalt-vault' │ 'WBTC-USDC' │ null  │ 118417.43304166108 │ 8.730013768751949 │ [ '0x47c031236e19d024b42f8AE6780E44A573170703' ] │ 'Delta-neutral GM BTC/USD, WBTC-hedged on Dolomite — isolated NFT vaults' │ 'https://btva.io' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴─────────────┴───────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴───────────────────────────────────────────────────────────────────────────┴───────────────────┘

@andrepurr
andrepurr force-pushed the basalt-vault-adapter branch from 145973f to af6aff3 Compare July 23, 2026 14:55
@github-actions

Copy link
Copy Markdown

The basalt-vault adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬─────────────┬───────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬─────────────────────────────────────────────────────┐
│ (index) │ pool                                                  │ chain      │ project        │ symbol      │ token │ tvlUsd             │ apyBase           │ underlyingTokens                                 │ poolMeta                                            │
├─────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼─────────────┼───────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────────┤
│ 0       │ '0x08e466fb09617d16ed27da9ea43ba601665f3b89-arbitrum' │ 'Arbitrum' │ 'basalt-vault' │ 'WBTC-USDC' │ null  │ 118455.78943018096 │ 8.628275629340921 │ [ '0x47c031236e19d024b42f8AE6780E44A573170703' ] │ 'Delta-neutral GM BTC/USD, WBTC-hedged on Dolomite' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴─────────────┴───────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴─────────────────────────────────────────────────────┘

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/adaptors/basalt-vault/index.js`:
- Line 16: Update the graphql-request import destructuring to bind request from
its named request export while retaining gql, so the request invocation in apy()
uses the actual function exposed by graphql-request v7.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8da9cf3d-ff75-4988-abcd-2bb20632f00e

📥 Commits

Reviewing files that changed from the base of the PR and between 145973f and af6aff3.

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

Comment thread src/adaptors/basalt-vault/index.js Outdated
@andrepurr
andrepurr force-pushed the basalt-vault-adapter branch from af6aff3 to ce7758c Compare July 23, 2026 22:45
@github-actions

Copy link
Copy Markdown

The basalt-vault adapter exports pools:

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

Nb of pools: 1
 

Sample pools:
┌─────────┬───────────────────────────────────────────────────────┬────────────┬────────────────┬─────────────┬───────┬────────────────────┬───────────────────┬──────────────────────────────────────────────────┬─────────────────────────────────────────────────────┐
│ (index) │ pool                                                  │ chain      │ project        │ symbol      │ token │ tvlUsd             │ apyBase           │ underlyingTokens                                 │ poolMeta                                            │
├─────────┼───────────────────────────────────────────────────────┼────────────┼────────────────┼─────────────┼───────┼────────────────────┼───────────────────┼──────────────────────────────────────────────────┼─────────────────────────────────────────────────────┤
│ 0       │ '0x08e466fb09617d16ed27da9ea43ba601665f3b89-arbitrum' │ 'Arbitrum' │ 'basalt-vault' │ 'WBTC-USDC' │ null  │ 118387.41150237387 │ 8.577674364837634 │ [ '0x47c031236e19d024b42f8AE6780E44A573170703' ] │ 'Delta-neutral GM BTC/USD, WBTC-hedged on Dolomite' │
└─────────┴───────────────────────────────────────────────────────┴────────────┴────────────────┴─────────────┴───────┴────────────────────┴───────────────────┴──────────────────────────────────────────────────┴─────────────────────────────────────────────────────┘

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