For the complete documentation index, see llms.txt. This page is also available as Markdown.

Trade Agent Tokens

Orbofi agents trade through the standard Uniswap V4 stack. There is no Orbofi-specific router and no custom trading contract — a swap built for any V4 pool works here.

1. Quote

The pool uses a dynamic fee, so the effective rate is not a constant you can hardcode. Always quote:

const [amountOut] = await publicClient.simulateContract({
  address: "0x8dc178efb8111bb0973dd9d722ebeff267c98f94", // V4 Quoter
  abi: V4_QUOTER_ABI,
  functionName: "quoteExactInputSingle",
  args: [{ poolKey, zeroForOne, exactAmount, hookData: "0x" }],
});

quoteExactInputSingle is not a view function — simulate it (eth_call), do not send it.

zeroForOne is true when spending currency0. Because currencies are address-sorted, this flips per pool: for an agent that is currency1, buying is zeroForOne = true; for an agent that is currency0 — common on stock-paired pools — buying is zeroForOne = false. Derive it from tokenIsCurrency0, never hardcode.

Apply your own slippage tolerance to the result. The quoter returns the expected amount, not a guaranteed one.

2. Approve

Which approvals you need depends on what you are spending.

Spending
Approvals needed

Native ETH (ETH-paired pool)

None — but see the WRAP_ETH note below

An ERC-20 numeraire (stock-paired pool)

Both Permit2 legs, on the numeraire

The agent token (any sell)

Both Permit2 legs, on the agent token

Both legs, in order:

3. Execute

Send through the Universal Router at 0x8876789976decbfcbbbe364623c63652db8c0904.

Buying with native ETH — two commands, WRAP_ETH then V4_SWAP, with msg.value set to the input:

SETTLE uses CONTRACT_BALANCE with payerIsUser = false so the pool is paid from the WETH the router just wrapped, rather than pulled from the user.

Buying with an ERC-20 numeraire (stock-paired) — no wrap; the input is pulled from the user through Permit2, so the approvals above are required:

Selling an agent token — same shape as the ERC-20 buy, with the agent token as input and the numeraire taken out. Requires Permit2 approval on the agent token.

Finish with execute(commands, inputs, deadline).

Charts

Price charts for AAC tokens on orbofi.com are rendered with TradingView's Lightweight Charts, fed by candles built from our indexer's trade stream. If you're building your own chart view, the same trade data is available by indexing the pool's swap events (see Index Agent Launches) — and the Fees page explains the two small protocol sells you'll see after every buy, so your candles and trade feed reconcile.

Fees

The swap fee is taken by the pool and is already reflected in the quote, so do not subtract it again when displaying expected output. The rate and its split are in Fees.

Last updated

Was this helpful?