Grid
Buys lower and sells higher inside a range. Its position steps with the price: full at the bottom of the range, flat at the top, one step per level.
What it does
“Trade SOL between 63.61 and 77.75 in 10 levels.” Each time the price falls through a level it buys one step; each time it rises through one it sells a step. In a market that swings back and forth, every down-and-up round trip banks a small gain.
- 1ReadReads its position and the markcoreTimeMspositionaccountValuemarkPxPosition, account value, markcoreTimeMspositionaccountValuemarkPx
- 2Find the levelTarget = levels above the price ÷ (levels − 1) × full sizeon the chain
- 3Step to the targetCrossed a level down: buy a step; up: sell onelimitOrder · IOCOne order that fills at oncelimitOrder · IOC
- 4Out of rangeAbove the top: flat. Below the bottom: hold or flattenon the chain
What happens next
The dotted lines are the levels. White triangles are buys, grey ones sells. Grids like swings and dislike one-way trends: the price leaving the range below leaves it holding the full position.
If SOL rises 15% over 2 days, your $1,000 becomes about $1,067.
If SOL swings 6% up and down for 2 days, your $1,000 becomes about $1,051.
If SOL falls 15% over 2 days, your $1,000 becomes about $730.
If SOL falls 12% and comes back within 2 days, your $1,000 becomes about $1,019.
- Buys a step
- Sells a step
- Price
Illustrative price paths over 2 days. 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
- Inside the range the token shows “in range”; outside it, “out of range”.
- Above the upper price it's flat.
- Below the lower price it either holds full size (hold) or goes flat (flatten), as the creator chose.
Settings
| Setting | Range | Default | What it does |
|---|---|---|---|
| Market | Any listed perp, HIP-3 included | SOL | Which market it trades. |
| Lower and upper price | Any two prices, lower below upper | ±10% around the price | Wider: survives bigger moves, fewer trades per swing. |
| Levels | 2–200 | 10 | More: smaller steps, more trades, smaller gain on each. |
| Leverage | 1× up to Hyperliquid's max × (1 − cash share); at the bottom | 2× | Full size at the bottom of the range. |
| Entry slippage | 0.05%–5% | 0.3% | The worst price an entry accepts. Past it, the order doesn't fill and waits for the next step. |
| Out of range | Hold or flatten | Hold | Below the bottom: keep the full position, or sell it all and wait. |
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 Grid 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.
| Call | Kind | What it does here | Where today |
|---|---|---|---|
coreTimeMs() | read | How fresh the reads are. A step stops when they're older than 2 seconds. | HyperEVM: the block's time |
position(vault, asset) | read | The vault's own position on a market: its size and what it cost. | L1Read 0x…0800 |
accountValue(vault) | read | What the vault's HyperCore account is worth: margin plus the open result. NAV is built from it. | L1Read 0x…080F |
markPx(asset) | read | Hyperliquid's mark price: what the stop, the bands, the levels and the strikes are checked against. | L1Read 0x…0806 |
limitOrder(… IOC) | write | An order that fills at once or cancels, never worse than its limit: entries, stops, rebalances, grid steps. | CoreWriter action 1, time-in-force 3 |
withdrawable(vault) | read | How much USDC can leave the account right now, to pay sellers. | L1Read 0x…0803 |
usdClassTransfer(amount, toPerp) | money | Moves USDC between the account's perp and spot balances. | CoreWriter action 7 |
depositFor(vault, amount, dest) | money | Sends USDC from the vault on the chain into its own HyperCore account. | Circle's CoreDepositWallet |
spotSend(system, USDC, amount) | money | Sends USDC from the HyperCore account back to the vault on the chain, to pay sellers. | CoreWriter action 6 |
coreTimeMs()position(vault, asset)accountValue(vault)markPx(asset)limitOrder(… IOC)withdrawable(vault)usdClassTransfer(amount, toPerp)depositFor(vault, amount, dest)spotSend(system, USDC, amount)Worked example
SOL Grid 120–160 with 5 levels (120, 130, 140, 150, 160), 2× on a $100,000 pool: full size is $200,000.
| SOL price | Levels above it | Target |
|---|---|---|
| 160 or above | 0 | Flat |
| 150 – 160 | 1 | 25% · $50,000 |
| 140 – 150 | 2 | 50% · $100,000 |
| 130 – 140 | 3 | 75% · $150,000 |
| 120 – 130 | 4 | 100% · $200,000 |
| below 120 | 5 | 100% (hold) or flat (flatten) |