Skip to content

feat(perps): remove USDH collateral handling from HyperLiquid provider#9124

Open
michalconsensys wants to merge 1 commit into
mainfrom
feat/remove-usdh-sunset
Open

feat(perps): remove USDH collateral handling from HyperLiquid provider#9124
michalconsensys wants to merge 1 commit into
mainfrom
feat/remove-usdh-sunset

Conversation

@michalconsensys

Copy link
Copy Markdown
Contributor

Description

Removes all USDH collateral handling logic from the HyperLiquid provider. USDH support is being sunset, so the automatic USDC→USDH swap flow, spot balance checks, and session-cached spot metadata are no longer needed.

Changes

  • Removed USDH_CONFIG constant and its public export
  • Removed private methods: #isUsdhCollateralDex, #getSpotUsdhBalance, #getSpotUsdcBalance, #transferUsdcToSpot, #swapUsdcToUsdh, #ensureUsdhCollateralForOrder, #getCachedSpotMeta
  • Removed #cachedSpotMeta field and its pre-fetch in ensureReadyForTrading()
  • Removed USDH collateral branch from #ensureCollateralForHip3Order
  • Simplified #getUsdcTokenId to call spotMeta() directly instead of going through the removed cache
  • Removed unused imports (SPOT_ASSET_ID_OFFSET, SpotMetaResponse)
  • Updated tests to use generic non-USDC tokens (HYPE, PURR) instead of USDH

Changelog

@metamask/perps-controller

  • Removed: USDH collateral handling — spot balance checks, USDC→USDH swaps, and USDH_CONFIG constant

Related issues

N/A

Manual testing steps

N/A — internal cleanup with no behavioral change for USDC-collateralized DEXs.

Screenshots/Recordings

N/A

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs
  • I've completed the PR template to the best of my ability
  • I've included tests if applicable
  • I've documented my code using JSDoc format if applicable
  • I've applied the right labels on the PR
  • I've properly set the pull request to draft if not ready to be reviewed

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed)
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or parties involved

USDH support is being sunset. Remove all USDH-specific logic including
spot balance checks, USDC-to-USDH swaps, collateral transfers, and the
cached spot metadata layer. Simplify getUsdcTokenId to fetch spot
metadata directly. Update tests to use generic non-USDC tokens instead
of USDH.
@michalconsensys michalconsensys requested a review from a team as a code owner June 15, 2026 11:24
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.

1 participant