Protocol Attributes

Content Out of Date

This content is not maintained and refers to an out-of-date version of Perpetual Protocol.

For the latest documentation, see https://docs.perp.com

Base & Quotes Tokens

In Uniswap V3, a pool has two tokens: one designated as token0, and the other as token1. The order is decided by (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA)

The price of the pool is always token1/token0. The price range liquidity is added to is also based on this configuration.

Assuming we have pools such as vETH:vUSD or vBTC:vUSD, the price a Uniswap V3 Pool returns can be denominated in ETH, BTC or USD, depending on which is token0 and token1. This adds additional potential overhead.

To simplify, we force the ClearingHouse to only support Uniswap V3 Pools where token0 is base, and token1 isquote. This can be done by only deploying a BaseToken when its address is smaller than our QuoteToken (not using create2).

Contract & Token Addresses

Smart Contract Addresses

Complete Lists

Staging

https://metadata.perp.exchange/v2/optimism-kovan.json

Production

https://metadata.perp.exchange/v2/optimism.json

Hot Tub

https://metadata.perp.exchange/kantaban/optimism.json

Proxy Contracts

Perpetual Protocol uses proxies for upgradeability. Please check the proxy addresses below for the latest versions.

Exchange Proxy Contract

https://optimistic.etherscan.io/address/0xbd7a3b7dbeb096f0b832cf467b94b091f30c34ec#writeProxyContract

Clearinghouse Proxy Contract

https://optimistic.etherscan.io/address/0x82ac2ce43e33683c58be4cdc40975e73aa50f459#writeProxyContract

Vault Proxy Contract

https://optimistic.etherscan.io/address/0xad7b4c162707e0b2b5f6fddbd3f8538a5fba0d60#writeProxyContract

IF Proxy Contract

https://optimistic.etherscan.io/address/0x1C9a192DF3936cBF093d8afDc352718bCF834EB6#writeProxyContract

Pool Party Reward Contracts

PERP Token Addresses

There may be PERP tokens that are not genuine. Be sure to check you are trading the correct token.

The following are known PERP tokens on various chains.

Ethereum mainnet

0xbc396689893d065f41bc2c6ecbee5e0085233447

Optimism

0x9e1028f5f1d5ede59748ffcee5532509976840e0

xDai

0x7ecF26cd9A36990b8ea477853663092333f59979

BSC

0x4e7f408be2d4e9d60f49a64b89bb619c84c7c6f5

Arbitrum

0x753d224bcf9aafacd81558c32341416df61d3dac

vePERP Token Address

Optimism

0xD360B73b19Fb20aC874633553Fb1007e9FcB2b78

Hot Tub Contracts

Full list: https://metadata.perp.exchange/kantaban/optimism.json

ETH Vaults

ArbETH-ETH vault

  • ETHUSDCBaseVault (user’s entry point): 0x722Ef09F933f09069257C68563B715486365B895

  • ETHUSDCBaseVaultPerpPositionManager (Vault’s Perp account): 0x3d03748A0FbBa8DD5F07b16c0178cdd1327FC58a

  • ETHUSDCBaseVaultToken (Vault’s ERC20 LP token): 0xf2c886623309c93b56537C8c4d4321813ef78439

ArbETH-USDC vault

  • ETHUSDCQuoteVault (user’s entry point): 0x748A38f4a430504Deb15fD5BB157dd466f8284B9

  • ETHUSDCQuoteVaultPerpPositionManager (Vault’s Perp account): 0x54E32c4c28f6e9B3F428635FD8e52b1C5742FC88

  • ETHUSDCQuoteVaultToken (Vault’s ERC20 LP token): 0x83d6675FE072928132c1B98ca3647De2fA9c8d84

OP Vaults

ArbOP-OP vault

  • OPUSDCBaseVault (user's entry point): 0x5039cDE9ed71256BE27A36440380F36cAD45d270

  • OPUSDCBaseVaultPerpPositionManager (Vault's Perp account): 0xe72716C65d99c477C7E381E30Fb29F602CA784B8

  • OPUSDCBaseVaultToken (Vault's ERC20 LP token): 0xeF9d827408C52C0F87278e1068Ef652Ad7274356

ArbOP-USDC vault

  • OPUSDCQuoteVault (user's entry point): 0x7AF98C4edc50cd7EC18C8B28A34200a16f53F3a4

  • OPUSDCQuoteVaultPerpPositionManager (Vault's Perp account): 0xf4880599EB67F932df64ec1ED7b163c16Cd3929B

  • OPUSDCQuoteVaultToken (Vault's ERC20 LP token): 0x0A8C0b205549589FEAdFB954282fBd187E541D83

WBTC Vaults

ArbBTC-BTC Vault

  • BTCUSDCBaseVault (user's entry point): 0x6e9205B734455b578D06135de51E87D742d32cF2

  • BTCUSDCBaseVaultPerpPositionManager (Vault's Perp account): 0x2D97d9714B6ccd75F5EA109a0B220b978a8C6F84

  • BTCUSDCBaseVaultToken (Vault's ERC20 LP token): 0x78Ef3a1Dfb1Cee9B62b55a96fc076F2Ad09D8B6D

ArbBTC-USDC Vault

  • BTCUSDCQuoteVault (user's entry point): 0x243e5F2CedDf3C7098832bCB890eF70A34099415

  • BTCUSDCQuoteVaultPerpPositionManager (Vault's Perp account): 0x3d99EB56fA430503ffE85E7A8064a467C85DeaA1

  • BTCUSDCQuoteVaultToken (Vault's ERC20 LP token): 0xA825825F3C0E7D0e6413981ad940AfD8a8b1B976

Other Hot Tub Contracts

  • KtbArbitrageur (whitelisted contract that can swap between Hot Tub and DEX but need to transfer all profits back to Hot Tub): 0xEE1aDAEa27E97440DF594d601E366b3a1f1703dd

  • Router: 0x2D9949BbeBfBEC3dd087781Ae546202E708B841b

  • VaultConfig (store config for all Hot Tub vaults, including whitelist, deleverageMarginRatio, etc.): 0x5Da8E71EA120DE22447BC8aE339FE398c17178fA

Error Codes

Complete list

A comprehensive list of error codes can be found here:

https://github.com/perpetual-protocol/sdk-curie/blob/d36b78bba53beb3fdac60d8aebeedca92a9df7cf/src/errors/errors.ts

Clearinghouse

CH_PSCF Price slippage check fail

Transaction exceeded set slippage tolerance

AB_MNE Markets number exceeds

Position would exceed cap on number of markets. See: Limits & Caps

Slippage reversion error codes

CH_TLRS Too little received when short

CH_TMRS Too much requested when short

CH_TLRL Too little received when long

CH_TMRL Too much requested when long

Vault

V_GTSTBCGreater than settlement token balance cap

Deposit exceeds current TVL cap. See: Limits & Caps

Limit Orders

LOB_ROINS Reduce-only limit order size exceeds available position size

LOB_OVTS Order value too small (<100 USD)

CH_NEFCI Not enough free collateral

AB_MNE Number of markets exceeds limit

Uniswap

SPL Square root price limit

Price moved outside of slippage tolerance before the swap took place.

Last updated