> For the complete documentation index, see [llms.txt](https://layer-akira.gitbook.io/layerakira-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://layer-akira.gitbook.io/layerakira-documentation/integration/technical-overview/exchange-flow.md).

# Exchange flow

Our order book design is comprised of two parts:

**1) LayerAkira Smart Contract ("Smart Contract"):**

* The Smart Contract holds the user funds and performs necessary validation checks before any trading activity is executed, whether initiated by a user or by the Exchange on behalf of a user.
* Allows users to perform certain activities (e.g. withdrawals) on-chain without direct interaction with the Exchange
* Emits events to the blockchain for each trading activity.

**2) LayerAkira Exchange ("Exchange"):**

* Provides [endpoints](/layerakira-documentation/integration/endpoints.md) through which users can perform trading activities in a CEX-like manner
* Ensures that all trading activities are processed fairly and are valid.&#x20;

{% hint style="info" %}
fair" refers to *when* the trade arrives to the Exchange

"valid" refers to the execution semantic
{% endhint %}

* Responsible for consuming emitted events by the Smart Contract to maintain a valid state of off-chain order book and off-chain user balances.
* Responsible for batching all trading activities into the rollup and pushing it on-chain as soon as possible to keep the smart contract state updated with the off-chain state.&#x20;
* Responsible for maintaining the CLOB and providing access to it through [endpoints](/layerakira-documentation/integration/endpoints.md) for both users from our ecosystem and outside of our ecosystem through Routers.

<figure><img src="/files/68aeZpVJNCoStjjE06ut" alt=""><figcaption></figcaption></figure>
