> For the complete documentation index, see [llms.txt](https://docs.reya.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.reya.xyz/trading/cross-collateralization/auto-exchange-mechanism.md).

# 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>
