# Auto-exchange mechanism

When one of the auto-excange conditions is breached, the system will forcefully convert other tokens into T by relying in external ‘auto-exchangers’ who receive a discount over market price as incentive. The amounts available will take into account both the amounts in the T-bubble, as well as those that can be moved from other bubbles.

The amount of collateral $$m$$ of token $$S$$ the auto-exchanger receives in exchange is computed as

$$
(1-\mathrm{discount}*{S/T})X*{S/T}\times m=n
$$

where both $$\mathrm{discount}*{S/T}$$ and $$X*{S/T}$$ will generally be a compound term, computed as products/quotients of the official pool discounts and exchange rates (one needs to trace the S→T path on the directed graph).

The following diagram illustrates the general flow.

<figure><img src="/files/NgYb76LyNtiI7EHJUlCa" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: 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:

```
GET https://docs.reya.xyz/trading/cross-collateralization/auto-exchange-mechanism.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
