Integrate: routers & aggregators
Tangent is a single on-chain contract that quotes and fills spot swaps between USDC and Hyperliquid-listed tokens at the live Hyperliquid mark plus a deterministic spread. There is no curve, no LP ratio and no reserve to drain: a quote depends on the oracle mid and the pool's inventory, and the same number is what swapExactIn pays. This page is everything a router needs to source liquidity from it.
Sixty-second summary
- Chain Elysium mainnet, chain id 99901, ~100 ms blocks, EVM (Arbitrum Nitro). Public RPC
https://rpc.elysium.kinetiq.xyz. - Venue
TangentPool0x63E9820703bA150068C4533e292D1A1745dcaE87. Pairs: USDC ↔ each market token. No token-to-token pairs; route through USDC. - Quote
quote(tokenIn, tokenOut, amountIn)is aviewthat returns the exactamountOutthe swap will pay in the same block, or reverts with a typed error that tells you why that size is not fillable. - Fill approve
TangentPoolfortokenIn, thenswapExactIn(tokenIn, tokenOut, amountIn, minAmountOut, to, deadline). Exact-input only. - Also reachable as a Uniswap v4 pool. The allowlisted WHYPE/USDC pool on the Elysium PoolManager uses
TangentHook, which routes every exact-input swap intoTangentPool. If you already swap v4 pools, nothing new is required. - Size AMM per-trade cap is
maxTradeUsdE6per market (WHYPE: $5,000 today). Larger clips go through RFQ: a signed firm quote, filled onTangentRFQ. - Freshness prices are posted from Hyperliquid within hundreds of milliseconds of a move; if the oracle is older than
maxAgeSecthe pool fails closed (StalePrice) rather than quoting a stale number. Inventory is hedged on Hyperliquid within about a second of each fill, so quotes do not drift away from the market after you trade. - Off-chain mirror
GET https://tangent.it.com/api/quotereturns the samequote()output as JSON, decoded reverts included;GET /api/marketsandGET /api/riskgive you everything you need to pre-filter sizes without aneth_call.
Addresses (mainnet 99901)
| Contract | Address |
|---|---|
| TangentPool (quote + swap, approve this for direct fills) | 0x63E9820703bA150068C4533e292D1A1745dcaE87 |
| USDC (bridged canonical, 6 decimals) | 0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65 |
| TangentOracle | 0xCF0FA1a6E2cb9210382D1a0e0808Fc1b7A90eC2c |
| TangentRFQ (approve this for RFQ fills) | 0x04d2DAf62010eFf08c6850798CbD8996d0060EA5 |
| TangentHook (Uniswap v4 hook) | 0x49839D802b06ABDc6461e7B9259293B2CfbB2888 |
| Uniswap v4 PoolManager (Elysium) | 0xE2e105d3F7209A9DA11f83cCf3E7398a753823F1 |
Market tokens (the non-USDC side of every pair). Decimals differ per token — read them from the contract or from /api/markets, never assume 18:
| Symbol | Name | Decimals | Hedged on | Address |
|---|---|---|---|---|
| WHYPE | Wrapped HYPE | 18 | HYPE-PERP (#159) | 0xbA876237B0F021A6c6D852d6c26E107997cC5E81 |
| UBTC | Unit Bitcoin | 8 | BTC-PERP (#0) | 0xe9c29585eae4b9a55b02a9605aea892b40d972e8 |
| UETH | Unit Ethereum | 18 | ETH-PERP (#1) | 0x7a66a75fe41bc26867c17fe1bc7d1c076ebd4ecd |
| USOL | Unit Solana | 9 | SOL-PERP (#5) | 0xd78eC40Ac7412069cA0f223413c7E5E1d18f4315 |
| PURR | Purr | 18 | PURR-PERP (#152) | 0x46b131573Ca7c2674b652BbeB7FC16D530396aEC |
The live list, with parameters and pause flags, is GET /api/markets or on-chain marketCount() + markets(id). The full address book is on Contracts & addresses.
Path A — direct: quote and swapExactIn
Interface
interface ITangentPool {
/// Exact output for amountIn at the current block. Reverts with the same errors swapExactIn would
/// (except Expired / Slippage), so a successful quote means the size is fillable right now.
function quote(address tokenIn, address tokenOut, uint256 amountIn)
external view
returns (uint256 amountOut, uint256 midE8, uint256 spreadBps, uint256 protocolFeeUsdE6); // 0xb6466384
/// Pulls amountIn (needs allowance), pays amountOut to `to`. Exact-input only.
function swapExactIn(address tokenIn, address tokenOut, uint256 amountIn,
uint256 minAmountOut, address to, uint256 deadline)
external returns (uint256 amountOut); // 0x1a019e37
// Capacity / state reads used by routers
function marketCount() external view returns (uint256); // 0xec979082
function markets(uint256 id) external view returns (Market memory); // 0xb1283e77
function marketIdOf(address token) external view returns (uint256 idPlusOne); // 0xc95f4ac4 (0 = not a market)
function paused() external view returns (bool); // 0x5c975abb
function freeUsdc() external view returns (uint256); // 0xb7cd4efe
function riskMode() external view returns (uint8 mode, int256 worstNetDeltaUsdE6, bool hedgeStale); // 0x205600c8 (0 normal, 1 reduce-only)
struct Market {
address token; uint8 decimals; uint32 perpIndex;
uint16 baseSpreadBps; uint16 skewSpreadBps; uint16 maxSpreadBps;
uint128 maxInventoryUsdE6; uint128 maxTradeUsdE6; uint128 targetInventory;
bool enabled; bool buyPaused; bool sellPaused;
}
event Swap(address indexed sender, address indexed to, address tokenIn, address tokenOut,
uint256 amountIn, uint256 amountOut, uint256 midE8, uint256 spreadBps, uint256 protocolFeeUsdE6);
// topic0 0x40997d238e11ae20f00d25adab0cd2ed389f5c94ccea812f68ceff69d92d7ad9
}
Units: token amounts in the token's own base units; midE8 is USD per whole token × 1e8; spreadBps in basis points; USD values are E6 (USDC base units).
Flow
- Resolve the market.
marketIdOf(token)returnsid + 1(0 means the token is not listed). One side of the pair must be USDC. - Quote.
eth_call quote(tokenIn, tokenOut, amountIn). On success,amountOutis exact for the current block. On revert, decode the custom error (table below) — most of them are "not at this size / not right now", not failures. - Set
minAmountOut. Between your quote and inclusion the oracle mid can tick. Elysium blocks are ~100 ms and the poster updates on moves of a few bps, so a tolerance of 5–20 bps below the quoted output is typical; the contract revertsSlippage(out, minOut)rather than filling below it. For a reference price themidE8returned byquoteis the Hyperliquid mark the pool is pricing from. - Approve and fill.
IERC20(tokenIn).approve(TangentPool, amountIn)thenswapExactIn(..., to, deadline). The pool paystoin the same transaction and emitsSwap.
Pricing is deterministic
You can reproduce quote off-chain from markets(id), the oracle mid and the pool's token balance. For integer-exact results use the contract; this is the model:
inv = tokenBalance − targetInventory // signed, token units
invUsd = inv × mid
dir = +1 if you SELL token to the pool, −1 if you BUY token from it
invAfter = invUsd + dir × tradeUsd // tradeUsd = usdcIn, or tokenIn × mid
pressure = clamp(dir × invAfter / maxInventoryUsdE6, 0, 1)
spreadBps = min(baseSpreadBps + skewSpreadBps × pressure, maxSpreadBps)
buy (USDC → token): amountOut = usdcIn × 10^(dec+2) × 1e4 / (midE8 × (1e4 + spreadBps)) (floor)
sell (token → USDC): amountOut = tokenIn × midE8 × (1e4 − spreadBps) / (10^(dec+2) × 1e4) (floor)
Only the side that pushes inventory away from targetInventory is widened; the side that brings it back trades at baseSpreadBps. In practice this means the pool is usually the best venue in the direction it wants flow — check both directions. All the inputs are in GET /api/markets (params, inventory.tokenBalance, oracle.midE8).
Capacity: the largest size that will fill
Three bounds apply per market and direction. Compute them before quoting so you never send a size that reverts:
maxTradeUsd = params.maxTradeUsdE6 // hard per-trade cap (quote reverts TradeTooLarge above it)
maxBuyUsd = min(maxTradeUsd, maxInventoryUsd + invUsd) // buying token drives inventory down (InventoryLimit)
maxBuyTokens = min(maxBuyUsd / mid, tokenBalance) // and the pool must hold the tokens (InsufficientLiquidity)
maxSellUsd = min(maxTradeUsd, maxInventoryUsd − invUsd, freeUsdc) // selling token drives inventory up; USDC out of free balance
invUsd is inventory.deltaUsdE6 in /api/markets (signed, relative to target). A sellPaused flag on a market means the capacity governor has temporarily closed the token→USDC side because the Hyperliquid hedge account is near its margin limit; buyPaused is the mirror. Both are read from markets(id) and surfaced in /api/markets and /api/risk; treat them as "no liquidity in that direction right now" and re-check on the next poll, they clear automatically.
Revert catalogue
quote and swapExactIn revert with custom errors. Decode them (ABI on Contracts & addresses) and map them like this:
| Error | Meaning | What to do |
|---|---|---|
InvalidPair() | Neither side is USDC, or the token is not a market | Route through USDC; refresh the market list |
MarketDisabled() | Market switched off by the owner | Drop the market until enabled flips back |
DirectionPaused() | buyPaused / sellPaused for that side | Skip that direction; poll /api/markets (clears automatically) |
Paused() | Whole pool paused (guardian) | Skip the venue; poll /api/risk |
StalePrice() / PriceDisagreement() (oracle) | Posted price older than maxAgeSec, or the two oracle sources disagree | Venue is intentionally offline; retry in a few seconds |
TradeTooLarge(usdE6, maxUsdE6) | Above maxTradeUsdE6 | Split the clip, or request an RFQ quote (Path C) |
InventoryLimit(invAfterUsdE6, maxUsdE6) | Would push inventory past the cap | Reduce size to the capacity bound above |
InsufficientLiquidity(want, have) | Pool lacks the output token / free USDC | Reduce size to have |
ReduceOnly(netDeltaUsdE6, maxNetDeltaUsdE6) | Hedge lagging; only delta-reducing trades accepted | Try the opposite direction, or retry after the next hedge report (seconds) |
Slippage(out, minOut) (swap only) | Output fell below your minAmountOut | Re-quote; widen tolerance a few bps |
Expired() (swap only) | block.timestamp > deadline | Re-submit with a fresh deadline |
ZeroAmount() | amountIn or computed output is 0 | Dust; skip |
Rule of thumb: if quote succeeds, swapExactIn with the same inputs in the same block succeeds, except for Slippage/Expired which are under your control.
Gas
A direct swapExactIn is one oracle read, two ERC-20 transfers and an event: estimate it with eth_estimateGas from your router; it is in the same class as a Uniswap v3 single-hop. Fills through the v4 hook pay the PoolManager's unlock/settle overhead on top (observed 0.9–1.1 M gas for arbitrage bundles that touch several pools; the hook's own share is a fraction of that). Gas on Elysium is paid in HYPE and is cheap.
Code: viem
import { createPublicClient, createWalletClient, http, parseAbi, type Address } from 'viem';
const POOL: Address = '0x63E9820703bA150068C4533e292D1A1745dcaE87';
const USDC: Address = '0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65';
const WHYPE: Address = '0xbA876237B0F021A6c6D852d6c26E107997cC5E81';
const abi = parseAbi([
'function quote(address,address,uint256) view returns (uint256 amountOut,uint256 midE8,uint256 spreadBps,uint256 protocolFeeUsdE6)',
'function swapExactIn(address,address,uint256,uint256,address,uint256) returns (uint256)',
'function approve(address,uint256) returns (bool)',
'error TradeTooLarge(uint256,uint256)', 'error InventoryLimit(int256,uint256)', 'error InsufficientLiquidity(uint256,uint256)',
'error ReduceOnly(int256,uint256)', 'error DirectionPaused()', 'error Paused()', 'error InvalidPair()', 'error MarketDisabled()',
'error Slippage(uint256,uint256)', 'error Expired()', 'error ZeroAmount()', 'error StalePrice()', 'error PriceDisagreement()',
]);
const pub = createPublicClient({ transport: http('https://rpc.elysium.kinetiq.xyz') });
// 1. quote 1,000 USDC -> WHYPE
const amountIn = 1_000_000_000n; // 1,000 USDC (6 dp)
const [amountOut, midE8, spreadBps] = await pub.readContract({ address: POOL, abi, functionName: 'quote', args: [USDC, WHYPE, amountIn] });
// On revert, viem throws ContractFunctionRevertedError with .data.errorName = 'TradeTooLarge' | 'InventoryLimit' | ...
// 2. fill with 10 bps tolerance and a 60 s deadline
const minOut = (amountOut * 9_990n) / 10_000n;
const deadline = BigInt(Math.floor(Date.now() / 1000) + 60);
const wallet = createWalletClient({ account, transport: http('https://rpc.elysium.kinetiq.xyz') });
await wallet.writeContract({ address: USDC, abi, functionName: 'approve', args: [POOL, amountIn] });
await wallet.writeContract({ address: POOL, abi, functionName: 'swapExactIn', args: [USDC, WHYPE, amountIn, minOut, account.address, deadline] });
Code: Solidity adapter
contract TangentAdapter {
ITangentPool constant POOL = ITangentPool(0x63E9820703bA150068C4533e292D1A1745dcaE87);
function swap(address tokenIn, address tokenOut, uint256 amountIn, uint256 minOut, address to) external returns (uint256 out) {
IERC20(tokenIn).transferFrom(msg.sender, address(this), amountIn);
IERC20(tokenIn).approve(address(POOL), amountIn);
out = POOL.swapExactIn(tokenIn, tokenOut, amountIn, minOut, to, block.timestamp);
}
}
Path B — Uniswap v4 hook pool
The WHYPE/USDC pool below is initialised on the Elysium PoolManager with TangentHook. The hook implements beforeSwap with a return delta: it takes the input from the PoolManager, calls TangentPool.swapExactIn, settles the output back, and the v4 curve swaps nothing. No liquidity can be added to this pool; its price is always the Tangent quote.
PoolKey {
currency0: 0xb47c4C8F73F009CC0C0d3f92B388d13E293F0B65 // USDC
currency1: 0xbA876237B0F021A6c6D852d6c26E107997cC5E81 // WHYPE
fee: 0
tickSpacing: 60
hooks: 0x49839D802b06ABDc6461e7B9259293B2CfbB2888
}
poolId = 0xd331c8873b388b5223e1117b5b1896c1a62f5dbb5013964ab7d72c11b308a898
What is different from a normal v4 pool:
- Exact-input only.
amountSpecifiedmust be negative; exact-output swaps revertExactOutputNotSupported(). sqrtPriceLimitX96is ignored (the curve is bypassed). PassminAmountOutas the first 32 bytes ofhookDatainstead; the hook revertsSlippage(out, minOut)below it. Routers that cannot set hookData should enforce slippage at the router level.- Per-swap cap
maxNotionalUsdE6on the hook ($500 today, readmaxNotionalUsdE6()), independent of the pool'smaxTradeUsdE6. Above it the hook revertsNotionalCapExceeded(notional, cap); use Path A for larger clips. - Quoting
Quoter/StateViewon the v4 curve return nothing useful for this pool. Quote viaTangentPool.quote(or/api/quote) — it is the exact hook output. - Input sourcing the hook
takesamountInfrom the PoolManager's aggregate balance (other pools' reserves) and settles the output; when the PoolManager cannot cover the input the hook falls back to its own float and revertsInsufficientFloat(...)only if neither covers it.
Routers already filling this pool through the Universal Router treat it as any other v4 pool; the aggregator fills observed on mainnet all arrived this way.
Path C — RFQ for size
Above maxTradeUsdE6 the hedger signs firm quotes priced off real Hyperliquid book depth for the hedge size, and the pool fills them with no inventory skew.
POST https://tangent.it.com/api/rfq/quotewith{ "tokenIn": "WHYPE", "tokenOut": "USDC", "amountIn": "100000000000000000000", "taker": "0xYourFiller" }(addresses or symbols;takeroptional but recommended — a quote withtaker = 0x0is fillable by anyone).- Response:
{ quote, signature, midE8, slippageBps, spreadBps, fairOut, expiresAt, rfqAddress, chainId, poolAddress }.quoteis the EIP-712 structQuote { taker, tokenIn, tokenOut, amountIn, amountOut, spreadBps, expiry, nonce }under domainname "Tangent RFQ", version "1", chainId 99901, verifyingContract = TangentRFQ. TTL ≈ 30 s. - Approve
tokenInto TangentRFQ (not the pool) and callfill(quote, signature)(selector0xaff03d31). The contract checksexpiry,taker, the one-timenonceand the signer, pullsamountInand callspool.swapRFQ, which re-validates the price against the current oracle mid:fairOut × (1 − maxSpread) ≤ amountOut ≤ fairOut.
Limits: rfqMaxTradeUsdE6 (default $50,000) and the same inventory / reduce-only rules. GET /api/rfq/info returns the live configuration and whether the quoter is reachable. Details in RFQ for size.
Liveness and what to expect
- Updates the hedger streams Hyperliquid mids over WebSocket and posts to the oracle whenever a market moves beyond a small threshold or at least every ~15 s; posts reach the sequencer in roughly 100–600 ms. Each fill is hedged on Hyperliquid within ~1 s and reported on-chain every ~30 s.
- Failing closed is a feature. When the oracle is stale or the two sources disagree the pool reverts instead of quoting. Your router should see that as "no route", not as an outage to alert on.
- Inventory recovers on its own. After a burst of one-sided flow the skew makes the opposite direction cheaper and a rebalancer restocks tokens from Hyperliquid spot, so capacity returns within minutes.
- Status
GET /api/risk→status(ok/warning/critical),warnings[],riskMode, hedge freshness, per-market utilisation.GET /api/health→ RPC and Hyperliquid reachability. Both are keyless and cached ~2 s. - Operator a single operator runs the hedger today (see Roles, trust & risks); the contract caps what it can do and trading halts, rather than misprices, if it stops.
Listing checklist
What we provide for a listing, in one place:
| Item | Where |
|---|---|
| Contract addresses + verified source | Contracts & addresses, explorer links |
| ABI (JSON) | @tangent/shared package, or the verified source on the explorer |
| Token list with decimals and perp mapping | GET /api/markets, table above |
| Quote endpoint mirroring the on-chain view | GET /api/quote?tokenIn=&tokenOut=&amountIn= |
| Status / pause / capacity endpoint | GET /api/risk, GET /api/markets |
| OpenAPI document | GET /api/openapi.json |
| Event signature for indexing | Swap topic0 above; GET /api/swaps and GET /api/stats as a reference indexer |
| Machine-readable guide for agents | GET /skill.md, MCP at POST /mcp |
| Contact | @Tangent_ely on X |
If your integration needs something that is not here — a different quote view, a batch endpoint, a webhook on pause flags — ask; the surface is small and we ship quickly.