ContrixBack to markets

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

Trading

  1. Paste a contract address or pick a market.
  2. Choose Short or Long.
  3. Set margin in SOL and leverage from 1x to 5x.
  4. Confirm in your wallet. The position opens at the signed price in that transaction.
  5. 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.

ParameterLaunch default
Max leverage5x (the program allows at most 10x)
Fee0.30% of size on open and on close
Max profit per position3x margin
Max position size2% of the pool
Liquidation levelEquity at 10% of margin
Max price age15 seconds
Minimum hold60 seconds before you can close
Funding rateNone

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

Program reference

TagInstructionNotes
0initializeCreates the pool once
1depositSOL in, shares out
2withdrawShares in, SOL out, free liquidity only
3openNeeds a signed price instruction before it
4closeOwner only, needs a signed price
5liquidateAnyone, needs a signed price
6configureAdmin 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.