Trading & Staking (SDK)

Beyond privacy primitives, Obelysk includes an OTC orderbook for limit and market orders, a shielded swap router for private AMM trades, and a prover staking system where SAGE holders earn rewards by backing the GPU prover network.

📊
OTC Orderbook
On-chain limit/market orders with internal matching engine, depth charts, and trade history.
🔄
Shielded Swap
Privacy-preserving AMM swaps via Ekubo. The AMM sees the router — not your address.
⛏️
Prover Staking
Stake SAGE to back GPU provers. 4 tiers from Consumer (RTX 3060+) to H100. 15% APY.

OTC Orderbook

The OTC orderbook supports limit and market orders for Obelysk token pairs. Orders are matched on-chain with no intermediary.

Place a Limit Order

const order = await obelysk.otc.placeLimitOrder({
  pair: 'SAGE/STRK',
  side: 'sell',
  price: '0.011',    // 18-decimal fixed-point
  amount: '5000',
});

console.log('Order ID:', order.orderId);

Place a Market Order

const fill = await obelysk.otc.placeMarketOrder({
  pair: 'SAGE/STRK',
  side: 'buy',
  amount: '2000',
});

console.log('Filled at:', fill.averagePrice);

View Orderbook Depth

const depth = await obelysk.otc.getOrderbookDepth('SAGE/STRK');

console.log('Best bid:', depth.bids[0]?.price);
console.log('Best ask:', depth.asks[0]?.price);
console.log('Spread:', depth.asks[0]?.price - depth.bids[0]?.price);

Batch Operations

// Place multiple orders at once
await obelysk.otc.batchPlaceOrders([
  { pair: 'SAGE/STRK', side: 'sell', price: '0.011', amount: '1000' },
  { pair: 'SAGE/STRK', side: 'sell', price: '0.012', amount: '2000' },
  { pair: 'SAGE/STRK', side: 'sell', price: '0.013', amount: '3000' },
]);

// Cancel all your orders
await obelysk.otc.cancelAllOrders();
Trading Pairs

5 pairs are currently active: ETH/STRK, ETH/USDC, wBTC/ETH, wBTC/STRK, wBTC/USDC. All prices use 18-decimal fixed-point representation.


Shielded Swap

The shielded swap router executes privacy-preserving AMM swaps via Ekubo. Your swap is routed through the ShieldedSwapRouter contract using Ekubo's ILocker interface — the AMM only sees the router, not your address.

1
Withdraw from source privacy pool
The router withdraws your tokens from the input pool (e.g., SAGE pool) using your Merkle proof.
2
Swap via Ekubo AMM
The router executes the swap through Ekubo. The AMM sees the router contract as the swapper.
3
Deposit into destination pool
Swapped tokens are deposited into the output pool (e.g., ETH pool). A new commitment is created for you.
const result = await obelysk.swap.execute({
  tokenIn: 'eth',
  tokenOut: 'usdc',
  amountIn: '0.5',
  slippageBps: 50, // 0.5% slippage tolerance
});

console.log('Received:', result.amountOut, 'USDC');
console.log('Tx:', result.transactionHash);
Fee Structure

A 30bps (0.3%) protocol fee is applied to each shielded swap, deducted from the output amount before re-deposit. This is in addition to any Ekubo AMM fees.


Prover Staking

SAGE holders can stake tokens to back the GPU prover network. Stakers earn 15% APY and select a GPU tier that determines their minimum stake and reward multiplier.

GPU Tiers

TierMin StakeMultiplierHardware
Consumer1,000 SAGE1.0xRTX 3060, RTX 4060
Professional10,000 SAGE1.5xRTX 4090, A5000
DataCenter50,000 SAGE2.0xA100, L40
H100200,000 SAGE3.0xH100, H200, B200
Reward Calculation

Your effective reward rate = Base APY (15%) × Tier Multiplier. An H100 staker earns 15% × 3.0 = 45% effective APY. Rewards accrue per-block and can be claimed at any time.

Stake SAGE

await obelysk.staking.stake({
  amount: '10000',
  tier: 'Professional',
});

Check Staking Position

const position = await obelysk.staking.getStake('0xYOUR_ADDRESS');

console.log('Staked:', position.amount, 'SAGE');
console.log('Tier:', position.tier);
console.log('Active:', position.isActive);
console.log('Success count:', position.successCount);
console.log('Fail count:', position.failCount);

Unstake (Cooldown)

// Start the cooldown period
await obelysk.staking.requestUnstake({ amount: '5000' });

// After cooldown period expires, complete the unstake
await obelysk.staking.completeUnstake();

Claim Rewards

await obelysk.staking.claimRewards();

Network Stats

const totalStaked = await obelysk.staking.getTotalStaked();
const totalSlashed = await obelysk.staking.getTotalSlashed();
const config = await obelysk.staking.getConfig();

console.log('Network staked:', totalStaked, 'SAGE');
console.log('Cooldown period:', config.cooldownPeriod, 'blocks');
console.log('Slash rate:', config.slashPercent, '%');
Slashing

GPU provers that submit invalid proofs or fail to respond in time are slashed. The slash percentage is configurable on-chain. Slashed SAGE is burned.

Next Steps