Quantillon Protocol

ReportPublicationBatcher

Git Source

Inherits: IVersioned

Title: ReportPublicationBatcher

Publishes any combination of market price, depth and reconciled capacity.

Fixed destinations and selectors. Reports fail independently; target events determine accepted data, since a successful price call can skip a source.

Notes:

  • security: Only the immutable writer can publish. Each subcall has a fixed gas budget, reserved before execution so estimation cannot starve later reports.

  • security-contact: team@quantillon.money

Constants

writer

Authorized publisher account.

address public immutable writer

priceStore

Market summary storage.

address public immutable priceStore

depthStore

Execution depth and hedge capacity storage.

address public immutable depthStore

PRICE_GAS

Upper gas allocation for at most two market sources.

uint256 public constant PRICE_GAS = 200_000

DEPTH_GAS

Allocation covers the publisher's ten levels per side, including cold storage.

uint256 public constant DEPTH_GAS = 1_100_000

CAPACITY_GAS

Upper gas allocation for a capacity acknowledgment.

uint256 public constant CAPACITY_GAS = 150_000

PRICE_SELECTOR

bytes4 private constant PRICE_SELECTOR =
    bytes4(keccak256("updateSlippageBatch((uint8,uint128,uint128,uint16,uint16,uint16[5])[])"))

DEPTH_SELECTOR

bytes4 private constant DEPTH_SELECTOR =
    bytes4(keccak256("publish(uint256,(uint128,uint128)[],(uint128,uint128)[])"))

CAPACITY_SELECTOR

bytes4 private constant CAPACITY_SELECTOR = bytes4(keccak256("acknowledge(uint256,uint256,uint256,uint256)"))

State Variables

lastPublicationAt

Block time of the last batch with a successful destination call.

uint256 public lastPublicationAt

Functions

constructor

Set permanent publisher and target addresses.

Note: security: No role grants or arbitrary targets are exposed.

constructor(address publisher, address price, address depth) ;

Parameters

NameTypeDescription
publisheraddressPublisher account, distinct from both destinations.
priceaddressDeployed price storage.
depthaddressDeployed execution pricing contract.

publishReports

Submit one, two or three independently validated reports.

Price then depth then capacity preserves the existing combined-publication order. Capacity never resets consumed depth; a later fresh book applies the target's rules.

Note: security: Rejects invalid selectors before any effects. Reverting reports do not undo valid reports. All-failed batches revert so preflight estimation rejects them.

function publishReports(bytes calldata priceCall, bytes calldata depthCall, bytes calldata capacityCall)
    external
    returns (uint8 succeeded);

Parameters

NameTypeDescription
priceCallbytesEncoded updateSlippageBatch, or empty to omit.
depthCallbytesEncoded publish, or empty to omit.
capacityCallbytesEncoded acknowledge, or empty to omit.

Returns

NameTypeDescription
succeededuint8Destination-call success mask; inspect target events for accepted reports.

_selector

function _selector(bytes calldata data, bytes4 expected) private pure;

_call

function _call(address target, bytes calldata data, uint256 budget, uint8 report) private returns (bool ok);

version

Semantic version of this separately deployed, non-upgradeable contract.

function version() external pure override returns (string memory);

Events

ReportsPublished

Masks use price=1, depth=2, capacity=4. Success denotes call success, not source acceptance.

event ReportsPublished(uint8 attempted, uint8 succeeded);

ReportRejected

First four revert bytes for a failed report; no unbounded return data is copied.

event ReportRejected(uint8 indexed report, bytes4 reason);

Errors

InsufficientReportGas

error InsufficientReportGas();

NoSuccessfulReports

error NoSuccessfulReports();