tplus.utils.domain module.
What settlement means on T+
On T+, your exchange balance tracks your assets internally. Settlement is how those internal balances translate into on-chain token holdings: you specify a token you are giving up (tokenIn) and a token you expect to receive (tokenOut), along with the exact amounts. The T+ settlement contract verifies the signed order against your on-chain nonce and executes the transfer atomically.
Settle via the CLI
The CLItplus settle command handles both steps: init (sign + submit to OMS) and execute (submit on-chain once approved). Settlement init goes through the OMS (--orderbook-base-url), which returns the approval synchronously.
Initialize a settlement
settle init signs your settlement request and submits it to the OMS, returning the exchange’s approval:
Initialize and execute in one step
settle execute runs init and then submits the on-chain transaction once approved:
| Flag | Description |
|---|---|
--network | Ape network specifier, e.g. arbitrum:mainnet:alchemy |
--account | Your Ape account alias for signing the on-chain transaction |
--asset-in | 32-byte hex identifier of the token you are giving |
--amount-in | Integer amount of asset-in in its native token units |
--amount-in-decimals | Decimal precision of asset-in (e.g. 18 for ETH-like tokens) |
--asset-out | 32-byte hex identifier of the token you are receiving |
--amount-out | Integer amount of asset-out in its native token units |
--amount-out-decimals | Decimal precision of asset-out (e.g. 6 for USDC) |
--settler-executor <addr> | Use when the registered settler is a contract, not an EOA |
Settle in Python
For programmatic settlement, construct anOrder object from tplus.utils.domain, sign it with your Ape account, and use the signature in your settlement submission.
Understanding the Order fields
| Field | Type | Description |
|---|---|---|
tokenOut | str (hex address) | The token address you will receive on-chain |
amountOut | int | Amount of tokenOut in its native decimals |
tokenIn | str (hex address) | The token address you are giving up |
amountIn | int | Amount of tokenIn in its native decimals |
userId | bytes | Your T+ public key (from UserManager.load(...).public_key) |
nonce | int | The settlement nonce from vault.getDepositNonce(your_account) |
validUntil | int | Unix timestamp after which the order is rejected |
Running settlement in an Ape console
You can prototype settlement interactively in an Ape console connected to the target network:vault and registry contract objects are already available (injected by ape_console_extras.py), so you can call vault methods directly:
EVM Contracts Reference
API reference for vault, registry, and other on-chain contract wrappers.
CLI Deposits & Withdrawals
CLI reference for deposit, withdrawal, and settlement subcommands.