Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

PerpsPublicLens

Git Source

Inherits: IPerpsTraderViews, IPerpsLPViews, IProtocolViews

Title: PerpsPublicLens

Compact read facade for the simplified product-facing perps surface.

This intentionally presents a narrower, easier-to-consume view than the rich engine and accounting lenses used by tests, audits, and operator tooling.

Constants

ACCOUNT_LENS

ICfdEngineAccountLens public immutable ACCOUNT_LENS;

ENGINE

ICfdEngineCore public immutable ENGINE;

ORDER_ROUTER

IOrderRouterAccounting public immutable ORDER_ROUTER;

HOUSE_POOL

HousePool public immutable HOUSE_POOL;

Functions

constructor

constructor(
    address accountLens_,
    address engine_,
    address orderRouter_,
    address housePool_
);

Parameters

NameTypeDescription
accountLens_addressRich account lens used to derive compact trader views.
engine_addressCore engine used for runtime status and risk params.
orderRouter_addressRouter accounting surface used for pending-order summaries.
housePool_addressHousePool used for tranche and protocol status views.

getTraderAccount

Returns the compact trader account summary for a canonical perps account.

function getTraderAccount(
    bytes32 accountId
) external view returns (PerpsViewTypes.TraderAccountView memory viewData);

getPosition

Returns the compact current-position view for an account.

function getPosition(
    bytes32 accountId
) external view returns (PerpsViewTypes.PositionView memory viewData);

getPendingOrders

Returns all currently pending orders for an account.

The public surface only returns pending orders because executed and failed orders are not part of the compact product-facing queue summary.

function getPendingOrders(
    bytes32 accountId
) external view returns (PerpsViewTypes.PendingOrderView[] memory pending);

isLiquidatable

Returns whether the account’s current live position is liquidatable.

function isLiquidatable(
    bytes32 accountId
) external view returns (bool);

getSeniorTranche

Returns the compact senior tranche view.

function getSeniorTranche() external view returns (PerpsViewTypes.TrancheView memory viewData);

getJuniorTranche

Returns the compact junior tranche view.

function getJuniorTranche() external view returns (PerpsViewTypes.TrancheView memory viewData);

getLpStatus

Returns high-level LP status flags.

function getLpStatus() external view returns (PerpsViewTypes.LpStatusView memory viewData);

getProtocolStatus

Returns high-level protocol runtime status flags.

function getProtocolStatus() external view returns (PerpsViewTypes.ProtocolStatusView memory viewData);

_getPositionView

function _getPositionView(
    bytes32 accountId
) internal view returns (PerpsViewTypes.PositionView memory viewData);

_getTrancheView

function _getTrancheView(
    address vault,
    bool isSenior
) internal view returns (PerpsViewTypes.TrancheView memory viewData);

_getProtocolStatusView

function _getProtocolStatusView() internal view returns (PerpsViewTypes.ProtocolStatusView memory viewData);