OnchainBook contract per series family on Base.
Market makers quote curves on the contract, and you trade against them in one transaction that fills
and settles atomically. There is no API call, no signed order to submit and no matcher in between.
The venue’s off-chain matcher still accepts signed futures orders (
POST /orders), but no market
maker quotes there. An order you post there rests until someone else crosses it. To trade now, take
from the onchain book.The books
Both books trade in lots of 0.001 contract (
lotSize 1e15). Read the live parameters with
markets(marketId) on the book: the future, the MarginEngine, the sub id, the expiry, the last trade
time, the tick and lot size, the taker fee rate (18 decimals) and whether the market is enabled.
The contracts you also need, all on Base:
How a take works
Each maker posts a curve around its mid: sizes at price levels above it (asks) and below it (bids). A take walks the best levels across every maker on the market until your amount is filled, your limit price is reached, ormaxLevels levels are used. Each fill moves the position to your account
and the opposite position to the maker’s, at the level’s price. The fee is charged in USDC from your
account’s cash.
A take is described by a TakeOrder:
take(order, optionalReport) returns the size filled and the average price. Pass 0x as
optionalReport.
The fee
The fee is the taker fee rate × notional. On onecNGN-30NOV26 contract (1,000,000 cNGN) at
0.00069 USDC per cNGN, the notional is 690 USDC and the 15 bps fee is 1.035 USDC. Set maxFee from
your limit price, so the bound holds at any fill inside it:
contract_multiplier on GET /markets:
1,000,000 cNGN on cNGN-30NOV26, 1,000 EURC on EURC-30NOV26. Makers pay no fee.
Set up your account
You need a trading account that your wallet owns, under the MarginEngine. An account opened throughPOST /deposits is held by the venue’s Matching contract
for the off-chain matcher, so it cannot take from the book. Open your own instead. Each step is one
transaction from your wallet, and the first three are needed only once.
1
Open the account
SubAccounts.createAccount(owner, manager) with your address and the MarginEngine. It returns the
account id.2
Deposit USDC
Approve the USDC cash asset for the amount, then call
CashAsset.deposit(accountId, amount).
The amount is in USDC’s 6 decimals: 1000000000 is 1,000 USDC.3
Let the book move your assets
SubAccounts.setAssetAllowances(accountId, book, allowances), with an allowance on the future and
one on the cash, each (asset, positive, negative). The book can then move your position and fees
in the takes you send. Grant it per book.cNGN-30NOV26, 6% on EURC-30NOV26. See Margin.
Quote, then take
quote(order) is a free view that runs the same walk as take and returns the size it would fill,
the average price, the fee and how many makers it would settle with. Call it with your account id to
check your allowances too, or with takerAccountId 0 for a price only.
isBuy: false and limitPrice to the lowest price you accept. To close a position,
take the opposite side for its size.
Why a take reverts
A take that would leave your account below initial margin is refused by the MarginEngine.
Use the router instead
The router does a deposit, a take and a withdrawal in one call on your own account. It holds nothing between calls. Set it up once:SubAccounts.setApprovalForAll(router, true), so the router can take and withdraw for you.- The book’s allowance on your account, as above.
- USDC approved to the router, for deposits.
route(r):
Positions, withdrawals and settlement
- Your position is your account’s balance of the future at the series’ sub id:
SubAccounts.getBalance(accountId, future, subId), in position units (1e18 a contract, negative when short).getAccountBalances(accountId)lists everything the account holds. - Variation margin settles to your account’s USDC cash as the mark moves, as for any futures position. See Variation margin.
- Withdraw with
CashAsset.withdraw(accountId, amount, recipient)from the owner, in USDC’s 6 decimals. The MarginEngine refuses a withdrawal that would leave the account below initial margin. - At expiry the series settles in cash. See Settlement.
- On the tape, fills on the book appear on
GET /tradesfor the series withsource: "book".

