Skip to main content

ITenorRouter

Git Source - Generated with forge doc

Title: ITenorRouter

Interface of the router executing Midnight take batches with per-batch fill, price and crossing protections.

Functions

execute

Executes a batch of direct midnight.take actions, accumulating buyer/seller/units totals and enforcing per-batch fill bounds and price slippage. The initiator is the Midnight taker for every action.

All actions must share actions[0]'s market (offer.market).

All actions must share actions[0]'s side (_initiatorIsBuyer(action, initiator)).

fillAxis == ASSETS resolves to the batch side; slippage uses the same axis.

function execute(ExecuteParams calldata params, Action[] calldata actions)
external
returns (uint256 buyerAssets, uint256 sellerAssets, uint256 units);

Returns

NameTypeDescription
buyerAssetsuint256The total buyer-side asset flow (post-fee).
sellerAssetsuint256The total seller-side asset flow (post-fee).
unitsuint256The total market units filled.

Events

BatchExecuted

event BatchExecuted(
address indexed initiator,
address indexed msgSender,
ExecuteParams params,
uint256 actionsCount,
uint256 buyerAssets,
uint256 sellerAssets,
uint256 units
);

ActionReverted

event ActionReverted(uint256 indexed index, bytes reason);

Errors

InsufficientFill

error InsufficientFill(uint256 filled, uint256 minFill);

PriceSlippageExceeded

error PriceSlippageExceeded(uint256 price, uint256 min, uint256 max);

ActionFailed

error ActionFailed(uint256 index, bytes reason);

DeadlineExpired

error DeadlineExpired(uint256 deadline, uint256 timestamp);

FillOvershoot

error FillOvershoot(uint256 filled, uint256 maxFill);

InconsistentSide

Action i's _initiatorIsBuyer result differs from actions[0]'s. The bool arg is the expected batch side (!offer.buy, since the initiator is always the taker).

error InconsistentSide(uint256 index, bool batchIsBuyerSide);

InconsistentMarket

error InconsistentMarket(uint256 index);

EmptyActions

error EmptyActions();

ReduceOnlyViolated

error ReduceOnlyViolated(uint256 wrongSideBefore, uint256 wrongSideAfter);