# 2.4 Swap & Routing Engine with Parametric Market-Making

DOR's swap engine has a structure where a parametric AMO (Automated Market Operations) layer is superimposed on a traditional $x \cdot y = k$ AMM.

The goal of this kernel is not strict price discovery, but the assurance of price stabilization and liquidity elasticity.

#### 2.4.1 Swap Pipeline

From the user's perspective, a swap looks like a simple exchange of "Meme Coin ↔ DOR," but internally, it goes through the following pipeline:

1. **Ingress**: Assets from an external wallet flow into the DOR protocol. According to HLP rules, they are distributed proportionally to MOP/SOP/IRP and then incorporated into the MSP of each operation pool.
2. **Routing & Price Locking**: The Route Planner selects the optimal route combining MSP, RP, and external DEXs based on slippage, effective depth, and oracle status. The reference price uses the TWAP-based price at the time of execution completion ($t\_f$), not the snapshot at the time of request.
3. **Parametric Fill**: Based on parameters such as the deviation $\Delta$ between the current market price and reference price, effective pool liquidity, and recent volatility $\sigma$, the spread, contribution fee, and execution band are dynamically adjusted. As $\Delta$ increases, the spread widens, but simultaneously, the protocol is designed to absorb assets in that section, partially automating a "Buy the Dip" mechanism.
4. **Settlement & Logging**: The final execution result is settled in the Execution Layer, and summary data is passed to the Policy & Accounting Layer to be committed as part of the daily on-chain record.

Thanks to this pipeline structure, users see a simple swap interface, but in reality, price, liquidity, and risk are being readjusted in multiple layers.

#### 2.4.2 Downside-Driven Inflow Function

The swap inflow demand assumed by DOR follows a non-linear inverse correlation structure where demand increases as the price drop magnitude increases.

The intuitive closed loop is as follows:

Market Drop → Increased Swap Inflow into DOR → Decreased External Circulation → Buffering of Additional Downward Pressure

Through this, DOR naturally operates as a liquidity "sponge" during market correction phases, working in a direction where more assets are absorbed into the protocol as prices plunge.

At the same time, a saturation parameter $\lambda$ is set to place an upper limit so that the inflow scale does not explode to a level that shakes the entire system.

Because of this Downside-Driven Inflow kernel and parametric AMO structure, DOR's AMM has the character of a self-stabilizing stabilizer compared to classical constant product AMMs.

It is a form that embeds a counter-correlated buffering device attempting to offset overheating/oversold sections of the meme market, rather than a unidirectional response to price signals and liquidity allocation.

<br>


---

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

```
GET https://tripleplus-1.gitbook.io/dor/dor-whitepaper-english/2.-technical-architecture/2.4-swap-and-routing-engine-with-parametric-market-making.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.
