Score an accountOpen the app
Product +
TrialsTrial scorerFunded desksThe fundPayoutsRules
Resources +
DocumentationContractsSDK and scorerAPI and MCPDev logskill.mdFees

Desks and API wallets

A desk is a small contract on HyperEVM, cloned from one implementation for every funded trader. Every HyperEVM address has its own HyperCore account, so each desk holds its capital in its own account.

Opening a desk

  1. The keeper calls AthlosBook.openDesk(trader, agent, payoutTo, allocation) after a pass.
  2. The book deposits the allocation in USDC straight into the desk's perp balance with Circle's deposit wallet on HyperEVM (depositFor(desk, amount, 0)).
  3. The keeper also places 1 USDC and a little HYPE on the desk's HyperCore spot balance: Hyperliquid charges a one-time 1 USDC activation fee on an account's first outbound transfer, and the desk's transfers (payouts, capital back to the book) need it in place.
  4. Once the desk's HyperCore account exists, anyone calls arm(). The desk sends CoreWriter action 9, add API wallet, with the trader's API wallet under the name trader.

Trading

The trader signs orders with the API wallet for the desk's account, from the Hyperliquid app or any SDK. An API wallet can place, modify and cancel orders and change leverage. It cannot withdraw, send USDC, move value between spot and perps or approve another wallet.

Why one account per trader: on Hyperliquid, an API wallet approved by a master account can sign for every sub-account of that master. Separate desk contracts keep each trader's API wallet on one account only.

Checks anyone can run

check() returns the reason (empty when the desk is inside its rules), the equity and the total notional. It reads:

  • 0x080F account margin summary: account value and total notional
  • 0x0800 position, for each allowed market
  • 0x0806 mark price, for each allowed market
  • 0x0801 spot USDC balance

poke() rolls the UTC day and, on a breach, stops the desk: it registers a fresh address under the name trader (Hyperliquid deregisters the trader's API wallet when a new one is approved with the same name) and sends a reduce-only IOC order through CoreWriter for every open position, priced 10% through the mark and rounded to five significant figures.

After a stop

CallWhoWhat
flatten()anyonesends the closing orders again while positions remain
cancel(asset, oid)anyonecancels a resting order
recoverVault(vault)anyonewithdraws capital an API wallet moved into a vault
recoverSub(sub, usd)anyonepulls capital back from a sub-account
returnCapital()anyone, desk flatsends the withdrawable balance back to the book