Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds 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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
Error while running adapter at projects/currentx-v3: |
|
The adapter at projects/currentx-v3 exports TVL: |
|
The adapter at projects/currentx exports TVL: |
There was a problem hiding this comment.
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.
DocPis
left a comment
There was a problem hiding this comment.
Added truncation of fractional digits to token decimals before parseUnits to avoid silently skipping valid TVL values.
|
The adapter at projects/currentx-v3 exports TVL: |
|
The adapter at projects/currentx exports TVL: |
|
The adapter at projects/currentx-v3 exports TVL: |
|
The adapter at projects/currentx exports TVL: |
|
The adapter at projects/currentx-v3 exports TVL: |
|
The adapter at projects/currentx exports TVL: |
There was a problem hiding this comment.
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).
projects/currentx/index.ts
Outdated
| const { uniTvlExport } = require("../helper/unknownTokens"); | ||
|
|
||
|
|
||
| module.exports = uniTvlExport('megaeth', '0xc60940f182f7699522970517f6d753a560546937', fromBlock: 7349750 }, |
There was a problem hiding this comment.
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.
| 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).
|
The adapter at projects/currentx-v3 exports TVL: |
|
The adapter at projects/currentx exports TVL: |
|
Update V2 config and add V3 TVL |
|
The adapter at projects/currentx-v3 exports TVL: |
|
Error while running adapter at projects/currentx: |
|
The adapter at projects/currentx exports TVL: |
|
The adapter at projects/currentx-v3 exports TVL: |
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
package-lock.jsonfile as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CIName (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