Overview
The CLP vault is designed to be operated. The operator decides how to deploy pooled liquidity onto MAOB rungs, claim fills, and manage cancellations to maintain liquidity.
In CLP.sol, these actions are gated by OPERATOR_ROLE (and some emergency paths allow DEFAULT_ADMIN_ROLE as well).
Placing orders
placeOrders(withdrawOrders, balanceOrders)
This is the primary operator entrypoint. It places two categories of MAOB liquidity orders:
withdrawOrders: orders funded from MAOB withdrawable balances (placed viamaob.requoteFromWithdrawable)balanceOrders: orders funded directly from CLP’s wallet balances (placed viamaob.addLiquidityBatch)
Operational constraints:
- CLP maintains an
activeOrderIdslist with a maximum lengthMAX_ACTIVE_ORDERS. - Before adding new orders, CLP prunes non-active tracked orders.
- If the placement would exceed
MAX_ACTIVE_ORDERS, it reverts withCLP__TooManyOrders().
The call emits TopUp(baseUsed, quoteUsed, orderCount) for accounting/monitoring.
Claiming fills
As fills happen, CLP must claim outputs from MAOB into the vault:
claimOrders(orderIds)claims a chosen set of MAOB orders.claimActiveOrders(startIndex, batchSize)claims a slice of the tracked active list.
After claiming, CLP prunes inactive orders from its tracked list.
Cancelling orders
Operators may cancel orders to free liquidity:
cancelOrders(orderIds, withdrawAfter)
This function:
- claims the given orders (so fills aren’t lost)
- cancels any of those orders that remain active
- optionally calls
maob.withdraw()to pull refunds back to CLP - prunes the tracked order list
Emergency exit
exitAndWithdrawAll()
Callable by either OPERATOR_ROLE or DEFAULT_ADMIN_ROLE.
This is intended as an emergency or shutdown flow:
- claim all tracked orders
- cancel all active tracked orders
- withdraw any MAOB withdrawable balances to CLP
- close deposits (
depositsOpen = false)
This emits ExitInitiated(caller) and closes deposits to prevent new LP capital entering during an exit.
Operator responsibilities (practical guidance)
- Maintain a rung strategy (how liquidity is distributed across rungs) based on desired spread and inventory.
- Monitor MAOB oracle health (staleness and range) because it directly affects fill behavior.
- Keep enough “free” balances for expected withdrawals; otherwise withdrawals may trigger cancellations and revert under extreme conditions.