# Trading Fee

Pilgrim Protocol charges the user a

**trading fee**on:**trading**rounds on a`PilgrimPair`

pool- on a
**buyout event**of the metaNFT or NFT - on
**delisting**, i.e. reclaiming ownership of the locked NFT

This section describes how trading fees are quantitatively calculated on Pilgrim, and detailed fee distribution logic.

**TL;DR:**

Pilgrim Protocol charges two types of fees on every round trade: a

**base fee**and a**round fee**.- The
**base fee**is taken in the form of**base tokens**, and is used to buy back PIL for distribution to xPIL stakers. Additional PIL rewards are given to round traders as well. - The
**round fee**is taken in the form of**rounds**, and is sent to the metaNFT owner. This is given**in addition**to fee subsidizations from the Protocol Treasury, denominated in PIL tokens.

An NFT fee is also charged when NFTs or metaNFTs are traded. This is used to buy back PIL for distribution to xPIL stakers.

**Pilgrim is a decentralized protocol**;

**no centralized party takes fees**accumulated from the protocol directly.

- 1.
**Base Fee Ratio**:$f_\text{base} = a_\text{base} / b, b = 1000, a_\text{base} \in [0, b], a_\text{base} \in \mathbb{Z}^{+}$ - 2.
**Round Fee Ratio**:$f_\text{round} = a_\text{round} / b, b = 1000, a_\text{round} \in [0, b], a_\text{round} \in \mathbb{Z}^{+}$ - 3.
**NFT Fee Ratio**:$f_\text{NFT} = a_\text{NFT} / b, b = 1000, a_\text{NFT} \in [0, b], a_\text{NFT} \in \mathbb{Z}^{+}$ - 4.
**Base Fee Function**:$fee_\text{base}(n) = ceil(n / b) * a_\text{base}$: A function which calculates how much base tokens are charged as fees. - 5.
**Round Fee Function**:$fee_\text{round(n)} = ceil(m / b) * a_\text{round} * K$: A function which calculates how much base tokens are charged as fees. Note that the result is also a multiple of$K$. - 6.
**NFT Fee Function**:$fee_\text{NFT(n)} = ceil(n / b) * a_\text{NFT}$: A function which calculates how much base tokens are charged as fees when metaNFTs or NFTs are traded.

When a user pays

$n$

base tokens, they receive $m \cdot K - fee_\text{round}(m)$

rounds.- 1.The protocol receives$n$base tokens -- e.g. PIL, WETH, USDC, etc.
- 2.$fee_\text{base}(n)$base tokens are taken from provided base tokens. The resulting number of base tokens is$n - fee_\text{base}(n)$.
- 3.Apply Pilgrim AMM logic:$m \cdot K$rounds are minted.
- 4.$fee_\text{round}(m)$rounds are removed from initially minted rounds. The resulting number of rounds returned is$m \cdot K - fee_\text{round}(m)$

When a user pays

$n \cdot K$

rounds, they receive $m - fee_\text{round}(m)$

base tokens.- 1.The protocol receives$n \cdot K$rounds.
- 2.$fee_\text{round}(m)$rounds are taken from provided rounds. The resulting number of rounds is$n \cdot K - fee_\text{round}(n)$.
- 3.Apply Pilgrim AMM logic:$m$base tokens are withdrawn from the protocol.
- 4.$fee_\text{base}(m)$base tokens are removed from withdrawn liquidity. The resulting number of base tokens returned is$m - fee_\text{base}(m)$.

When a user pays

$n$

base tokens, metaNFT holders and round holders receive $n - fee_\text{NFT}(n)$

base tokens in total.- 1.The protocol receives$n$base tokens.
- 2.$fee_\text{NFT}(n)$base tokens are taken from provided base tokens. The resulting number of base tokens is$n - fee_\text{NFT}(n)$.