Skip to content

meteora: add protocol fees for volatile pools#7967

Open
DaniiRix wants to merge 1 commit into
DefiLlama:masterfrom
DaniiRix:fix/meteora
Open

meteora: add protocol fees for volatile pools#7967
DaniiRix wants to merge 1 commit into
DefiLlama:masterfrom
DaniiRix:fix/meteora

Conversation

@DaniiRix

@DaniiRix DaniiRix commented Jul 5, 2026

Copy link
Copy Markdown
Contributor
  • Split fee_volume per pool by on-chain protocol_trade_fee: verified via getAccountInfo on one volatile and one stable DAMM v1 pool — 20% protocol / 80% LP on volatile pools, 0% / 100% LP on stable pools.
  • dailyFees (gross) → dailyRevenue/dailyProtocolRevenue (protocol cut) + dailySupplySideRevenue (LP cut), using Balances + METRIC labels.
  • Added methodology + breakdownMethodology for every field.

@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: b6951cdc-0089-473a-9217-541d5f56ea80

📥 Commits

Reviewing files that changed from the base of the PR and between 476f10b and ad66827.

📒 Files selected for processing (1)
  • dexs/meteora/index.ts

Summary by CodeRabbit

  • New Features
    • Added richer Meteora pool reporting with separate daily fee, revenue, protocol revenue, and supply-side revenue figures.
    • Expanded daily metrics to distinguish between volume and multiple fee/revenue breakdowns.
  • Documentation
    • Added clearer methodology details for how Meteora metrics are calculated and split.
  • Bug Fixes
    • Improved validation during metric calculation to catch invalid values more reliably.

Walkthrough

The Meteora dex adapter's fetch function was updated to split fees into protocol and LP shares based on pool type (stable vs volatile), computing dailyRevenue, dailyProtocolRevenue, and dailySupplySideRevenue alongside dailyFees and dailyVolume using typed balance objects. Methodology metadata was also added to the exported configuration.

Changes

Meteora Fee Split and Metadata

Layer / File(s) Summary
Fee-splitting fetch logic
dexs/meteora/index.ts
Introduces protocolFeeRatio(poolType) (0% stable, 20% of LP fee for volatile pools), expands Pool interface with pool_type, updates accumulators (dailyVolume, grossFees, protocolFees, lpFees) with revised NaN validation, and replaces numeric return values with createBalances()/addUSDValue() typed balances for fees, revenue, protocol revenue, and supply-side revenue.
Methodology metadata and export wiring
dexs/meteora/index.ts
Adds methodology and breakdownMethodology constants documenting metric derivation and fee-split rules, wired into the default export.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: dexs, methodology, bug-fix

🚥 Pre-merge checks | ✅ 11 | ❌ 4

❌ Failed checks (4 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title is relevant, but it does not follow the required [type] protocol-name - description format. Rewrite it as [type] meteora - brief description, using the repository's required prefix and structure.
Pullhourly Required For Version 2 ⚠️ Warning Meteora is version 2 but its export lacks any explicit pullHourly setting, which the check requires. Add pullHourly: true to the Meteora v2 export, or use pullHourly: false with a comment if hourly pulls are impossible.
Adapter Shape ⚠️ Warning Meteora uses adapter:{[CHAIN.SOLANA]:{...start}} for a single chain, but the repo prefers chains:[CHAIN.SOLANA] with a top-level start in this case. Refactor to a SimpleAdapter shape: set chains:[CHAIN.SOLANA], move start to top level, and keep fetch at top level unless per-chain config truly differs.
Methodology Keys ⚠️ Warning dexs/meteora/index.ts uses UserFees in methodology, but the allowed methodology keys are display names like Fees/Revenue/Volume only. Rename or remove UserFees; keep methodology keys limited to the approved dimension display names, and put the user-fee text under Fees if needed.
✅ Passed checks (11 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly summarizes the fee split and metadata changes, which is sufficient for an update PR.
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.
Breakdown Methodology Check ✅ Passed All .addUSDValue labels (SWAP_FEES, PROTOCOL_FEES, LP_FEES) have matching breakdownMethodology entries, and breakdownMethodology is exported in default.
Income Statement Compliance ✅ Passed dailyFees is gross swap fees, dailyRevenue is protocolFees, and dailySupplySideRevenue is lpFees; grossFees = protocolFees + lpFees, so dailyRevenue = dailyFees - dailySupplySideRevenue.
Version 2 Required ✅ Passed Meteora’s adapter export declares version: 2, so it satisfies the required format.
Dune Adapters Are Version 1 ✅ Passed PASS: dexs/meteora/index.ts uses only HTTP fetches, with no Dune helpers or TIME_RANGE macros, so the version-1 Dune rule doesn’t apply.
Income Statement Balance ✅ Passed Meteora now splits gross fees into protocol and LP shares, so dailyFees equals dailyRevenue + dailySupplySideRevenue by construction.
Fetchoptions Usage ✅ Passed Meteora uses fetch(options: FetchOptions), consumes options via createBalances, returns no timestamp, and doesn't use startOfDay/raw timestamp logic.
Efficiency And Error Handling ✅ Passed PASS: The changed Meteora adapter has no getLogs/multiCall/allowNegativeValue or swallow-catch patterns, and the only new fee constant (0.2) is source-commented.
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

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.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

The meteora adapter exports:

> adapters@1.0.0 test
> ts-node --transpile-only cli/testAdapter.ts dexs meteora

🦙 Running METEORA adapter 🦙
---------------------------------------------------
Start Date:	Sat, 04 Jul 2026 04:48:53 GMT
End Date:	Sun, 05 Jul 2026 04:48:53 GMT
---------------------------------------------------

SOLANA 👇
Backfill start time: 30/4/2024
Daily volume: 987.33 k
Daily fees: 4.31 k
Daily user fees: 4.31 k
Daily revenue: 855.00
Daily protocol revenue: 855.00
Daily supply side revenue: 3.45 k
End timestamp: 1783226932 (2026-07-05T04:48:52.000Z)




FEES BREAKDOWN 👇

label           | Daily fees | Daily supply side revenue | Daily revenue
---             | ---        | ---                       | ---          
Token Swap Fees | 4307       |                           |              
LP Fees         |            | 3451                      |              
Protocol Fees   |            |                           | 855          

@bheluga bheluga self-assigned this Jul 6, 2026
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.

2 participants