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

CfdEngineAccountLens

Git Source

Inherits: ICfdEngineAccountLens

Title: CfdEngineAccountLens

Rich per-account diagnostic lens for audits, tests, and operator tooling.

This is intentionally wider than the product-facing PerpsPublicLens surface.

Constants

engineContract

CfdEngine public immutable engineContract;

Functions

constructor

constructor(
    address engine_
);

Parameters

NameTypeDescription
engine_addressDeployed CfdEngine instance to inspect.

getAccountCollateralView

Returns detailed clearinghouse bucket and reachability state for an account.

function getAccountCollateralView(
    bytes32 accountId
) external view returns (CfdEngine.AccountCollateralView memory viewData);

getWithdrawableUsdc

Returns the current withdrawable USDC for an account under engine-side guards.

Open-position withdrawals are limited by free buying power, degraded mode, mark freshness, pending carry, and the post-withdraw initial margin requirement.

function getWithdrawableUsdc(
    bytes32 accountId
) external view returns (uint256 withdrawableUsdc);

getAccountLedgerView

Returns a compact accounting split for account custody, escrow, and deferred balances.

function getAccountLedgerView(
    bytes32 accountId
) external view returns (AccountLensViewTypes.AccountLedgerView memory viewData);

getAccountLedgerSnapshot

Returns the full account ledger snapshot used by tests and richer read paths.

function getAccountLedgerSnapshot(
    bytes32 accountId
) external view returns (AccountLensViewTypes.AccountLedgerSnapshot memory snapshot);

_buildAccountLedgerSnapshot

function _buildAccountLedgerSnapshot(
    bytes32 accountId
) internal view returns (AccountLensViewTypes.AccountLedgerSnapshot memory snapshot);

_position

function _position(
    bytes32 accountId
) internal view returns (CfdTypes.Position memory pos);

_riskParams

function _riskParams() internal view returns (CfdTypes.RiskParams memory params);