Conversation
📝 WalkthroughWalkthroughIntegrates DAMMv2 post-migration fee data (via external HTTP API) with pre-migration DBC data (via Dune) in the launch-on-bags fee adapter, adding types/constants and extending aggregation to separately accumulate USD-valued protocol and creator fees across both periods. Changes
Sequence DiagramsequenceDiagram
participant Caller as Adapter Caller
participant Dune as Dune API
participant DAMMv2 as DAMMv2 API
participant Processor as Fee Processor
participant Aggregator as Aggregator
Caller->>Dune: Request pre-migration DBC rows
Dune-->>Caller: Return DBC rows
Caller->>Processor: Provide DBC rows
Processor->>Processor: Compute protocolFees, creatorFees, USD values (DBC)
Caller->>DAMMv2: Request DAMMv2 fee results (start_time +1s)
DAMMv2-->>Caller: Return DAMMv2 fee results
Caller->>Processor: Provide DAMMv2 results
Processor->>Processor: Map to daily metrics, compute protocolRevenue & creatorFees, convert to USD
Processor->>Aggregator: Merge DBC and DAMMv2 aggregates
Aggregator-->>Caller: Return unified fee metrics
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 launch-on-bags adapter exports: |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
fees/launch-on-bags/index.ts (1)
84-86: Fix grammatical issue in Revenue methodology.The sentence structure appears incomplete or incorrectly punctuated: "...from DBC (pre-migration), For DAMMv2 (post-migration)."
📝 Suggested fix
methodology: { Fees: "Total trading fees paid by users when swapping against Bags DBC pools (pre-migration) and DAMMv2 pools (post-migration). These fees exclude the underlying Meteora protocol fee and DAMMv2 LP Fees and any referral fees.", - Revenue: "Trading-fee revenue earned by Bags from DBC (pre-migration), For DAMMv2 (post-migration).", + Revenue: "Trading-fee revenue earned by Bags from DBC pools (pre-migration) and DAMMv2 pools (post-migration).", ProtocolRevenue: "Net Revenue earned by the Bags protocol from trading activity" },
🤖 Fix all issues with AI agents
In `@fees/launch-on-bags/index.ts`:
- Around line 53-64: The code assumes dammv2Response.results is always an array;
add a defensive check before iterating: after obtaining dammv2Response from
httpGet (and matching IDammv2FeeResponse), verify dammv2Response is truthy and
Array.isArray(dammv2Response.results) (or fall back to an empty array) and only
then call forEach; if results is missing/null, log a warning or skip processing
to avoid runtime errors while still ensuring dailyFees, dailyProtocolRevenue and
METRIC usages remain unchanged inside the safe iteration.
|
The launch-on-bags adapter exports: |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
fees/launch-on-bags/index.ts (1)
85-85:⚠️ Potential issue | 🟡 MinorComplete the Revenue methodology description.
The sentence appears truncated:
"Trading-fee revenue earned by Bags from DBC (pre-migration), For DAMMv2 (post-migration)."The comma before "For" and the incomplete phrasing suggest missing text describing what revenue is earned from DAMMv2.📝 Suggested fix
- Revenue: "Trading-fee revenue earned by Bags from DBC (pre-migration), For DAMMv2 (post-migration).", + Revenue: "Trading-fee revenue earned by Bags from DBC (pre-migration) and DAMMv2 pools (post-migration).",
🧹 Nitpick comments (2)
fees/launch-on-bags/index.ts (2)
40-47: Add defensive check fordbcDatafor consistency with DAMMv2 handling.The DAMMv2 response on line 55 uses
(dammv2Response?.results ?? []).forEach(...)to guard against null/undefined, butdbcDatalacks the same protection. IfqueryDuneSqlreturns an unexpected value, this will throw.🛡️ Proposed fix for consistency
- dbcData.forEach(row => { + (dbcData ?? []).forEach(row => { const protocolFees = Number(row.daily_protocol_revenue); const creatorFees = Number(row.daily_fees) - protocolFees;
49-52: Clarify the+1second adjustment.The comment states adding 1 second is needed "to match the start of the day," but this is counterintuitive—start-of-day timestamps are typically at
00:00:00. If this is compensating for an API boundary condition (e.g., exclusive vs. inclusive start), please update the comment to explain the actual reason to prevent future confusion.
|
The launch-on-bags adapter exports: |
NOTE
Please enable "Allow edits by maintainers" while putting up the PR.
package.json/package-lock.jsonfile as part of your changesName (to be shown on DefiLlama):
Twitter Link:
List of audit links if any:
Website Link:
Logo (High resolution, will be shown with rounded borders):
Current TVL:
Treasury Addresses (if the protocol has treasury)
Chain:
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):
Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one:
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):
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