[add] halfmoon - add perpetuals volume adapter#8069
Conversation
Track HalfMoon perp taker volume from the broker daily stats API and attribute it to Avalanche as the primary deployment chain. Co-authored-by: Cursor <cursoragent@cursor.com>
WalkthroughAdds a HalfMoon ChangesHalfMoon adapter
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant HalfMoonAdapter
participant statsByDate
participant HalfMoonMarketEndpoint
HalfMoonAdapter->>statsByDate: request daily statistics
statsByDate->>HalfMoonMarketEndpoint: fetch daily_stats data
HalfMoonMarketEndpoint-->>statsByDate: return date-indexed statistics
statsByDate-->>HalfMoonAdapter: return parsed daily volume
Suggested labels: 🚥 Pre-merge checks | ✅ 15✅ Passed checks (15 passed)
✨ Finishing Touches✨ Simplify 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. Comment |
|
The halfmoon adapter exports: |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@dexs/halfmoon/index.ts`:
- Around line 13-24: Update the statsByDate initialization in fetch so a
rejected httpGet promise clears statsByDate before propagating the error,
allowing subsequent calls to retry. Preserve the existing successful date-map
caching behavior and use the existing fetch and statsByDate symbols.
- Around line 27-31: Update the daily volume handling around the day lookup and
takerVolume conversion: throw when day is missing, and remove the || 0 fallback
so invalid or non-numeric takerVolume values also throw instead of returning
dailyVolume: 0. Preserve the valid numeric return path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1f4dc101-29ce-4aab-924c-b3947fa6714d
📒 Files selected for processing (1)
dexs/halfmoon/index.ts
Clear the stats cache when the API request fails so retries can succeed, and throw on missing or invalid daily stats instead of recording zero volume. Co-authored-by: Cursor <cursoragent@cursor.com>
|
The halfmoon adapter exports: |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
dexs/halfmoon/index.ts (1)
46-59: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd a source comment for
STATS_URL
STATS_URLis hardcoded; add a source link or inline comment so the endpoint can be traced later.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@dexs/halfmoon/index.ts` around lines 46 - 59, Add a concise source URL comment next to the hardcoded STATS_URL declaration, identifying where the endpoint originates. Keep the existing endpoint value and adapter behavior unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@dexs/halfmoon/index.ts`:
- Around line 46-59: Add a concise source URL comment next to the hardcoded
STATS_URL declaration, identifying where the endpoint originates. Keep the
existing endpoint value and adapter behavior unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 5c782a95-f783-4eab-9bef-345f65467def
📒 Files selected for processing (1)
dexs/halfmoon/index.ts
|
@GameLife75 thanks for the PR |
Summary
dexs/halfmoonadapter to track HalfMoon perpetual futures volume.https://api-market.halfmoondex.com/md/volume/builder/daily_stats?broker_id=halfmoonTest plan
npm test dexs halfmoonnpm test dexs halfmoon 2026-07-10Name (to be shown on DefiLlama):
HalfMoon
Twitter Link:
https://x.com/HalfMoon_Dex
List of audit links if any:
Website Link:
https://halfmoondex.com/
Logo (High resolution, will be shown with rounded borders):
https://halfmoondex.com/images/navbar/logo.svg
Current TVL:
Treasury Addresses (if the protocol has treasury):
Chain:
Avalanche (primary). Also supports Arbitrum for deposits/trading.
Coingecko ID (so your TVL can appear on Coingecko, leave empty if not listed):
Coinmarketcap ID (so your TVL can appear on Coinmarketcap, leave empty if not listed):
Short Description (to be shown on DefiLlama):
HalfMoon is a perpetual futures trading platform.
Token address and ticker if any:
Category (full list at https://defillama.com/categories) *Please choose only one:
Derivatives
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:
https://halfmoon.gitbook.io/halfmoon-docs
forkedFrom (Does your project originate from another project):
methodology (what is being counted as tvl, how is tvl being calculated):
Perpetual futures taker volume routed through HalfMoon. Daily volume is sourced from broker daily stats and attributed to Avalanche as the primary deployment chain.
Github org/user (Optional, if your code is open source, we can track activity):
Does this project have a referral program?
Yes