Contrix docs
Contrix is a perp DEX on Solana. You can short or long a Solana coin with up to 5x, settled in SOL, against a shared pool.
Status: the program runs on Solana devnet with test SOL, which has no value. It is not on mainnet. Program: 3sD7H1ta4w5YxBQfNzF5KXCHfcKVUpb5DcaztrWhVPeG
Overview
- Trader posts SOL as margin and picks a coin, side and leverage.
- Vault is the pool on the other side of every trade.
- Price service signs the live price that the program checks in each trade.
Trading
- Paste a contract address or pick a market.
- Choose Short or Long.
- Set margin in SOL and leverage from 1x to 5x.
- Confirm in your wallet. The position opens at the signed price in that transaction.
- Close any time after the 60 second minimum hold. The result is paid in SOL in the same transaction.
A coin can be traded when it has a SOL market with at least $250,000 of liquidity. Thinner coins are view only.
Math and limits
size = margin × leverage
PnL = size × (price - entry) / entry long
PnL = size × (entry - price) / entry short
payout = margin + PnL - closing fee
Example: 1 SOL margin, 5x short, price falls 20%. PnL is +1 SOL. The fee is 0.015 SOL each way.
| Parameter | Launch default |
|---|---|
| Max leverage | 5x (the program allows at most 10x) |
| Fee | 0.30% of size on open and on close |
| Max profit per position | 3x margin |
| Max position size | 2% of the pool |
| Liquidation level | Equity at 10% of margin |
| Max price age | 15 seconds |
| Minimum hold | 60 seconds before you can close |
| Funding rate | None |
The admin can change these within limits set in the program, and can pause new positions. A pause never blocks closing.
Liquidation
When equity falls to the liquidation level, anyone can liquidate the position with a signed price. The liquidator gets up to 5% of the margin, limited by the equity left. The rest goes to the pool. Your loss cannot be larger than your margin plus fees.
Vault
Anyone can deposit SOL and receive shares. The vault earns trading fees and losing margin, and pays out when traders win. A share can fall in value.
Each open position reserves its maximum profit. Reserved SOL cannot be withdrawn, so a large withdrawal can have to wait until positions close.
Prices
The price service reads the most liquid SOL pair from DexScreener and signs mint, price, timestamp with a dedicated key. The program verifies that signature through Solana's Ed25519 program and rejects old prices, prices for another coin, and prices older than the position's entry.
This is a trust assumption. Whoever holds the signing key could sign a false price and drain the vault. The source can also be manipulated on thin coins, which is why there is a liquidity minimum.
Practice
Practice gives you 10 paper SOL at live prices with the same fees and limits. It is stored in your browser, has no value, and is not onchain.
Risks
- Leverage can lose your whole margin quickly.
- The contract has not had an independent audit. Passing tests is not an audit.
- The admin key and the price key are central points of failure.
- Traders can pick among recent signed prices, which can favour them against the vault on fast moves. The minimum hold reduces this but does not remove it.
- Open profit is not subtracted from a vault share's value until a position closes, so depositors who exit early can shift loss to those who stay.
- No funding rate means open positions pay no ongoing cost.
Program reference
| Tag | Instruction | Notes |
|---|---|---|
| 0 | initialize | Creates the pool once |
| 1 | deposit | SOL in, shares out |
| 2 | withdraw | Shares in, SOL out, free liquidity only |
| 3 | open | Needs a signed price instruction before it |
| 4 | close | Owner only, needs a signed price |
| 5 | liquidate | Anyone, needs a signed price |
| 6 | configure | Admin only, within hard limits |
Accounts are program addresses: ["pool"], ["lp", owner], ["pos", owner, nonce]. The signed message is 52 bytes: "CTX1", mint, price × 1015 in SOL, unix timestamp.
Contrix