Developer FAQs

  • Updated

ℹ️ Don't see your question here? Come to our Discord and look for the #🏗coding-chat channel!

Is there an API?

There is no API in the regular sense. Perpetual Protocol uses The Graph API to provide data, and protocol functions can be called using tools that interact directly with the on-chain smart contracts.

How do I obtain a value for liquidity?

First call

Orderbook.getOpenOrder(address trader,
        address baseToken,
        int24 lowerTick,
        int24 upperTick
)

 

and the function will return a struct:

struct Info {
        uint128 liquidity;
        int24 lowerTick;
        int24 upperTick;
        uint256 lastFeeGrowthInsideX128;
        int256 lastTwPremiumGrowthInsideX96;
        int256 lastTwPremiumGrowthBelowX96;
        int256 lastTwPremiumDivBySqrtPriceGrowthInsideX96;
        uint256 baseDebt;
        uint256 quoteDebt;
    }