Swap / DEX·EVM
Deri Protocol
Decentralised derivatives protocol offering perpetual futures, everlasting options, power perpetuals, and gamma swaps under one liquidity pool. Deri V4 splits state across an i-Chain (interaction layer on Arbitrum / BNB Chain / zkSync / zkEVM) and a d-Chain (Arbitrum Orbit L3) for cross-chain risk netting.
- 01perpetual futures on long-tail assets
- 02everlasting (perpetual) options without expiry
- 03power perpetuals (ETH^2 / ETH^0.5)
- 04gamma swaps for vol exposure
- 05BNB Chain + Arbitrum derivatives UIs
- pnpm add viem ethers
- forge install deri-protocol/deriprotocol-v3
| Variable | Scope | Description |
|---|---|---|
| NEXT_PUBLIC_DERI_RPC_URL | Client | RPC for the i-Chain you target (Arbitrum One, BNB Chain, zkSync Era, or Polygon zkEVM). |
| DERI_POOL_ADDRESS | Client | Address of the v4 `Pool` (i-Chain implementation) for the asset universe you trade — different per chain. |
| DERI_API_URL | Client | Off-chain price/oracle helper API (`https://api.deri.io`) used to fetch signed mark prices and funding curves. |
Use viem against the Deri V4 `Pool` on your chosen i-Chain. Deposit margin with `Pool.addMargin(symbolId, amount)` (USDC base) and open a position via `Pool.trade(symbolId, tradeVolume, priceLimit, signedPriceData)` where `signedPriceData` is fetched from `https://api.deri.io/v4/price/{symbol}`. Symbols look like `BTCUSD-PERP`, `ETHUSD-EVERLASTING-CALL-3000`, `ETHUSD-POWER-2`, or `ETHUSD-GAMMA`. Close a leg with the opposite trade. Read margin and PnL via `Pool.getMarginInfo(account)`. Funding is paid continuously per block and accrues into your margin balance — there is no expiry on options or power perpetuals, but margin maintenance is enforced by `Pool.liquidate(account)` keepers.
- ⚑Everlasting options are priced via a continuously paid funding rate that approximates the option's theta — high-IV regimes spike funding sharply, and a long position can bleed faster than a traditional dated option even though it never expires.
- ⚑Power perpetuals (ETH^2 etc.) accrue funding to keep the mark close to spot^k; in trending markets longs/shorts pay each other large funding flows that make naive backtests dramatically wrong.
- ⚑V4 i-Chain / d-Chain split: trades happen on i-Chain but cross-pool risk is netted on the d-Chain Arbitrum Orbit L3; deposit-confirm latency can be tens of seconds. UIs must poll `Pool.getTraderState()` for confirmed margin, not trust the local pending tx.
- ⚑Mark prices come from an off-chain signer pushing oracle data on each trade — if the API is down, `trade()` reverts with `INVALID_PRICE_SIGNATURE`. Always have a fallback path or graceful UI failure.
- ⚑BNB Chain liquidity historically dominates ETH-pair trading; thin Arbitrum books mean the same symbol can have very different funding on each i-Chain. Aggregate carefully if you compose across deployments.
- ⚑DERI token has its own staking/`veDERI` flow on a separate contract from the v4 Pool — do NOT confuse staking rewards with trader margin.