Skip to main content
The orderbook instructions module enables vault managers and allocators to trade PT (Principal Tokens) and YT (Yield Tokens) on Exponent Orderbook. All interactions are executed as Squads sync transactions validated against onchain policies.

Transaction Structure

Every orderbook interaction goes through createVaultSyncTransaction, which returns three parts:

Trade Directions

The OrderbookTradeDirection enum specifies the side of the trade:

Post Offer

orderbookAction.postOffer posts a limit order on the orderbook at a specified APY price.

Parameters

A matching policy must exist before executing. See Policy Builders.

Market Offer

orderbookAction.marketOffer executes a market order against existing resting offers on the orderbook.

Parameters

A matching policy must exist before executing. See Policy Builders.

Remove Offer

orderbookAction.removeOffer cancels an existing limit order on the orderbook.

Parameters

A matching policy must exist before executing. See Policy Builders.

Withdraw Funds

orderbookAction.withdrawFunds withdraws settled funds from the user escrow on the orderbook back to the vault’s token accounts.

Parameters

A matching policy must exist before executing. See Policy Builders.

Full Flow Example

This example demonstrates a complete orderbook interaction: post a limit buy for PT, then cancel it and withdraw any settled funds.

Step 1: Post a Limit Buy PT Order

Step 2: Cancel the Order

Step 3: Withdraw All Settled Funds