Skip to content

feat: add Stratium TVL adapter on Hyperliquid#18698

Open
yashj09 wants to merge 3 commits intoDefiLlama:mainfrom
yashj09:main
Open

feat: add Stratium TVL adapter on Hyperliquid#18698
yashj09 wants to merge 3 commits intoDefiLlama:mainfrom
yashj09:main

Conversation

@yashj09
Copy link
Copy Markdown

@yashj09 yashj09 commented Apr 8, 2026

Project Name

Stratium

Twitter Link:

https://x.com/StratiumX

List of audit links if any:

https://docs.stratium.xyz/srhype/audit

Website Link:

https://stratium.xyz/

Logo

https://github.com/user-attachments/assets/f35ae13e-a6b0-4bbe-805e-68b9dd0c5466

Current TVL:

$3.83k

Chain:

Hyperliquid

Short Description

Stratium is a structured products protocol on Hyperliquid delivering volatility perps, asset baskets, and yield strategies. Stake HYPE to receive srHYPE and earn validator rewards plus trading fee share.

Token address and ticker if any:

srHYPE — 0x89A40805a3d069d17B4672982942780A2A1Aa089

Category

Liquid Staking

Oracle Provider(s):

None

Documentation/Proof:

https://docs.stratium.xyz/srhype/overview
https://docs.stratium.xyz/srhype/staking-contracts
https://www.halborn.com/audits/horizonx/stratium-hype-staking-vault-fe466a
https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/staking
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint

Methodology:

Counts the underlying HYPE controlled by Stratum's StakingVault: HYPE held by the vault on HyperEVM plus HYPE delegated or undelegated on HyperCore for the vault address. Excludes future HIP-3 market fees, volume, revenue, and any non-staking protocol activity.

Github org/user:

https://github.com/horizonx-tech

Does this project have a referral program?

Yes

Summary by CodeRabbit

  • New Features

    • Added TVL tracking for the HyperLiquid domain that combines on-chain vault balance with managed HYPE positions (delegated + undelegated − pending withdrawals) into a single HYPE-denominated TVL.
    • Timetravel disabled for this metric.
  • Documentation

    • Included a fixed methodology describing which HYPE components are counted and excluded.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 065fbfc7-ad9b-46fb-84ef-3abcd86a4ee4

📥 Commits

Reviewing files that changed from the base of the PR and between 7d4ad17 and 48e71a0.

📒 Files selected for processing (1)
  • projects/stratium/index.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • projects/stratium/index.js

📝 Walkthrough

Walkthrough

Added a new TVL adapter for the hyperliquid domain that fetches an EVM balance and a HyperCore delegatorSummary, validates/parses delegation fields, computes managed HYPE, and registers the combined total as a gas-token TVL.

Changes

Cohort / File(s) Summary
TVL Computation Module
projects/stratium/index.js
New file exporting timetravel: false, methodology, and hyperliquid.tvl(api). Implements POST /info call to fetch delegatorSummary, validates delegated, undelegated, and totalPendingWithdrawal as decimal strings, parses to 18-decimal units, computes hypercoreManagedHype = delegated + undelegated - totalPendingWithdrawal, retrieves vault EVM balance via sdk.api.eth.getBalance, and calls api.addGasToken(...) with the summed total.

Sequence Diagram

sequenceDiagram
    participant TVL as TVL Module
    participant SDK as SDK / EVM API
    participant RPC as HyperCore RPC
    participant Registry as TVL Registry

    TVL->>SDK: getBalance(STAKING_VAULT) on hyperliquid
    SDK-->>TVL: evmBalance

    TVL->>RPC: POST /info { type: "delegatorSummary", user: STAKING_VAULT } (10s timeout)
    RPC-->>TVL: { delegated, undelegated, totalPendingWithdrawal }

    TVL->>TVL: validate fields are decimal strings
    TVL->>TVL: parse values to 18-decimal units
    TVL->>TVL: hypercoreManagedHype = delegated + undelegated - totalPendingWithdrawal
    TVL->>TVL: totalTVL = BigInt(evmBalance) + hypercoreManagedHype

    TVL->>Registry: addGasToken(totalTVL)
    Registry-->>TVL: confirmation
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped to the vault and peeked inside,

Parsed tiny HYPE with a whiskered pride,
Added EVM carrots and Core's little heap,
Counted the TVL before drifting to sleep,
Thump-thump—code and carrots, balanced and neat.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

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.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat: add Stratium TVL adapter on Hyperliquid' clearly and concisely describes the main change: adding a new TVL adapter for the Stratium project on the Hyperliquid chain.
Description check ✅ Passed The PR description comprehensively covers all major required sections from the template: project name, website, Twitter, audit links, logo, current TVL, chain, short description, token details, category, oracle providers, documentation, methodology, and Github org. Minor fields like referral program are also included.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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
Copy Markdown

The adapter at projects/stratium exports TVL:

hyperliquid               3.85 k

total                    3.85 k 

Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@projects/stratium/index.js`:
- Around line 8-13: The getUserStakingSummary function calls
axios.post(`${HYPERLIQUID_MAINNET_RPC_URL}/info`, ...) without a timeout and
returns response.data unvalidated; add a request timeout option to the
axios.post call and validate the response before returning (e.g., check
response.status is 200 and that response.data exists and matches the expected
shape like having the delegator summary fields); if validation fails, throw or
return a clear error/default so callers don't receive undefined or hang — update
the axios.post invocation and the return path in getUserStakingSummary to
implement these checks.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: ecee7d97-bcd3-4bdf-a22e-86d7c61fe929

📥 Commits

Reviewing files that changed from the base of the PR and between dac18f4 and d886317.

📒 Files selected for processing (1)
  • projects/stratium/index.js

@llamabutler
Copy link
Copy Markdown

The adapter at projects/stratium exports TVL:

hyperliquid               3.80 k

total                    3.80 k 

Copy link
Copy Markdown
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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@projects/stratium/index.js`:
- Around line 12-13: The validator currently allows 'delegated', 'undelegated',
and 'totalPendingWithdrawal' to be numbers which risks precision loss; update
the validation expression that checks these fields to require they are strings
matching a decimal format (e.g. /^\d+(\.\d+)?$/) and remove the "|| typeof ...
=== 'number'" branch. Ensure the check references the same field names
('delegated', 'undelegated', 'totalPendingWithdrawal') so parseHypeAmount
receives only decimal strings, and remove or ignore the now-unreachable defaults
applied during destructuring (lines near parseHypeAmount and the defaults at
lines 48–50).
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 92968952-460b-4cad-9510-408bafc4a030

📥 Commits

Reviewing files that changed from the base of the PR and between d886317 and 7d4ad17.

📒 Files selected for processing (1)
  • projects/stratium/index.js

@llamabutler
Copy link
Copy Markdown

The adapter at projects/stratium exports TVL:

hyperliquid               3.80 k

total                    3.80 k 

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.

2 participants