sour.finance
Launch app →
LEARN · PERP DEX BASICS

What is a perp DEX?

A perp DEX — a perpetual futures DEX — is a non-custodial venue for trading perpetual futures contracts on chain. You keep your USDC in your own wallet, sign transactions to open and close leveraged positions, and the protocol holds collateral in a program-derived account. No exchange treasury. No off-ramp friction to withdraw what is already yours.

What is a perpetual future?

A perpetual future is a futures contract that has no expiry date. You can hold it for an hour or for a year, and it will not roll into a new contract on a fixed schedule the way a quarterly future does. Going long is a bet that the underlying asset goes up. Going short is a bet that it goes down. Profit and loss accrue continuously against an oracle-anchored mark price as the market moves.

Because perpetuals never expire, they need a separate mechanism to keep their price tethered to the underlying spot market. That mechanism is funding. When perp price trades above spot, longs pay shorts a small periodic fee. When it trades below, shorts pay longs. Over time, these payments push the perp back toward spot. On most centralized exchanges, funding is settled on a cron — typically every eight hours — by a backend job that snapshots a rate, computes a payment, and debits each account.

Sour does not use a funding cron. Funding accrues inside every 1.8-second batch as part of the same on-chain handler that clears trades. There is no off-chain keeper to call settle_funding, no surprise hourly payment, and no privileged backend that can lag or skip a cycle. We covered the design choice in detail at /learn/no-funding-cron-perps.

What "DEX" means in this context

On a centralized exchange, your USDC sits inside the exchange’s treasury. The exchange keeps an internal ledger of which user owns which dollar, and it handles all matching, settlement, and risk inside its own database. If the exchange fails — operationally, financially, or due to fraud — your withdrawal request can stop being honored. We have seen this story play out at scale.

On a perp DEX, your USDC sits in your own self-custody wallet until you actively post it as collateral. When you open a position, you sign a transaction that moves USDC into the protocol’s program-derived account, where it is held under the constraints encoded in the program’s rules. The same program enforces margin, computes funding, and pays out PnL. There is no human treasury and no privileged off-chain operator who can decide whether you get to withdraw. The Sour mainnet program runs at souryQgnM1xiNuGcmVYLPGT3MKqnGN8QTqP8zk8eape and its source is public at github.com/GageBachik/sour.

Non-custodial does not mean trustless. You still trust the program to be correct. That is exactly why Sour is formally verified — eighteen Kani proofs and a Lean specification cover the settlement math and aggregate margin invariants. The verification repository is public at github.com/GageBachik/sour-verification.

How leverage works

Leverage lets you control a position larger than your collateral. Ten times leverage means $1,000 of USDC collateral controls $10,000 of notional position. A 1% adverse move in the underlying wipes 10% of your collateral. A 10% adverse move wipes the entire position and triggers liquidation, where the protocol forcibly closes the position to protect the LPs that stood as your counterparty.

Leverage is the single most consequential dial on a perp DEX. Higher caps let aggressive traders express conviction, but they also concentrate liquidation risk on the LP backstop during fast moves. Sour caps leverage at 50× isolated, USDC-collateralized. That is high enough to be useful for serious directional trading and low enough that the LP vault does not have to absorb tails that no on-chain market can clear at the marked price.

What can go wrong

Perp DEXes — Sour included — carry real risks. None of these are theoretical.

  • SMART-CONTRACT RISK
    A bug in the program can lock funds, miscompute PnL, or open a path to drain the LP vault. Formal verification reduces this risk significantly but does not eliminate it. Sour has not yet been through a paid third-party audit.
  • ORACLE RISK
    Mark price comes from an external feed. If the feed is stale, manipulated, or paused, positions can be liquidated at the wrong price or funding can accrue against an inaccurate anchor.
  • LIQUIDATION RISK
    During fast moves, a position closing at the clearing price may fill significantly worse than the price you saw when you sized the trade. Higher leverage compresses the price band that triggers liquidation.
  • LIQUIDITY RISK
    You cannot always close at the price displayed when you opened. In thin markets or during stress, the clearing price for the slot you exit in may be far from the prior mark.
  • REGULATORY RISK
    Perpetual futures are restricted or unavailable in many jurisdictions. Trading on a perp DEX does not change your legal obligations. Know the rules where you live before you size up.

What makes Sour different

Sour is a perp DEX, but it is structured differently from the dominant designs. Most Solana perp DEXes either run a continuous central limit orderbook or quote against a single LP pool at oracle price. Sour clears in discrete 1.8-second batch auctions instead — every order in a slot fills at one uniform clearing price, sorted by price-time priority, settled atomically inside one Solana block. The full design rationale lives at /learn/flow-perps.

Three other choices follow from that primitive. Funding accrues inside every batch instead of on an off-chain cron. Liquidation is structural and runs inside the same matching engine that fills you. Fees are flat at 3 bps per fill, 100% credited to the SOUR LP vault — no maker rebate, no taker premium, no VIP tier. The point of the design is fairness and structural simplicity, not microstructure tuning for high-frequency makers.

Pro mode vs Degen mode

Sour ships two UIs over the same orderbook and the same on-chain program. Pro mode is a trader terminal — limit orders, position sizing, mark and oracle prices, funding accrual, and the rest of the toolkit a directional trader expects. Degen mode is a stripped-down UI built around a single mental model: the bet amount you type in is the maximum you can lose. Behind the scenes, the UI sizes a position and places a stop such that the worst-case loss equals what you bet. Same matching engine, same fees, same liquidation rules.

Both UIs produce real on-chain positions on the same markets — SOL-PERP, BTC-PERP, ETH-PERP — and both pay the same flat 3 bps fee. Degen mode is not a separate product or a paper-trading sandbox. It is just a different framing of risk for traders who would rather think in dollars-at-risk than in collateral and leverage.

A perp DEX is not magic. It is a futures venue where the matching engine and the custodian are the same audited program — and you can read the source.