# 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](https://docs.ston.fi/developer-section/dex/sdk/v2) + [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](https://docs.ston.fi/developer-section/dex/smart-contracts/v1/pool)
* [Router](https://docs.ston.fi/developer-section/dex/smart-contracts/v1/router)
* [LpAccount](https://docs.ston.fi/developer-section/dex/smart-contracts/v1/lpaccount)
* [LpWallet](https://docs.ston.fi/developer-section/dex/smart-contracts/v1/lpwallet)

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](https://docs.ston.fi/omniston/referral-fees#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/#/).
