> For the complete documentation index, see [llms.txt](https://ston-fi.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ston-fi.gitbook.io/docs/developer-section/dex/smart-contracts/v1.md).

# v1 Smart Contracts

> **Important**: This API reference documents low-level smart contract methods and opcodes. For **production applications**, we **strongly recommend** using the [official SDK](/docs/developer-section/dex/sdk/v2.md) + [TonConnect](https://docs.ton.org/develop/dapps/ton-connect/overview) instead of manually compiling BOCs and sending transactions. The SDK provides better developer experience, handles edge cases, and receives official support. Custom BOC compilation should only be used for specialized/advanced use cases.

## Overview

The section contains separate documents for each smart contract used in AMM:

* [Pool](/docs/developer-section/dex/smart-contracts/v1/pool.md)
* [Router](/docs/developer-section/dex/smart-contracts/v1/router.md)
* [LpAccount](/docs/developer-section/dex/smart-contracts/v1/lpaccount.md)
* [LpWallet](/docs/developer-section/dex/smart-contracts/v1/lpwallet.md)

Source code of all smart contracts can be found in this [**Github repo**](https://github.com/ston-fi/dex-core)

> **Note**: Protocol fees in DEX v1 are collected in ASK jetton.

## Referral Fees

DEX v1 pays the referrer share of a swap fee directly inside the swap transaction. The rate is fixed at **0.1 %** and the amount is transferred to the provided `referrer_address` automatically. See the [Omniston referral fees guide](/docs/developer-section/omniston/referral-fees.md#referral-fees-with-dex-v1) (note: although the guide is Omniston-centric, the referenced paragraph specifically covers DEX V1 referral fees).

You can monitor referral payouts using the Stats & Vaults REST API:

* `GET /v1/stats/fee_accruals` – shows all operations that led to fee accrual for the referrer, filterable by period
* `GET /v1/stats/fee_withdrawals` – lists all fee withdrawals from the referrer's vaults by period
* `GET /v1/stats/fees` – returns aggregated referral fee information, such as total accrued USD value, for the selected time frame

The full specification is available in the [Swagger UI](https://api.ston.fi/swagger-ui/#/).
