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.
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:
Wait for the Permit2 approval to be observable before sending the swap. If you build the swap immediately after the approval transaction, gas estimation can run against a node that has not yet applied it, and the swap reverts with a confusing error. Poll permit2.allowance(owner, token, router) until it reflects the approval, then send.
3. Execute
Send through the Universal Router at 0x8876789976decbfcbbbe364623c63652db8c0904.
Native ETH is not a pool currency. Every ETH-quoted Orbofi pool is denominated in WETH (0x0bd7D308…Ad73), not address(0). A buy funded with native ETH must wrap first, in the same call — omit that and the swap reverts, or silently requires the user to already hold WETH.
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.
Both the swap fee and the anti-snipe window are per-pool configuration, not global constants. Read the real rate from a quote rather than assuming; in the first ten seconds of a pool's life it is dramatically higher. See Fees and Liquidity layer.
Last updated
Was this helpful?

