Skip to content

Update CurrentX V2 and add V3 TVL#17955

Open
DocPis wants to merge 12 commits intoDefiLlama:mainfrom
DocPis:main
Open

Update CurrentX V2 and add V3 TVL#17955
DocPis wants to merge 12 commits intoDefiLlama:mainfrom
DocPis:main

Conversation

@DocPis
Copy link
Contributor

@DocPis DocPis commented Feb 7, 2026

NOTE

Please enable "Allow edits by maintainers" while putting up the PR.


  • If you would like to add a volume/fees/revenue adapter please submit the PR here.
  • If you would like to add a liquidations adapter, please refer to this readme document for details.
  1. Once your adapter has been merged, it takes time to show on the UI. If more than 24 hours have passed, please let us know in Discord.
  2. Sorry, We no longer accept fetch adapter for new projects, we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
  3. Please fill the form below only if the PR is for listing a new protocol else it can be ignored/replaced with reason/details about the PR
  4. For updating listing info It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR
  5. Do not edit/push package-lock.json file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI
  6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap

Name (to be shown on DefiLlama):
CurrentX Already Listed https://defillama.com/protocol/currentx

Twitter Link:
https://x.com/currentxdex

List of audit links if any:
Website Link:
https://currentx.app/

Logo (High resolution, will be shown with rounded borders):
currentx
Current TVL:
5K

Treasury Addresses (if the protocol has treasury)
Chain:
MegaETH

Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed): (https://api.coingecko.com/api/v3/coins/list)
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed): (https://api.coinmarketcap.com/data-api/v3/map/all?listing_status=active,inactive,untracked&start=1&limit=10000)
Short Description (to be shown on DefiLlama):
High-performance decentralized exchange on MegaETH

Token address and ticker if any:
0xBd5e387fa453ceBf03B1A6a9dFe2a828b93AA95B (CRX)

Category (full list at https://defillama.com/categories) *Please choose only one:
DEX

Oracle Provider(s): Specify the oracle(s) used (e.g., Chainlink, Band, API3, TWAP, etc.):
Implementation Details: Briefly describe how the oracle is integrated into your project:
Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage:
forkedFrom (Does your project originate from another project):
Uniswap V2 / Uniswap V3

methodology (what is being counted as tvl, how is tvl being calculated):
Github org/user (Optional, if your code is open source, we can track activity):
Does this project have a referral program?

Summary by CodeRabbit

  • New Features
    • Added TVL calculation support for CurrentX on MegaEth, providing on-chain value data for that network.
    • Added CurrentX V3 TVL adapter for MegaEth, using Uniswap V3-based token discovery and historical sync to improve accuracy and coverage.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 7, 2026

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 two CommonJS adapter modules for CurrentX on MegaEth: a uniTvlExport-based TVL adapter (with a specified fromBlock) and a uniV3Export-based Uniswap V3 adapter configured with a factory address and fromBlock.

Changes

Cohort / File(s) Summary
CurrentX uniTvl export
projects/currentx/index.ts
New CommonJS module: imports uniTvlExport from ../helper/unknownTokens and exports uniTvlExport('megaeth', '0xc60940f182f7699522970517f6d753a560546937', { fromBlock: 7349750 }).
CurrentX-v3 Uniswap V3 wiring
projects/currentx-v3/index.js
New module: requires uniV3Export from ../helper/uniswapV3 and exports uniV3Export configured for megaeth with factory: '0x09cF8A0b9e8C89bff6d1ACbe1467e8E335Bdd03E' and fromBlock: 7357543.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • g1nt0ki

Poem

🐰 I hopped through code with a tiny cheer,

Wired TVL and V3 so MegaEth can hear.
A factory, a block, a nibble of art—
I stitched up exports with a joyful heart.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR description includes template boilerplate but lacks substantive protocol metadata and implementation details required for new adapter listing. Provide comprehensive implementation details, clarify whether this is a new listing or update, include TVL calculation methodology, and confirm all required metadata (name, links, chain, category) are properly filled.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Update CurrentX V2 and add V3 TVL' clearly and accurately describes the main changes: updating the V2 adapter and adding V3 TVL support for CurrentX.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

@llamabutler
Copy link

Error while running adapter at projects/currentx-v3:

Error: Cannot find module '/home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/projects/currentx-v3'
Require stack:
- /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/test.js
Truncated error stack:

    at /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/test.js:137:12
    at Object.<anonymous> (/home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/test.js:275:3)
Error saving cache: Error: ENOENT: no such file or directory, open '/home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/node_modules/.pnpm/@defillama+sdk@5.0.206_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10/node_modules/@defillama/sdk/build/util/local_cache/zlib-1.0/BlockCache.json'

@llamabutler
Copy link

The adapter at projects/currentx-v3 exports TVL:

megaeth                   146.00

total                    146.16 

@llamabutler
Copy link

The adapter at projects/currentx exports TVL:

megaeth                   20.00
megaeth-staking           0.00
staking                   0.00

total                    20.34 

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

🤖 Fix all issues with AI agents
In `@projects/currentx-v3/index.ts`:
- Around line 44-54: The loop silently skips tokens when parseUnits throws due
to too-many-fractional-digits; modify the block that reads t.totalValueLocked
and calls parseUnits (inside the for (const t of tokens) loop) to first
normalize/truncate the fractional part to at most Number(t.decimals) digits:
convert t.decimals to a Number, split t.totalValueLocked on '.', truncate the
fraction to decimals length (pad none), rebuild the numeric string, then call
parseUnits(normalizedString, decimals) and call api.add(t.id, amt) as before;
keep the try/catch but only catch genuinely unexpected errors (or at least
preserve current behavior) so tokens with valid-TVl but excess precision are not
silently dropped.
🧹 Nitpick comments (1)
projects/currentx-v3/index.ts (1)

9-11: Environment variable override is unlikely to be used in DefiLlama's infrastructure.

DefiLlama adapters typically don't use environment-variable-driven URLs. This isn't harmful, but the env var (CURRENTX_GRAPHQL_URL) will never be set in production. Consider removing it for simplicity, or keep it if useful for local testing.

Updated tvl function to handle fractional digits correctly.
Copy link
Contributor Author

@DocPis DocPis left a comment

Choose a reason for hiding this comment

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

Added truncation of fractional digits to token decimals before parseUnits to avoid silently skipping valid TVL values.

@llamabutler
Copy link

The adapter at projects/currentx-v3 exports TVL:

megaeth                   3.10 k

total                    3.10 k 

@llamabutler
Copy link

The adapter at projects/currentx exports TVL:

megaeth                   0.00
megaeth-staking           0.00
staking                   0.00

total                    0.00 

@llamabutler
Copy link

The adapter at projects/currentx-v3 exports TVL:

megaeth                   4.22 k

total                    4.22 k 

@llamabutler
Copy link

The adapter at projects/currentx exports TVL:

megaeth                   0.00
megaeth-staking           0.00
staking                   0.00

total                    0.00 

@llamabutler
Copy link

The adapter at projects/currentx-v3 exports TVL:

megaeth                   4.22 k

total                    4.23 k 

@llamabutler
Copy link

The adapter at projects/currentx exports TVL:

megaeth                   0.00
megaeth-staking           0.00
staking                   0.00

total                    0.00 

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

🤖 Fix all issues with AI agents
In `@projects/currentx/index.ts`:
- Line 4: The call to uniTvlExport is malformed: add the missing opening brace
to make the options an object and the missing closing parenthesis to end the
function call; specifically, change the argument list around the fromBlock
option so uniTvlExport('megaeth', '0xc60940f182f7699522970517f6d753a560546937',
{ fromBlock: 7349750 }) is passed (fixing the syntax around the uniTvlExport
invocation).

const { uniTvlExport } = require("../helper/unknownTokens");


module.exports = uniTvlExport('megaeth', '0xc60940f182f7699522970517f6d753a560546937', fromBlock: 7349750 },
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Syntax error: missing opening { and closing ).

Line 4 is missing the opening brace for the options object and the closing parenthesis for the function call. This will cause a parse error and prevent the module from loading — likely the root cause of the CI failure.

🐛 Proposed fix
-module.exports = uniTvlExport('megaeth', '0xc60940f182f7699522970517f6d753a560546937', fromBlock: 7349750 },
+module.exports = uniTvlExport('megaeth', '0xc60940f182f7699522970517f6d753a560546937', { fromBlock: 7349750 });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
module.exports = uniTvlExport('megaeth', '0xc60940f182f7699522970517f6d753a560546937', fromBlock: 7349750 },
module.exports = uniTvlExport('megaeth', '0xc60940f182f7699522970517f6d753a560546937', { fromBlock: 7349750 });
🧰 Tools
🪛 Biome (2.3.13)

[error] 4-4: expected , but instead found :

Remove :

(parse)


[error] 4-4: expected ) but instead the file ends

the file ends here

(parse)

🤖 Prompt for AI Agents
In `@projects/currentx/index.ts` at line 4, The call to uniTvlExport is malformed:
add the missing opening brace to make the options an object and the missing
closing parenthesis to end the function call; specifically, change the argument
list around the fromBlock option so uniTvlExport('megaeth',
'0xc60940f182f7699522970517f6d753a560546937', { fromBlock: 7349750 }) is passed
(fixing the syntax around the uniTvlExport invocation).

@llamabutler
Copy link

The adapter at projects/currentx-v3 exports TVL:

megaeth                   4.23 k

total                    4.23 k 

@llamabutler
Copy link

The adapter at projects/currentx exports TVL:

megaeth                   0.00
megaeth-staking           0.00
staking                   0.00

total                    0.00 

@DocPis
Copy link
Contributor Author

DocPis commented Feb 10, 2026

Update V2 config and add V3 TVL

@llamabutler
Copy link

The adapter at projects/currentx-v3 exports TVL:

megaeth                   6.16 k

total                    6.16 k 

@llamabutler
Copy link

Error while running adapter at projects/currentx:

Error: Cannot find module '/home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/projects/currentx'
Require stack:
- /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/test.js
Truncated error stack:

    at /home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/test.js:137:12
    at Object.<anonymous> (/home/runner/work/DefiLlama-Adapters/DefiLlama-Adapters/test.js:275:3)

@llamabutler
Copy link

The adapter at projects/currentx exports TVL:

megaeth                   36.00

total                    36.43 

@llamabutler
Copy link

The adapter at projects/currentx-v3 exports TVL:

megaeth                   6.17 k

total                    6.17 k 

@DocPis DocPis requested a review from RohanNero February 12, 2026 19:16
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