How AWINN works
Plain-language mechanism. The numbers below are read live from the deployed contracts. Technical documentation lives in the repository under docs/.
1. What you trade
Synthetic, isolated-margin long or short positions on BTC-USD and ETH-USD. You choose a trading margin and leverage; the contract derives the asset quantity from margin × leverage at the execution reference price. Profit and loss are linear in the price change. A position never changes its entry price, fee rule or liquidation rule after it is opened, and switching between Simple and Advanced mode changes nothing about it.
2. Prices
Current source: unknown.
- Execution reference: the midpoint of Hyperliquid's best bid and best ask (BBO mid), as accepted onchain by the AWINN price adapter. Opens, closes, order executions and liquidation settlement all use this value.
- Liquidation trigger reference: the source mark price when the adapter has one, otherwise the mid. Mark, mid and oracle are different numbers and are never treated as the same.
- Freshness: a snapshot older than … is stale. While stale, opens, closes and order executions revert; withdrawals, rebate claims, epoch finalization and queue processing keep working. Nothing ever settles at an invented price.
- Modes: "Deterministic test prices · local" are seeded test prices for local development. "Hyperliquid prices · testnet relay" means a restricted updater posts validated Hyperliquid snapshots onchain; this is a trusted relay, not a native or trustless read. A native Elysium read mode exists in code but is disabled until a documented interface is verified.
- The chart's latest point can be newer than the onchain snapshot. The order preview and the receipt always show the execution reference actually used.
3. Fees
Provisional research configuration v…:
- Opening fee = min(… of accepted notional, … of trading margin).
- Exit fee = min(… of exit notional, the position's remaining reserved exit budget). The maximum budget, … of trading margin, is reserved at opening in addition to the margin; the unused part comes back at close. Partial closes split the budget proportionally, so the total exit fee across any sequence of closes can never exceed the original budget.
- Total required balance to open = trading margin + opening fee + reserved exit budget. The ticket shows this before you sign. The Max button respects it.
- 100% of collected fees go to the rebate reserve. Network gas is separate and is paid by your wallet, or by the AWINN relayer for relayed intents.
4. Liquidation
A position becomes liquidatable when its equity (risk margin + unrealized PnL at the trigger reference) is at or below … of its remaining original risk margin. Anyone may liquidate it; the settlement uses the execution reference of the same validated snapshot. Residual equity above the loss is returned to you — nothing is confiscated beyond the actual loss and the exit fee. If a gap move makes the theoretical loss exceed your margin, your loss is capped at the margin; the excess is recorded as a shortfall metric and is not charged, not treated as fee income and not counted as rebate-eligible loss. A close request on a position that is already liquidatable settles under liquidation rules regardless of who sends it.
5. Winning profits and the queue
Realized losses move cash from margin into settlement cash. Winning profits are paid only from that cash. When you close a winner, your margin and unused fee reserve come back to your available balance immediately. The profit is paid from settlement cash if no older claim is waiting; otherwise, or when cash is short, the unpaid part becomes a first-in, first-out claim. Queued claims are not cash: you cannot withdraw them or use them as collateral, and nobody can promise when they will be paid. The queue page shows outstanding claims, settlement cash, the current coverage ratio and recent payments. Processing is a bounded public function; a keeper calls it, and so can you.
There is no seeded bankroll. The first winner on a fresh deployment gets its margin back and a queued claim, by design.
6. Loss rebates
- Epochs are 24h UTC-aligned windows (duration is versioned configuration; a change applies at a future boundary and never alters old entitlements).
- Your eligible loss for an epoch is max(0, −net realized trading PnL). Profits offset losses even when the profit is still queued. Fees, deposits, withdrawals and past rebates are not trading PnL.
- At finalization: budget = min(fees collected + carry-in, total eligible losses). Your rebate = floor(budget × your loss ÷ total eligible losses). Larger losses receive larger dollar rebates, proportionally. A rebate never exceeds the loss. Fees beyond total losses carry forward.
- Until an epoch is finalized onchain the displayed amount is an estimate, not an entitlement. Finalized epochs are immutable; claims never expire; each account claims once per epoch.
7. Orders
Limit, stop-market and stop-limit opens and take-profit / stop-loss closes are conditional instructions evaluated against the validated mid, not resting liquidity in a matching book. A trigger price is not a guaranteed fill price: execution happens at the then-current mid, must satisfy your limit price, and reverts when the feed is stale. Open orders reserve margin + 2 × fee cap until executed, cancelled or expired. TP and SL placed together cancel each other when one executes. Trailing stops are not available.
8. Sessions and signing
Every trade is either a wallet transaction or an EIP-712 trade intent signed by a session key you authorized onchain. Intents bind the chain, contract, account, action, market, size, price limit, max fee, nonce and expiry; the relayer cannot change them. Session keys have per-trade and cumulative margin limits, expiry and permission bits, and can be revoked. They can never withdraw.
9. Limits of this testnet build
- Test funds only (tUSDC faucet collateral, not canonical USDC). Minimum trading margin …; new openings pause when outstanding profit claims exceed ….
- Nothing here is audited, and the economics are a research configuration under simulation; the queue can hold unpaid claims for an unbounded time if losses stop arriving.
- Charts use TradingView's open-source lightweight-charts library; candles come from AWINN's own price-history service built on the Hyperliquid reference stream.