feat: base HyperLiquid activation detection on spot sends and creation fees#9594
Open
dan437 wants to merge 3 commits into
Open
feat: base HyperLiquid activation detection on spot sends and creation fees#9594dan437 wants to merge 3 commits into
dan437 wants to merge 3 commits into
Conversation
…n fees The activation fee reserve for Pay withdrawals only applied to accounts with no outbound ledger history at all. HyperLiquid charges the one-time 1 USDC activation fee on the first spot send unless it was already paid by the inbound transfer that created the account. Bridge withdrawals use a separate fee lane and do not settle it, so accounts whose only outbound history was bridge withdrawals were wrongly classified as activated and their max withdrawals failed with "Insufficient USDC balance for token transfer gas". - Stop treating bridge withdrawals as activation - Treat a creation entry carrying a fee >= 1 as paid activation - Reserve the fee when the activation check fails, instead of skipping
pedronfigueiredo
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
The
hyperliquidActivationFeereserve added in #9238 decides whether to hold back the one-time HyperLiquid activation fee by probinguserNonFundingLedgerUpdates. It currently treats any outbound ledger entry as proof of activation, including bridgewithdrawentries, and assumes the account is activated whenever the probe fails.That does not match how HyperLiquid charges the fee. Verified against the live API:
fee: "1.0"). All later sends are then fee-free.So an account whose only outbound history is bridge withdrawals is still unactivated for spot sends. The probe classified such accounts as activated, skipped the reserve, and their max withdrawals failed on the
sendAssetstep withInsufficient USDC balance for token transfer gas.This PR reworks the detection:
send/spotTransfer. A fee on a later inbound entry is ignored, because it belongs to the sender's own first-send activation.Max withdrawals then leave no leftovers: activated accounts send 100% of their balance, and unactivated accounts reserve exactly the fee, which HyperLiquid consumes, so the account ends at zero.
References
Checklist
Note
Medium Risk
Changes withdrawal sizing and fee reservation for HyperLiquid sources; the fail-closed probe behavior can leave a small reserved balance when activation was already paid but the check failed.
Overview
HyperLiquid activation fee reservation now matches how HyperLiquid actually charges the one-time spot activation fee, fixing max withdrawals that failed with insufficient balance when the old probe skipped the reserve.
Activation detection no longer treats bridge
withdrawledger entries as proof of activation. An account is activated when its earliest non-funding entry has afeeof at least 1 (paid at account creation on an inbound transfer), or when it has a prior outboundsend/spotTransfer. Fees on later inbound entries are ignored.Probe failures (network error or non-OK API response) now assume unactivated and reserve the fee instead of skipping it, so withdrawals fail less often when HyperLiquid is unreachable.
Tests and the package changelog are updated; relay quote tests use an outbound
sendinstead ofwithdrawfor the “activated” case.Reviewed by Cursor Bugbot for commit 48e1656. Bugbot is set up for automated code reviews on this repo. Configure here.