CanonicCanonic Docs
Documentation

Makers (MAOB API)

Overview

Makers provide liquidity to MAOB by placing orders on discrete rungs around the oracle midpoint.

From MAOB.sol, maker entrypoints are:

  • addLiquidityAsk(rung, baseAmount)
  • addLiquidityBid(rung, quoteAmount)
  • addLiquidityBatch(liquidityOrders)
  • claimOrders(orderIds[, withdrawAfter])
  • claimAndRequote(orderIds, liquidityOrders)
  • cancelOrder(orderId, withdrawAfter)
  • withdraw()

Posting liquidity

Ask liquidity (sell base tokens)

Use addLiquidityAsk(uint16 rung, uint256 baseAmount) to post base tokens into an ask rung.

  • Input token: base tokens
  • Output token: quote tokens (earned when takers buy base tokens)

Checks to be aware of:

  • Maker actions must not be paused (makerPaused == false)
  • rung must be in range
  • baseAmount must be non-zero
  • MAOB enforces a minimum quote token value check via minQuoteMaker

Bid liquidity (buy base tokens)

Use addLiquidityBid(uint16 rung, uint256 quoteAmount) to post quote tokens into a bid rung.

  • Input token: quote tokens
  • Output token: base tokens (earned when takers sell base tokens)

Checks:

  • Maker actions must not be paused
  • quoteAmount must be non-zero
  • minQuoteMaker applies directly to quote token input

Batch placement

Use addLiquidityBatch(LiquidityOrder[]) to place multiple rung orders in one transaction.

This lets you distribute liquidity across rungs efficiently (and pay approvals/transfer once per token side).

Claiming fills

Maker orders do not automatically transfer output tokens as fills happen. Instead, MAOB accumulates fills and makers claim later:

  • claimOrders(orderIds) claims into MAOB withdrawableBase/withdrawableQuote balances.
  • claimOrders(orderIds, true) also withdraws immediately.

To inspect expected results before claiming:

  • previewOrder(orderId) returns (unfilledInput, claimableOutput).

Requoting

Makers can reuse already-withdrawable balances to place new rung liquidity:

  • requoteFromWithdrawable(liquidityOrders) uses your current withdrawable* balances.
  • claimAndRequote(orderIds, liquidityOrders) claims then immediately requotes in one flow.

Cancelling

To cancel a still-active order:

  • cancelOrder(orderId, withdrawAfter)

Cancellation returns remaining unfilled input back to withdrawable balances (plus any unclaimed fill output is left claimable as part of the order’s accounting).

Withdrawing

Finally, withdraw your accumulated withdrawable balances:

  • withdraw()

This transfers your withdrawableBase[msg.sender] and withdrawableQuote[msg.sender] balances (base tokens and quote tokens) to your wallet if non-zero.