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

Trade Tokens

The trade-tokens skill lets an AI agent buy or sell fractionalized domain tokens across every venue Doma supports: bonding-curve launchpad, post-graduation Uniswap V3, and sellOnFail for failed launches. The skill auto-routes based on the token's on-chain state.

At a glance

Manifest URL

https://doma.xyz/.well-known/skills/trade-tokens/SKILL.md

Backing CLI

@doma-protocol/cli (doma swap …, doma token …, doma quote …)

Wallet modes

agent (Privy) and private-key

Trigger phrases

buy tokens, sell tokens, swap tokens, trade fractional, purchase fractional, bonding curve, sellOnFail, graduated, Uniswap, post-graduation, failed launch

What it does

doma swap already auto-detects the right venue. The skill wraps it with a discover → preview → confirm → execute flow:

  1. Read the token's on-chain status and tradingVenue via doma token --quiet --format json.

  2. Pick the correct venue (Launchpad / Uniswap / sellOnFail) based on the state matrix below.

  3. Fetch a quote (doma quote) and surface amount-out, price impact, and gas to the user.

  4. Confirm before executing.

  5. Execute (doma swap --yes) and report the on-chain result.

State × action matrix

Trade-tokens routing state machine. FRACTIONALIZED with fillPercent under 100% trades on the Launchpad bonding curve (buy and sell). When fillPercent reaches 100%, the token enters FRACTIONALIZED at 100% and trades pause pending graduation. Graduation either succeeds (transition to GRADUATION_SUCCESSFUL on Uniswap V3) or fails (transition to GRADUATION_FAILED with sellOnFail fixed-rate refunds only). After redemption, GRADUATION_SUCCESSFUL transitions to BOUGHT_OUT, a terminal state with no further trades.

This is the routing logic the skill encodes. Always check status first. A BOUGHT_OUT token can have graduatedAt set, which would otherwise mislead the agent.

status

tradingVenue

fillPercent

Buy

Sell

BOUGHT_OUT

any

n/a

refuse, already redeemed

refuse, already redeemed

FRACTIONALIZED

Launchpad

< 100%

bonding-curve buy

bonding-curve sell

FRACTIONALIZED

Launchpad

= 100%

refuse, graduation pending

refuse, graduation pending

GRADUATION_FAILED

Launchpad

n/a

refuse, launch failed

sellOnFail (fixed-rate refund)

GRADUATION_SUCCESSFUL

UniswapV3

n/a

Uniswap V3 buy

Uniswap V3 sell

Prerequisites

  • Node.js ≥ 20

  • @doma-protocol/cli0.4.0 for read-only commands; ≥ 0.5.0 for agent mode

  • A configured wallet (see Wallet Modes)

  • Sufficient input-token balance plus gas

Example prompt

After installing the skill (see Discover & Use Skills):

"Buy 10 USDC worth of <token-name> token on Doma testnet."

(Mainnet works the same way: drop testnet from the prompt and the skill targets Doma Mainnet via your CLI config.)

The agent walks through:

  1. Network selection (testnet, since the prompt asked for it).

  2. State read (doma token <token-name> --testnet --quiet --format json) → for example status: GRADUATION_SUCCESSFUL, tradingVenue: UniswapV3.

  3. Quote (doma quote USDC <token-name> 10) → expected amount-out, ~0.31% price impact, ~$0.16 gas, 0.5% slippage default.

  4. Confirmation prompt with all numbers.

  5. Execution (doma swap USDC <token-name> 10 --yes --quiet --slippage 50).

  6. Report Status: Success, tx hash, block, gas used, and final received amount.

Cross-references

Last updated