# DEX methods

### Investing

Any user could invest their own liquidity to contract and receive Liquidity Pool Token (LPT). LPT allows earning interest from [#swapping](#swapping "mention")and imbalanced invests/divests.&#x20;

#### Balanced invest

If user performs investment in corresponding ratios (example from [Standalone DEX](/smart-contracts/quipuswap-stable-swap-dex/standalone-dex.md#examples-hint) \[4 `TBC`; 2 `TXZ`; 1 `TEH`] is balanced input), it is expected to no additional fees are charged.

#### Imbalanced invest

If there is any LPT already exists, and invest is imbalanced (example from [Standalone DEX](/smart-contracts/quipuswap-stable-swap-dex/standalone-dex.md#examples-hint) \[1 `TBC`; 2 `TXZ`; 1 `TEH`] and \[1 `TXZ`] and \[8 `TXZ`; 4 `TEH`] is all imbalanced inputs) the additional fee charged for balancing pool reserves.

More info about invest entrypoint written out on the corresponding page.

{% content-ref url="/pages/9Js3mqY7emh7MMIEJ6Z5" %}
[invest](/smart-contracts/quipuswap-stable-swap-dex/standalone-dex/dex-methods/invest.md)
{% endcontent-ref %}

### Swapping&#x20;

The main idea of DEX is to swap between different liquidity entries. This contract used swap math, which tried to keep math calculations as close as possible to [Curve](https://curve.fi/) math. Each swap has a 0.05% fee that goes to liquidity providers (this part of the reward stays in liquidity pool), QUIPU pool stakers (if no one had staked yet, this part of the fee goes to liquidity providers), referral (if not provided goes to default referral address), and to the developer.

{% content-ref url="/pages/zT4uusC5vZtL4YUhhY5z" %}
[swap](/smart-contracts/quipuswap-stable-swap-dex/standalone-dex/dex-methods/swap.md)
{% endcontent-ref %}

### Divesting

The liquidity provider could take back his liquidity by performing divest operation. The provider could choose a more convenient divest method from 3 variants: balanced/imbalanced/in one coin. Info about the difference of variants described at Divesting page.

{% content-ref url="/pages/Og2NdUIEy4FqE5Ku9xMy" %}
[Divesting](/smart-contracts/quipuswap-stable-swap-dex/standalone-dex/dex-methods/divesting.md)
{% endcontent-ref %}

### Additional interest

Participators of  DEX pools are allowed to earn additional rewards as referrals or by staking QUIPU tokens. For more information about earning rewards in this way, follow the page under this text.

{% content-ref url="/pages/U8C6aXrITct5gHCRWMsA" %}
[DEX rewards](/smart-contracts/quipuswap-stable-swap-dex/standalone-dex/dex-methods/dex-rewards.md)
{% endcontent-ref %}


---

# 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.quipuswap.com/smart-contracts/quipuswap-stable-swap-dex/standalone-dex/dex-methods.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.
