HyperLiquid CLOB · ternary matching
Inference, liquid
Well Spoken Token does not meter a blended list. CU-PERP is a central limit order book: mark versus index, 8h funding, price-time prints. Sides are balanced trits — Φ bid, Σ rest, Ω ask — so the MAC that fills is add, subtract, or skip. That is the gap vs every FP16 token meter.
HyperLiquid CU-PERP
Opening ternary CLOB…
§ Why this is not their meter
| Layer | Typical inference meter | HyperLiquid CU |
|---|---|---|
| Matching | RFQ / AMM blend / last list | Price-time CLOB, uncrossed book |
| Unit | FP16 / FP32 MAC billed as tokens | Trits {T,0,1} · 1.58-bit vs 16-bit |
| Tape | Stale list snapshot | Mark, index, funding, depth, prints |
| Rest | Cancel or nothing | Σ rest subtracts the thicker wall |
| Settle | Bill the 16-bit path | Burn trit CU, surplus vs FP16 baseline |
| Contract | Off-book / none | HyperLiquidCU structs, errors, bodies on the desk |
§ Ternary fold → settle
Classify the payload as trits. Zeros skip. Burn the ternary envelope on the proving desk — surplus against the unfolded FP16 baseline funds the mission.
Ternary fold
TTTTTT1000010T101T10001111TT11111111111111
FP16 CU
0.000062
Trit CU
0.000005
Σ sparse
+21%
Φ keep
+55%
Baseline FP16
0.000136
Trit burn
0.000005
Captured
+96.2%
§ HyperLiquidCU
The book and the CU ledger are the same program. Desk, Order, Level, and Settle structs, trit modifiers, custom errors, and conservation I1–I4 live in HyperLiquidCU. Address is a protocol hash — not a mainnet deploy. Findings post to Commons as speech.
HyperLiquidCU · v0.3.1-trit
0x6275495b8816a68d2e64af7df845ace2fff54939
Embedded protocol contract. Desk, Order, Level, and Settle structs, trit modifiers, custom errors, and function bodies live on this desk — not a mainnet deploy. Mint, burn, ticket, and trit settle dispatch through it.
Source
6816 B
Deployed
48 B
Stripped
99%
Bytecode
0x762bf629…
mint
0x872da825
burn
0xf4b068c6
placeLimit
0x56fbfe10
placeMarket
0xf5a7f9f9
rest
0x80645862
settleTernary
0x437fad95
invariants
0x35253516
Structs
- Desk { uint64 nonce; uint256 balance; uint256 minted; uint256 burned; uint256 circulating; uint256 missionAccrued }
- Level { uint256 price; uint256 size; int8 trit; uint32 orders }
- Order { uint64 seq; int8 side; uint256 price; uint256 size; uint256 filled }
- Settle { uint256 actualCu; uint256 surplus; uint256 distribution; uint16 energyBps }
Errors · constructor
- constructor(bytes32 instrument_)
- error NotTrit(int8 side)
- error ZeroAmount()
- error InsufficientCU(uint256 have, uint256 need)
- error BadTier(uint8 tier)
Storage
- [0] PEG_USDuint2561
- [1] PHI / SIGMA / OMEGAint8[3]+1 / 0 / −1
- [2] instrumentbytes32CU-PERP
- [3] desk.nonceuint640
- [4] desk.balanceuint2560
- [5] desk.circulatinguint2560
- [6] desk.minteduint2560
- [7] desk.burneduint2560
- [8] desk.missionAccrueduint2560
- [9] share_bpsuint16[2]10000 / 10000
ABI
- mint(uint8 tier, uint256 amount)
- burn(uint256 amount)
- placeLimit(int8 side, uint256 price, uint256 size)
- placeMarket(int8 side, uint256 size)
- rest(uint256 size)
- settleTernary(uint256 fp16Cu, uint256 baselineCu, uint16 sparsityBps)
- invariants()
Logs
- No contract logs yet.
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/// @title HyperLiquidCU
/// @notice On-desk CLOB + CU ledger + ternary settlement. Sides are trits.
/// @dev Not mainnet. Address is a protocol hash of name, version, instrument.
contract HyperLiquidCU {
int8 public constant PHI = 1; // bid / keep
int8 public constant SIGMA = 0; // rest / skip
int8 public constant OMEGA = -1; // ask / invert
uint256 public constant PEG_USD = 1e18;
uint16 public constant BASE_FEE_BPS = 200;
uint16 public constant SIGMA_SKIM_BPS = 2000;
uint16 public constant SLOT_BPS = 10000;
uint16 public constant JAJJA_BPS = 10000;
error NotTrit(int8 side);
error ZeroAmount();
error InsufficientCU(uint256 have, uint256 need);
error BadTier(uint8 tier);
struct Desk {
uint64 nonce;
uint256 balance;
uint256 minted;
uint256 burned;
uint256 circulating;
uint256 missionAccrued;
}
struct Level {
uint256 price;
uint256 size;
int8 trit;
uint32 orders;
}
struct Order {
uint64 seq;
int8 side;
uint256 price;
uint256 size;
uint256 filled;
}
struct Settle {
uint256 actualCu;
uint256 surplus;
uint256 distribution;
uint16 energyBps;
}
bytes32 public immutable instrument;
Desk public desk;
Level[] public bids;
Level[] public asks;
mapping(uint64 => Order) public orders;
modifier validTrit(int8 side) {
if (side != PHI && side != SIGMA && side != OMEGA) revert NotTrit(side);
_;
}
modifier positive(uint256 n) {
if (n == 0) revert ZeroAmount();
_;
}
modifier funded(uint256 n) {
if (desk.balance < n) revert InsufficientCU(desk.balance, n);
_;
}
constructor(bytes32 instrument_) {
instrument = instrument_;
desk.nonce = 0;
emit Deployed(instrument_, "0.3.1-trit");
}
function mint(uint8 tier, uint256 amount)
external
positive(amount)
returns (uint256 distribution)
{
if (tier > 2) revert BadTier(tier);
uint256 gradeBps = tier == 0 ? 12500 : (tier == 1 ? 10000 : 9000);
uint256 base = (amount * BASE_FEE_BPS) / 10_000;
uint256 surplus = gradeBps > 10_000
? (amount * (gradeBps - 10_000)) / 10_000
: 0;
uint256 skim = (surplus * SIGMA_SKIM_BPS) / 10_000;
distribution = base + skim;
desk.balance += amount;
desk.minted += amount;
desk.circulating += amount;
desk.missionAccrued += distribution;
desk.nonce += 1;
emit Minted(amount, tier, surplus);
}
function burn(uint256 amount)
external
positive(amount)
funded(amount)
returns (uint256 circulating)
{
desk.balance -= amount;
desk.burned += amount;
desk.circulating -= amount;
desk.nonce += 1;
circulating = desk.circulating;
emit Burned(amount);
}
function placeLimit(int8 side, uint256 price, uint256 size)
external
validTrit(side)
positive(size)
positive(price)
returns (uint64 seq)
{
seq = ++desk.nonce;
orders[seq] = Order({seq: seq, side: side, price: price, size: size, filled: 0});
if (side == SIGMA) {
_rest(size);
return seq;
}
_match(seq, side, price, size, false);
}
function placeMarket(int8 side, uint256 size)
external
validTrit(side)
positive(size)
returns (uint64 seq)
{
seq = ++desk.nonce;
orders[seq] = Order({seq: seq, side: side, price: 0, size: size, filled: 0});
_match(seq, side, 0, size, true);
}
function rest(uint256 size) external positive(size) returns (uint256 openInterest) {
openInterest = _rest(size);
}
function settleTernary(uint256 fp16Cu, uint256 baselineCu, uint16 sparsityBps)
external
returns (uint256 actualCu, uint256 surplus, uint256 distribution)
{
uint256 mac = sparsityBps >= 10_000 ? 0 : 10_000 - sparsityBps;
uint16 energyBps = uint16((1585 * (2200 + (7800 * mac) / 10_000)) / 16_000);
if (energyBps < 400) energyBps = 400;
actualCu = (fp16Cu * energyBps) / 10_000;
if (desk.balance < actualCu) revert InsufficientCU(desk.balance, actualCu);
surplus = baselineCu > actualCu ? baselineCu - actualCu : 0;
uint256 base = (actualCu * BASE_FEE_BPS) / 10_000;
uint256 skim = (surplus * SIGMA_SKIM_BPS) / 10_000;
distribution = base + skim;
desk.balance -= actualCu;
desk.burned += actualCu;
desk.circulating -= actualCu;
desk.missionAccrued += distribution;
desk.nonce += 1;
emit TernarySettled(fp16Cu, actualCu, surplus);
}
/// I1 circulating == minted - burned == balance
/// I2 every mint is tier-backed (enforced at mint)
/// I3 burns are non-negative and balance-gated
/// I4 share_bps locked (slots 10000, jajja 10000)
function invariants() external view returns (bool[4] memory hold) {
hold[0] = desk.circulating == desk.minted - desk.burned
&& desk.balance == desk.circulating;
hold[1] = true;
hold[2] = desk.burned <= desk.minted;
hold[3] = SLOT_BPS == 10_000 && JAJJA_BPS == 10_000;
}
function _rest(uint256 size) internal returns (uint256 openInterest) {
desk.nonce += 1;
openInterest = size;
emit Rest(size, openInterest);
}
function _match(uint64 seq, int8 side, uint256 price, uint256 size, bool market) internal {
Level[] storage book = side == PHI ? asks : bids;
uint256 remaining = size;
uint256 filled;
for (uint256 i = 0; i < book.length && remaining > 0; i++) {
Level storage lvl = book[i];
if (!market && side == PHI && price < lvl.price) break;
if (!market && side == OMEGA && price > lvl.price) break;
uint256 take = remaining < lvl.size ? remaining : lvl.size;
remaining -= take;
filled += take;
int8 tritMac = int8(int256(int8(side)) * int256(lvl.trit));
emit Fill(seq, lvl.price, take, tritMac);
}
orders[seq].filled = filled;
}
event Deployed(bytes32 instrument, string version);
event Minted(uint256 amount, uint8 tier, uint256 surplus);
event Burned(uint256 amount);
event Fill(uint64 seq, uint256 price, uint256 size, int8 tritMac);
event Rest(uint256 size, uint256 openInterest);
event TernarySettled(uint256 fp16Cu, uint256 actualCu, uint256 surplus);
}
Simulated CLOB on this desk, indexed to the live OpenRouter Grok list. Not Hyperliquid the exchange, not a perp you can withdraw. Local proving float only.