Integrate

For aggregators, wallets, and developers routing to Spherra. Addresses and a hosted ABI go live at mainnet; until then, everything is in the repo.

Quickstart (viem)

import { createPublicClient, http } from 'viem'
const client = createPublicClient({ transport: http(RPC_URL) })

// quote is a view — no state change, no fee applied in the quote path
const [amountOut, segments] = await client.readContract({
  address: POOL, abi: orbitalAbi, functionName: 'quote',
  args: [tokenInIndex, tokenOutIndex, amountIn],
})

// swap (write): minAmountOut is your slippage bound; reverts if unmet
// await walletClient.writeContract({ address: POOL, abi: orbitalAbi,
//   functionName: 'swap', args: [tokenIn, tokenOut, amountIn, minAmountOut] })

Tokens are addressed by their index in the pool (0-based), not by address, in the swap/quote calls.

Reads (views)

FunctionReturnsUse
quote(tokenIn, tokenOut, amountIn)(amountOut, segments)Price a trade; segments = tick crossings
invariantResidual()int256 FPool health; F ≤ 0 = in band
tickReserves(tickId)uint256[] effectivePer-tick effective reserves
impliedPrice(token)uint256 (WAD)Pool's implied price for a token
quarantineDepth()uint256How many layers are quarantined
nActive()uint8Active token count

Writes

FunctionPurpose
swap(tokenIn, tokenOut, amountIn, minAmountOut)Trade on the sphere
addLiquidityAtDepeg(pDepeg, maxAmounts, minShares)Provide liquidity at a tick
removeLiquidity(tickId, sharesBurn, minAmounts)Withdraw
claim(tickId)Redeem settled proceeds
poke()Advance the implied-price accumulator (permissionless)

Lifecycle writes (freeze, unfreeze, queueSettle, settle, lift) are covered in Lifecycle & safety.

For aggregators

ships with the dev docs.

v1 constraints

18-decimal tokens only; no fee-on-transfer/rebasing tokens; feeless (no fee to account for in routing). See Security & risk for the full list.