Perpetual Protocol
Searchโ€ฆ
๐ŸŽ’
Developer FAQ

Where can I review the source code / smart contracts?

Please check out our Github! Feel free to open an issue or PR if you have any questions or suggestions.
GitHub - perpetual-protocol/perpetual-protocol: Perpetual Protocol Solidity smart contracts
GitHub

Is there a Python SDK?

There are two python SDKs created by community members. Note these are provided AS-IS. If you use these resources for trading, you must review 100% of the code before proceeding.

How to contribute? Are there bounties?

We welcome contributions via our Github. You can also check out our open bounties here: https://bounties.perp.fi/โ€‹
We also have a #coding-chat channel in our Discord if you want to learn more about contributing!

What are the smart contracts addresses?

Get the current addresses here:

Where can I view the contract ABIs?

First get the smart contract addresses from the link above.
For Ethereum (layer1), get the ABIs on Etherscan.
For xDai (layer2), get the ABIs on Blockscout.

Is there a subgraph for Perpetual Protocol?

A subgraph has been created on The Graph by our team and we expect more will be created with further data soon.
https://thegraph.com/explorer/subgraph/perpetual-protocol/perp-position-subgraph?query=List%20PositionChanged%20events
Hosted Service

Is there an xDAI faucet?

There are three working faucets - - xDai faucet, Blockscount's faucet, and Bao Finance's xDai faucet.
Welcome to ask us for some xDAI in Discord #coding-chat
You can also convert DAI to xDAI at https://bridge.xdaichain.com/.

What is the k for each AMM?

K values are set for each AMM (ie. each perpetual market) at launch. These values can be obtained using the perp-cli tool. Note that the values returned may be subject to or lead to rounding errors.
For example, call perp amm ETH to get the QuoteAssetReserve and BaseAssetReserve (x and y values) for this AMM.

What does "price is over fluctuation limit" mean?

We have a per-block price fluctuation limit of ยฑ1.2%. If you are outside this range, a "price is over fluctuation limit" error is thrown.
For example, if the price in the last block is 1,000, then the price range in the next block will be 988 ~ 1012.

How is the slippage tolerance applied when closing a position?

The value of the slippage tolerance is position notional x (1 ยฑ 0.5%) ( +/- depends on long or short)

How is the funding rate obtained?

ClearingHouse.getLatestCumulativePremiumFraction() returns premiumFraction
  • fundingRate = premiumFraction / twapIndexPrice
  • fundingPayment = premiumFraction * positionSize