Templates

Basket

Several markets at fixed weights in one token, all long or all short, at one leverage. It trades back to the weights on a schedule, or when a leg drifts.

What it does

“BTC 40%, ETH 30%, SOL 30% at 2×.” Crypto and HIP-3 stocks and commodities mix freely: “AI stocks at fixed weights” or “the big L1s”, in one token. When a leg runs ahead, rebalancing trims it and tops up the others.

One check, and the call behind each step
Elysium · the token's contract
HyperCore · its own account
  1. 1Read every leg
    Reads each leg's position and mark
    coreTimeMspositionaccountValuemarkPx
    Positions, account value, marks
    coreTimeMspositionaccountValuemarkPx
  2. 2Open every leg
    Weight × leverage × the pool, each
    limitOrder · IOC
    One order per leg
    limitOrder · IOC
  3. 3Check the drift
    How far each leg's weight moved from its target
    on the chain
  4. 4Back to the weights
    On schedule, or once a leg drifts too far
    limitOrder · IOC
    Trims the winners, tops up the rest
    limitOrder · IOC
Every step checks again; the schedule runs whatever the drift.

What happens next

The white line is the basket, the dashed ones its legs. Each ring is a rebalance.

What happens to $1,000
BTC 40%, ETH 30%, SOL 30%, long at 2×, rebalanced every 24 h or when a leg drifts 5 points
All upover a week
+16%−0.8%SOLBasketETHBTC$1,000$1,223your $1,000
$1,000 →$1,223+22.3%
7 daily rebalances · no leg drifted past 5 points

If BTC, ETH, SOL rise 8%, 10%, 16% over a week, your $1,000 becomes about $1,223.

Sidewaysfor a week
+4.6%−6.3%BasketBTCETHSOL$1,000$986your $1,000
$1,000 →$986−1.4%
7 daily rebalances · no leg drifted past 5 points

If BTC, ETH, SOL go sideways for a week, your $1,000 becomes about $986.

All downover a week
+0.1%−16%BTCETHBasketSOL$1,000$785your $1,000
$1,000 →$785−21.5%
7 daily rebalances · no leg drifted past 5 points

If BTC, ETH, SOL fall 8%, 10%, 16% over a week, your $1,000 becomes about $785.

SOL jumps 30%the rest sideways
+32.3%−1.9%SOLBasketBTCETH$1,000$1,165your $1,000
$1,000 →$1,165+16.5%
7 daily rebalances · no leg drifted past 5 points

If SOL jumps 30% while BTC and ETH go sideways, your $1,000 becomes about $1,165.

  • Enters
  • Rebalance
  • The basket, % from the start

Illustrative price paths over a week. What the token does on them, and every dollar figure, comes from the template's own simulator with these settings and Hyperliquid's fees, with funding and order-book slippage where they apply. Before the fees to buy and sell the token. Not a forecast.

How it runs

  1. 01Open
    Opens every leg at its weight × leverage × the pool.
  2. 02Hold
    The token shows “holding”. Each leg's share moves with its price.
  3. 03Drift
    When a leg's weight moves more than the drift from its target (in points: 5 means 30% → 35%), every leg trades back.
  4. 04Schedule
    Every 1 h, 4 h, 24 h or 7 days it trades back to the weights.

Settings

Legs
Range: 1–8 markets; weights add up to 100%
Default: BTC 40 · ETH 30 · SOL 30
What it does: Which markets, and how much of each.
Direction
Range: All long or all short
Default: Long
What it does: One direction for every leg.
Leverage
Range: 1× up to the legs' weighted cap × (1 − cash)
Default: 2×
What it does: On the whole basket.
Rebalance
Range: Every 1 h, 4 h, 24 h, 7 d
Default: 24 h
What it does: More often: closer to the weights, more trading cost.
Drift
Range: 1 pts–20 pts
Default: 5 pts
What it does: Smaller: trades back sooner after a leg runs.
Weights
The same basket, weighted differently, when SOL jumps 30%.
40 / 30 / 30
Ends at $1,165
60 / 20 / 20
Ends at $1,106

Plus the settings every template shares: the cash share, breakers, pool cap, end date, fees, market liquidity, metadata and seed. See Shared settings.

Under the hoodintended, on Elysium's precompiles

Every precompile call a Basket token makes, in the order its cycle first makes them, then the pool's own. Until Elysium publishes its precompiles these are the intended calls; the contracts run them on HyperEVM testnet today. What each does, and the assumptions behind them: Precompiles on Elysium.

coreTimeMs()
Kind: read
What it does here: How fresh the reads are. A step stops when they're older than 2 seconds.
Where today: HyperEVM: the block's time
position(vault, asset)
Kind: read
What it does here: The vault's own position on a market: its size and what it cost.
Where today: L1Read 0x…0800
accountValue(vault)
Kind: read
What it does here: What the vault's HyperCore account is worth: margin plus the open result. NAV is built from it.
Where today: L1Read 0x…080F
markPx(asset)
Kind: read
What it does here: Hyperliquid's mark price: what the stop, the bands, the levels and the strikes are checked against.
Where today: L1Read 0x…0806
limitOrder(… IOC)
Kind: write
What it does here: An order that fills at once or cancels, never worse than its limit: entries, stops, rebalances, grid steps.
Where today: CoreWriter action 1, time-in-force 3
withdrawable(vault)
Kind: read
What it does here: How much USDC can leave the account right now, to pay sellers.
Where today: L1Read 0x…0803
usdClassTransfer(amount, toPerp)
Kind: money
What it does here: Moves USDC between the account's perp and spot balances.
Where today: CoreWriter action 7
depositFor(vault, amount, dest)
Kind: money
What it does here: Sends USDC from the vault on the chain into its own HyperCore account.
Where today: Circle's CoreDepositWallet
spotSend(system, USDC, amount)
Kind: money
What it does here: Sends USDC from the HyperCore account back to the vault on the chain, to pay sellers.
Where today: CoreWriter action 6