feat: add LunarBase PMM volume adapter#6286
feat: add LunarBase PMM volume adapter#6286NebulaNomadPixel wants to merge 1 commit intoDefiLlama:masterfrom
Conversation
Track daily swap volume and fees for LunarBase CurvePMM pool on Base (ETH/USDC). Reads SwapExecuted events from the pool contract. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughA new Curve-based DEX adapter for LunarBase is introduced with a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
The lunarbase adapter exports: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@dexs/lunarbase/index.ts`:
- Line 3: The dailyVolume is undercounted because addOneToken only records one
side of a swap; update the handling in dexs/lunarbase/index.ts so both legs are
recorded: either call addOneToken twice (once for dx and once for dy) where
dailyVolume is updated, or modify/add a helper that accepts both token/amount
pairs and increments both tokens' volumes; ensure you reference the dx and dy
variables and the addOneToken function so both token-level swap volumes are
incremented for each event.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| @@ -0,0 +1,44 @@ | |||
| import { FetchOptions, SimpleAdapter } from "../../adapters/types"; | |||
| import { CHAIN } from "../../helpers/chains"; | |||
| import { addOneToken } from "../../helpers/prices"; | |||
There was a problem hiding this comment.
dailyVolume is undercounted here because addOneToken records only one side.
addOneToken does not add both dx and dy; it selects one token by core-asset heuristic. For token-level swap volume, this drops one leg on every event.
Proposed fix
-import { addOneToken } from "../../helpers/prices";
@@
- addOneToken({ chain: options.chain, balances: dailyVolume, token0: tokenX, token1: tokenY, amount0: dx, amount1: dy });
+ dailyVolume.add(tokenX, dx);
+ dailyVolume.add(tokenY, dy);Also applies to: 26-26
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@dexs/lunarbase/index.ts` at line 3, The dailyVolume is undercounted because
addOneToken only records one side of a swap; update the handling in
dexs/lunarbase/index.ts so both legs are recorded: either call addOneToken twice
(once for dx and once for dy) where dailyVolume is updated, or modify/add a
helper that accepts both token/amount pairs and increments both tokens' volumes;
ensure you reference the dx and dy variables and the addOneToken function so
both token-level swap volumes are incremented for each event.
bheluga
left a comment
There was a problem hiding this comment.
@NebulaNomadPixel thanks for the PR.
Is there a way we get the fees going to Supplyside (LP's), Protocol, holders etc?
If yes please track them as dailySupplySideRevenue, dailyRevenue (dailyProtocolRevenue + dailyHoldersRevenue)
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
If you would like to add a
volume/fees/revenueadapter please submit the PR here.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.
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.
For updating listing info It is a different repo, you can find your listing in this file, you can edit it there and put up a PR
Please do not add new npm dependencies, do not edit/push
pnpm-lock.yamlfile as part of your changes(Needs to be filled only for new listings)
Name (to be shown on DefiLlama): Lunarbase
Twitter Link: x.com/lunarbaseX
List of audit links if any:
Website Link: https://lunarbase.gg/
Logo (High resolution, will be shown with rounded borders):
Current TVL: 9.59 k
Treasury Addresses (if the protocol has treasury):
Chain: Base
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): Proactive Market Maker (PMM) with concentrated liquidity on Base.
Token address and ticker if any:
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: Price is set by authorized operators through the
upd()function on the CurvePMM contract. No on-chain oracle is used — the operator submits a price (pX96) and fee parameter directly.Documentation/Proof: Provide links to documentation or any other resources that verify the oracle's usage:
forkedFrom (Does your project originate from another project):
methodology (what is being counted as tvl, how is tvl being calculated): TVL is calculated as the total value of tokens (ETH and USDC) held in the LunarBase CurvePMM pool contract on Base. Token addresses are read dynamically from the pool contract via X() and Y() view functions, and balances are summed using standard ERC-20 balanceOf calls.
Github org/user (Optional, if your code is open source, we can track activity): https://github.com/Lunarbase-Lab
Does this project have a referral program?
Summary by CodeRabbit