LayerCover

IReinsuranceSettlementModule

Interface for the on-chain receivables ledger tracking private reinsurance debt.

View deployed contract addresses in the Contract Addresses section.

The ReinsuranceSettlementModule is an on-chain receivables ledger that tracks substitution debt when private reinsurance hooks cannot fully pay their claim portion. When the Backstop Pool or Treasury steps in to cover a hook's shortfall, the debt is recorded here and can be repaid later.

See 3rd Party Reinsurance → Debt Settlement for the full context.

Interface

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.20;

/**
 * @title IReinsuranceSettlementModule
 * @notice Tracks protocol-side receivables from private reinsurance hooks.
 */
interface IReinsuranceSettlementModule {
    event HookDebtAccrued(
        address indexed hook,
        uint256 backstopAmount,
        uint256 treasuryAmount,
        uint256 totalBackstopOwed,
        uint256 totalTreasuryOwed
    );

    event HookDebtRepaid(
        address indexed hook,
        address indexed payer,
        uint256 backstopAmount,
        uint256 treasuryAmount,
        uint256 remainingBackstopOwed,
        uint256 remainingTreasuryOwed
    );

    event HookCreditorDebtRepaid(
        address indexed hook,
        address indexed payer,
        address indexed creditor,
        uint256 amount,
        uint256 remainingCreditorOwed
    );

    event CreditorReceivableAccrued(
        address indexed hook,
        address indexed creditor,
        uint256 amount,
        uint256 receivableAfter,
        uint64 indexed epoch,
        uint256 epochAccrued
    );

    event CreditorReceivableRepaid(
        address indexed hook,
        address indexed creditor,
        uint256 amount,
        uint256 receivableAfter,
        uint64 indexed epoch,
        uint256 epochRepaid
    );

    event CreditorAccountingSnapshot(
        address indexed creditor,
        uint64 indexed epoch,
        uint256 receivable,
        uint256 totalAccrued,
        uint256 totalRepaid,
        uint256 expectedReceivable,
        uint256 absoluteDrift,
        bool overRepaid,
        bool consistent,
        uint256 epochAccrued,
        uint256 epochRepaid,
        bool epochOverRepaid
    );

    event HookAccountingSnapshot(
        address indexed hook,
        uint64 indexed epoch,
        uint256 currentOwed,
        uint256 totalAccrued,
        uint256 totalRepaid,
        uint256 expectedOwed,
        uint256 absoluteDrift,
        bool overRepaid,
        bool belowCanonical,
        bool consistent,
        uint256 epochAccrued,
        uint256 epochRepaid,
        bool epochOverRepaid
    );

    event MonitoringEpochLengthSet(uint64 previousLength, uint64 newLength);
    event HookDebtLimitSet(address indexed hook, uint256 previousLimit, uint256 newLimit);
    event HookDebtPausedSet(address indexed hook, bool paused);

    function owedToBackstopByHook(address hook) external view returns (uint256);
    function owedToTreasuryByHook(address hook) external view returns (uint256);
    function owedToCreditorByHook(address hook, address creditor) external view returns (uint256);
    function maxHookDebtByHook(address hook) external view returns (uint256);
    function hookDebtPaused(address hook) external view returns (bool);
    function backstopCreditorForHook(address hook) external view returns (address);
    function treasuryCreditorForHook(address hook) external view returns (address);
    function receivableByCreditor(address creditor) external view returns (uint256);
    function totalOwedByHook(address hook) external view returns (uint256);
    function totalOwedToAllCreditorsByHook(address hook) external view returns (uint256);

    function getHookDebt(address hook) external view returns (uint256 backstopOwed, uint256 treasuryOwed, uint256 totalOwed);

    function recordHookDebt(address hook, uint256 backstopAmount, uint256 treasuryAmount) external;
    function recordHookDebtToCreditor(address hook, address creditor, uint256 amount) external;

    function repayHookDebt(address hook, uint256 amount)
        external
        returns (uint256 paidToBackstop, uint256 paidToTreasury, uint256 totalPaid);
    function repayHookDebtToCreditor(address hook, address creditor, uint256 amount) external returns (uint256 paid);

    function monitoringEpochLength() external view returns (uint64);
    function currentMonitoringEpoch() external view returns (uint64);
    function setMonitoringEpochLength(uint64 newLength) external;
    function setHookDebtLimit(address hook, uint256 maxDebt) external;
    function setHookDebtPaused(address hook, bool paused) external;

    function getCreditorAccounting(address creditor)
        external
        view
        returns (
            uint256 receivable,
            uint256 totalAccrued,
            uint256 totalRepaid,
            uint256 expectedReceivable,
            uint256 absoluteDrift,
            bool overRepaid,
            bool consistent
        );

    function getHookAccounting(address hook)
        external
        view
        returns (
            uint256 currentOwed,
            uint256 totalAccrued,
            uint256 totalRepaid,
            uint256 expectedOwed,
            uint256 absoluteDrift,
            bool overRepaid,
            bool belowCanonical,
            bool consistent
        );

    function getCreditorEpochAccounting(address creditor, uint64 epoch)
        external
        view
        returns (
            uint256 accrued,
            uint256 repaid,
            uint256 netAccrued,
            bool overRepaid
        );

    function getHookEpochAccounting(address hook, uint64 epoch)
        external
        view
        returns (
            uint256 accrued,
            uint256 repaid,
            uint256 netAccrued,
            bool overRepaid
        );

    function emitCreditorAccountingSnapshot(address creditor, uint64 epoch)
        external
        returns (
            uint256 expectedReceivable,
            uint256 absoluteDrift,
            bool consistent
        );

    function emitHookAccountingSnapshot(address hook, uint64 epoch)
        external
        returns (
            uint256 expectedOwed,
            uint256 absoluteDrift,
            bool consistent
        );
}

Key Concepts

Hook Debt

When the PayoutManager calls a reinsurance hook's payClaimPortion() and the hook cannot fully pay, the protocol substitutes liquidity from the Backstop Pool and/or Treasury. The RiskManager then calls recordHookDebt() to create a receivable.

Repayment Priority

repayHookDebt() routes funds backstop-first:

  1. Pay down backstop debt until cleared
  2. Remaining amount applied to treasury debt
  3. Caller must have approved the payout asset token

Drift Detection

The module maintains both canonical debt (per-creditor mappings) and aggregate totals. The consistent flag in accounting queries returns false if these diverge, signalling a bookkeeping anomaly for monitoring systems.

Monitoring Epochs

All accruals and repayments are bucketed into epochs (default: 1 day). This enables:

  • Per-epoch accounting queries
  • Snapshot events for off-chain indexing
  • Historical audit trails

Debt Lifecycle