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

CfdEngineSettlementModule

Git Source

Inherits: ICfdEngineSettlementModule

Title: CfdEngineSettlementModule

Externalized settlement executor for CfdEngine close and liquidation flows.

CfdEngine remains the storage owner and grants this module access only through narrow settlement-host hooks. The module does not own independent protocol state.

Constants

ENGINE

address public immutable ENGINE;

Functions

constructor

constructor(
    address engine_
);

onlyEngine

modifier onlyEngine();

executeOpen

Applies the live open/increase settlement plan produced by the planner.

Realizes carry, fee, and vault-flow side effects through the settlement host while keeping the engine as the canonical state owner.

function executeOpen(
    ICfdEngineSettlementHost host,
    CfdEnginePlanTypes.OpenDelta calldata delta,
    CfdTypes.Position calldata currentPosition,
    uint64 publishTime
) external onlyEngine;

executeClose

Applies the live close/decrease settlement plan produced by the planner.

Can record deferred trader credit, bad debt, and realized carry depending on the close result.

function executeClose(
    ICfdEngineSettlementHost host,
    CfdEnginePlanTypes.CloseDelta calldata delta,
    CfdTypes.Position calldata currentPosition,
    uint64 publishTime
) external onlyEngine;

executeLiquidation

Applies the live liquidation settlement plan produced by the planner.

function executeLiquidation(
    ICfdEngineSettlementHost host,
    CfdEnginePlanTypes.LiquidationDelta calldata delta,
    uint64 publishTime
) external onlyEngine returns (uint256 keeperBountyUsdc);

Returns

NameTypeDescription
keeperBountyUsdcuint256Liquidation bounty owed to the keeper after the state transition.

Errors

CfdEngineSettlementModule__Unauthorized

error CfdEngineSettlementModule__Unauthorized();