> For the complete documentation index, see [llms.txt](https://docs.delphirhc.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.delphirhc.com/using-delphi/trading.md).

# Trading

Delphi pools are ordinary Uniswap v4 pools, so any v4 router can trade them. The app uses the Delphi router, which does an exact-input swap in one call with a slippage limit and a deadline, and accepts native ETH directly for ETH pairs.

## In the app

Open a token page and use the trade panel. Buying spends the quote asset and receives the token. Selling does the reverse and needs a one-time token approval for the router. The panel shows the estimated output, the price impact and the fee before you confirm, and the estimate is computed from the pool's current liquidity, which is constant inside the launch range.

## From a contract or script

The router exposes one function:

```solidity
function swapExactIn(
    PoolKey calldata key,
    bool zeroForOne,
    uint256 amountIn,
    uint256 minOut,
    address recipient,
    uint256 deadline
) external payable returns (uint256 amountOut);
```

`key` is the pool key, which the hook returns from `pools(poolId)`. `zeroForOne` is true when you are selling `currency0` for `currency1`. For an ETH pair ETH is always `currency0`, so a buy is `zeroForOne = true` and a sell is `zeroForOne = false`, and on a buy you send `amountIn` as the transaction value. `minOut` is the least you will accept and `deadline` is a Unix timestamp after which the call reverts.

## Fees

Each swap pays a fee in the quote asset, taken by the hook rather than by the pool's own fee tier, which is set to zero. It has up to three parts.

The **base fee** is one percent on every trade. Seventy percent of it accrues to the token's creator, who can claim it from the token page at any time, and thirty percent goes to the protocol.

The protocol's share is handled by a buyback contract that anyone can drive. A call to the hook's `sweepProtocol` moves the accrued fees into it, and a call to its `execute` pays half to the team and spends a slice of the other half buying the Delphi token through its own pool, then burns what it bought. It buys at most a tenth of its reserve per call with an hour between calls, and it refuses to pay more than three percent over the token's thirty-minute TWAP, so a pumped pool makes it wait rather than overpay. Neither step needs a key, so the buyback runs as long as someone calls it.

The **creator tax** is an optional extra of up to ten percent that the creator sets at launch and receives in full. Most tokens have none. The fee shown on a token's page is the base fee plus its creator tax.

When a launch chose holder fee sharing, everything that would have gone to the creator goes to a rewards contract instead, and any holder can claim their share from the token page at any time.

The **snipe tax** applies only in the first three seconds after a launch. It starts at ninety-nine percent and falls linearly to zero, goes to the protocol, and is skipped for the creator and any wallets declared at launch. Its purpose is to make buying the launch block worthless for bots, so the opening price belongs to the people who launched the token. Trades through the Delphi router carry the trader's address to the hook, which is how exemptions are recognised; a trade through any other router pays it.

## Liquidity

The launch position is the only liquidity in the pool and it cannot be withdrawn. The hook rejects every add-liquidity and remove-liquidity call, so the depth you see at launch is the depth the pool keeps.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.delphirhc.com/using-delphi/trading.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
