> For the complete documentation index, see [llms.txt](https://funarchy.gitbook.io/funarchy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://funarchy.gitbook.io/funarchy/security-for-prediction-market/trading-mechanism/amm-risks/fee-bypass.md).

# Fee bypass

#### Description

"Permanent Loss - Case 2: Unequal market state" demonstrates a difference:&#x20;

Unlike existing DEXs, which require tokens to be offered in proportion to receive LP tokens, liquidity can be provided immediately by inserting native tokens used in the relevant market. This allows users to provide liquidity in imbalanced markets by receiving a portion of the shares with a relatively high current price, either Yes or No, as well as LP shares.

This vulnerability exists due to the characteristics of PM's AMM when providing liquidity to an imbalanced market, and if the platform does not implement a fee-based sell() function that sells Yes or No shares, there is a way to bet without a fee.

#### Attack Scenario

<figure><img src="https://4210179539-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2DiVEbUgCTsp2iPassR9%2Fuploads%2FbIXd7CxkQKyP4I1Iwklu%2FFunarchy%20(2).png?alt=media&amp;token=d5f80138-6bea-4d14-b72a-0916222f2899" alt=""><figcaption></figcaption></figure>

{% stepper %}
{% step %}
The current market is an imbalanced market with "Yes" and "No" at a 60:40 ratio.
{% endstep %}

{% step %}
The attacker first provides liquidity to purchase "Yes" shares without fees.
{% endstep %}

{% step %}
Attackers receive "Yes" shares and LP shares for providing liquidity.\
\- See [here](https://funarchy.gitbook.io/funarchy/security-for-prediction-market/trading-mechanism/amm-risks/permanent-loss/unequal-market-state) for why shares come out like this in an unbalanced market.
{% endstep %}

{% step %}
The attacker immediately removes liquidity, giving LP shares and receiving "No" shares and native tokens used in the market.
{% endstep %}

{% step %}
The attacker sells the unnecessary "No" shares and retains only the "Yes" shares. Since there is no fee for selling, this essentially means obtaining the "Yes" shares without paying any fees.
{% endstep %}

{% step %}
Since this is a result of trading without commissions, it causes losses to liquidity providers who have to charge commissions.
{% endstep %}
{% endstepper %}

#### Mitigation

* It is essential to charge fees for buys and sells that interact with the pool to prevent liquidity providers from incurring permanent losses.


---

# 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, and the optional `goal` query parameter:

```
GET https://funarchy.gitbook.io/funarchy/security-for-prediction-market/trading-mechanism/amm-risks/fee-bypass.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
