← Protocols
Thales
Prediction Market·EVM (Optimism, Arbitrum, Polygon, Base)

Thales

01Description

Permissionless parimutuel and binary-options protocol. Lets users buy UP/DOWN positional tokens on crypto, commodity and stock prices using Chainlink data feeds — deployed on Optimism, Arbitrum, Polygon and Base.

02Best for
  • 01binary options frontends
  • 02ranged-market price prediction apps
  • 03speculation widgets on top of Chainlink feeds
  • 04DeFi-native trading UIs
  • 05thales-AMM-powered third-party products
03Install
  • pnpm add ethers viem
04Environment variables
VariableScopeDescription
NEXT_PUBLIC_THALES_NETWORK_IDClientTarget network id: 10 (Optimism), 42161 (Arbitrum), 137 (Polygon) or 8453 (Base). Drives AMM and PositionalMarketManager addresses.
NEXT_PUBLIC_THALES_API_BASEClientBase URL for Thales market data API (e.g. https://api.thalesmarket.io). Used for listing live markets and historical PnL.
05Prompt snippet
Use Thales for binary options and ranged price markets. List active markets via `GET https://api.thalesmarket.io/markets/<network>` or query the `thales-protocol` subgraph (markets, ranged-markets, positions). Buy/sell positional tokens through `ThalesAMM` (binary UP/DOWN) or `RangedMarketsAMM` (IN/OUT) — call `buyFromAmmQuote(market, position, amount)` to price, then `buyFromAmm(market, position, amount, expectedPayout, additionalSlippage)` to execute. Markets reference Chainlink price feeds and resolve automatically at maturity; redeem winnings via `exerciseOptions` on the position contract. Use sUSD on Optimism or USDC/USDT on other chains as the quote token.
06Gotchas
  • Quote currency varies: sUSD on Optimism legacy markets, USDC on Arbitrum / Base / Polygon. Hardcoding sUSD across chains is the most common silent breakage — read it from `PositionalMarketManager.sUSD()` per chain.
  • Markets resolve from Chainlink feeds at maturity — disputed/stale rounds can delay `resolveMarket`. Surface `market.resolved` and `market.phase` (Trading / Maturity / Expiry) so users know when to exercise.
  • AMM pricing is non-linear — price impact grows with size against thin liquidity. Always call `buyFromAmmQuote` immediately before `buyFromAmm` and pass `additionalSlippage` (typically 1–3%).
  • Position tokens are ERC-20 but only redeemable after maturity. Don't list them as tradable assets in a wallet UI without showing the `maturityDate`.
  • Thales geofences certain jurisdictions at the frontend; the contracts are permissionless but if you ship a US-facing UI without disclaimers you inherit the regulatory risk yourself.
  • Overtime (sports) is now a separate protocol — don't conflate `OvertimeAMMV2` calls with `ThalesAMM`. They diverged at v2.
07Alternatives