TenorRouterAdapterBase
Git Source - Generated with forge doc
Inherits: TenorRouter, CoreAdapter, ITenorRouterAdapter
Title: TenorRouterAdapterBase
Bundler3 adapter for TenorRouter batch execution.
_initiator returns Bundler3.initiator(): the bundle initiator is the Midnight taker.
Functions
_initiator
function _initiator() internal view override returns (address);
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.
Adapter override: callable only by Bundler3, and resolves type(uint256).max maxFill/minFill
sentinels against onchain state before executing.
function execute(ExecuteParams calldata params, Action[] calldata actions)
external
override(TenorRouter, ITenorRouter)
onlyBundler3
returns (uint256, uint256, uint256);
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | buyerAssets The total buyer-side asset flow (post-fee). |
<none> | uint256 | sellerAssets The total seller-side asset flow (post-fee). |
<none> | uint256 | units The total market units filled. |
executeAndConsume
Executes a batch then increments the caller's consumed counter for consumeGroup
by the filled amount in the params.fillAxis dimension; enables mixed-execution
limit orders in one tx.
consumeGroup is the caller's self-limit group, independent of each offer's own group.
Midnight's auth on setConsumed enforces that the caller has authorized this adapter to
write into their namespace.
function executeAndConsume(
ExecuteParams calldata params,
Action[] calldata actions,
bytes32 consumeGroup,
uint128 maxConsumed
) external override onlyBundler3 returns (uint256, uint256, uint256);
Parameters
| Name | Type | Description |
|---|---|---|
params | ExecuteParams | Batch execution parameters (fill index, max/min fill, deadline, slippage). |
actions | Action[] | Per-action payloads (MidnightTakeData). |
consumeGroup | bytes32 | Caller's self-limit group to increment. |
maxConsumed | uint128 | Final cap on consumed[initiator][consumeGroup] after the write; type(uint128).max disables. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | buyerAssets Total buyer-side asset flow across the batch (post-fee). |
<none> | uint256 | sellerAssets Total seller-side asset flow across the batch (post-fee). |
<none> | uint256 | units Total market units filled across the batch. |
_executeResolvingSentinels
function _executeResolvingSentinels(ExecuteParams calldata params, Action[] calldata actions)
internal
returns (uint256[3] memory totals, uint256[3] memory rawTotals);
_resolveSentinel
FILL_UNITS resolves to the initiator's debt (buyer-side) or credit (seller-side); side-aware so the
resolved cap matches the position the batch would close. Sentinels are resolved once at batch start; state
changes occurring mid-execution are not accounted for.
FILL_BUYER_ASSETS resolves to loanToken.balanceOf(adapter).
FILL_SELLER_ASSETS is unsupported; it would cap borrower output by the adapter loan balance.
function _resolveSentinel(uint8 fillIndex, address initiator, Action[] calldata actions)
internal
view
returns (uint256);