> For the complete documentation index, see [llms.txt](https://docs.orriss.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.orriss.xyz/bin-pricing.md). Agents can also search and read this documentation through its [MCP server](https://docs.orriss.xyz/~gitbook/mcp).

# Bin pricing

How a moving price reference changes the execution midpoint in each of 20 bins.

An Orriss pool has 20 bins. Each bin holds its own inventory and quotes one execution price at a fixed percentage offset from a shared reference. A reference update changes the prices at which that inventory can trade. Token balances, share counts and the active bin index stay where the last deposit, withdrawal or swap left them.

## From reference to execution price

Number the bins from 0 to 19. The on-chain reference `R` is the number of quote-token atoms per whole SOL. For SOL/USDC, one USDC contains one million atoms, so 100 USDC/SOL is encoded as `R = 100,000,000`.

Bin `i` spans offsets from `(i − 10)%` to `(i − 9)%`. The program executes at its midpoint, rounded down to a whole quote atom per SOL.

`pᵢ = floor(R × (181 + 2i) / 200)`

| Bin | Offset interval | Midpoint offset | Price when SOL is 100 USDC |
| --- | --------------- | --------------- | -------------------------- |
| 0   | −10% to −9%     | −9.5%           | 90.50 USDC/SOL             |
| 9   | −1% to 0%       | −0.5%           | 99.50 USDC/SOL             |
| 10  | 0% to +1%       | +0.5%           | 100.50 USDC/SOL            |
| 19  | +9% to +10%     | +9.5%           | 109.50 USDC/SOL            |

The reference sits on the boundary between bins 9 and 10. An order executes at the same midpoint for as long as it draws inventory from the same bin within a swap. Larger orders can reach another price when they consume the available output in a bin.

<figure><img src="https://2901705416-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fwgb6N4AUimhmgBryw2j4%2Fuploads%2FpTpsuO8IJOopTHgCQC3n%2Frelative-grid.png?alt=media" alt="All 20 execution midpoints increase when the reference rises from 100 to 105 USDC per SOL. Bin 10 moves from 100.5 to 105.525."><figcaption><p>Execution prices for all 20 bins as the SOL reference rises from 100 to 105 USDC. Bin 10 moves from 100.500 to 105.525 USDC per SOL.</p></figcaption></figure>

The figure uses two illustrative references. A 5% rise in the reference takes bin 10 from 100.500 to 105.525 USDC/SOL. An LP holding shares in that bin still owns the same fraction of its inventory immediately after the update. See [Reference price](https://docs.orriss.xyz/bin-pricing/reference-price.md).

## Which bin fills first?

The pool records an **active bin**, initially index 10. A swap starts its search there. A buy of SOL scans upward for SOL to deliver. A sale of SOL scans downward for quote tokens to deliver. Both directions include the active bin and skip bins without usable output. A successful swap records its last filled bin as the new active bin.

For example, suppose a buy consumes all the SOL in bin 10 and finishes in bin 11. Bin 11 now holds some of the buyer's USDC. The next seller of SOL starts at bin 11 and can receive that USDC there. The pool only moves on to bin 10 if the sell order needs more usable output. Its starting point depends on trade history.

On deposit, bins 0–9 accept the quote token and bins 10–19 accept wrapped SOL. After fills, a bin can hold both assets, or only the asset received from traders. Selecting a bin determines where capital participates and which fills can earn fees. See [Swap execution](https://docs.orriss.xyz/bin-pricing/swap-math.md) and [LP shares and fees](https://docs.orriss.xyz/bin-pricing/lp-accounting.md).


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.orriss.xyz/bin-pricing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
