> For the complete documentation index, see [llms.txt](https://docs.deso.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.deso.org/focus/next-generation-token-mechanics/how-the-order-book-amms-work.md).

# How the Order-Book AMMs Work

After your token is launched, it is automatically initialized with an AMM according to the following steps (according to your configuration when setting up your token). Note that you don't need to know much about these steps in order to launch a token because they will happen automatically with sane defaults if you just click through the token launch flow.

1. **Pre-Sale Auction.** Before your token's AMM starts up, there is a period where people can place bids on your token before all the sell orders have gone live. All of the tokens that are about to have their amms go live can be seen on the Launchpad page on the [Focus Trade Page](https://focus.xyz/trade).
2. **Placing Initial Orders.** Once your auction period is over, your AMM places its sell orders on the book, and hits whatever bids are currently there. This has the end result of executing an auction on your market to distribute the initial supply of your coin. Why do we do it like this? Well, first of all, it's extremely fun to participate in auctions like this (trust me, just try it). But, much more importantly, if this auction period didn't exist, then bots could "snipe" the beginning of your amm the minute the sell orders came on the book. This would give them cheap coins that they could then dump on everybody for a quick buck. It was a problem with BitClout, and it remains a problem with pump.fun.
3. **When a Sell Order is Hit.** When an AMM's sell order is hit it flips to a buy order using the funds that went into filling it. For example, if your AMM had an order to sell 1,000 for $0.001 and it got hit, then it would then place a bid order for very slightly less than $0.001 to buy 1,000 tokens. This behavior mimics a bonding curve, but the fact that the AMM runs on an order-book means third-party liquidity providers can also submit bids and asks alongside, or in between, the AMM's orders.
4. **When a Buy Order is Hit.** When an AMM buy order is hit, the reverse happens as a sell order. Again, the AMM simply mimics a bonding curve, but on an order-book where third-party liquidity providers can participate.

What happens to profits earned by the AMM during the pre-sale auction or via spreads collected from flipping orders? And what happens if the market moves far beyond the AMM's bids, making its liquidity no longer needed (and thus extractable). This has not been decided yet, but it has been discussed by @nader [here](https://focus.xyz/post/4fdd462c79f24248f1b4c81af2ca1bb4c85e1425ab6e5e15e10e3798a02d2d0c). It can either be used to buy & burn $FOCUS, distributed to the creator, or used to buy & burn the creator's token.


---

# 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.deso.org/focus/next-generation-token-mechanics/how-the-order-book-amms-work.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.
