# Fees

CoolDEX implements a sophisticated fee structure that varies based on token type and configuration. This page details the different fee structures and their distribution mechanisms.

## Token Types and Fee Structures

### 1. Zero Fee Tokens

Tokens that have migrated from SC Bonding Curve with a zero fee setting (after\_migration\_fee = 0):

* **Swap Fee**: 0%
* **No fee distribution**: No fees are collected or distributed

### 2. Community Contribution Tokens

Tokens that have migrated from SC Bonding Curve with a positive fee setting:

* **Swap Fee Options**: 0.25%, 0.5%, 1%, 2%, or 5% (specified during token creation)
* **Fee Distribution**:
  * **Platform**: 10% of collected fees go to the platform
  * **Remaining 90%** is distributed according to the token creator's specifications:
    * **Burn**: Specified percentage of tokens are burned (reduces supply)
    * **Holders**: Specified percentage allocated to token holders
    * **LP Providers**: Specified percentage allocated to liquidity providers

## Fee Collection and Distribution

### Fee Collection

Fees are collected during swap operations:

1. **Swap Base In**: Fees are deducted from the input amount
2. **Swap Base Out**: Fees are added to the calculated input amount

### Fee Distribution Mechanisms

#### Immediate Distribution

Some fees are distributed immediately during the swap transaction:

* **Burns**: For tokens with a burn component, the specified percentage of tokens is burned directly during the swap
* **Platform Fees**: Platform fees are transferred to the platform fee account during the swap

#### Accumulated Distribution

Other fees accumulate and can be claimed by eligible recipients:

* **Holder Rewards**: Accumulated for token holders who can claim them
* **LP Rewards**: Accumulated for liquidity providers who can claim them

### Direction-Specific Fee Logic

#### Selling Tokens (Coin2PC)

When selling tokens for SOL:

1. A portion of the input tokens is deducted as fee
2. Of this fee:
   * A percentage is burned (if applicable)
   * A percentage is sent to CULT contribution account
   * The remaining tokens are added to the pool
3. From the output SOL:
   * A percentage is sent to platform tax account
   * A percentage is sent to CULT contribution account
   * The remaining SOL is sent to the user

#### Buying Tokens (PC2Coin)

When buying tokens with SOL:

1. A portion of the input SOL is deducted as fee
2. Of this fee:
   * A percentage is sent to platform tax account
   * A percentage is sent to CULT contribution account
   * The remaining SOL is added to the pool
3. From the output tokens:
   * A percentage is burned (if applicable)
   * A percentage is sent to CULT contribution account
   * The remaining tokens are sent to the user

## Fee Parameters

The key fee parameters in the system include:

* **swap\_fee\_numerator** and **swap\_fee\_denominator**: Determine the overall swap fee percentage
* **cooldex\_team\_fee\_wsol\_fee\_numerator** and **cooldex\_team\_fee\_wsol\_fee\_denominator**: Determine the platform's portion of the fee
* **burn\_rate**: Determines what percentage of the token fee is burned
* **SC BONDING CURVE\_BURN\_RATE\_DENOMINATOR**: Fixed at 10000, used to calculate percentages

## Example Fee Calculation

For a 5% fee token with 50% burn, 30% holders, 20% LP distribution, assuming a 1000 TOKEN swap:

```
swap_fee = 1000 * 0.05 = 50 TOKEN
platform_fee = 50 * 0.1 = 5 TOKEN
remaining_fee = 50 - 5 = 45 TOKEN

burn_amount = 45 * 0.5 = 22.5 TOKEN
holders_amount = 45 * 0.3 = 13.5 TOKEN
lp_amount = 45 * 0.2 = 9 TOKEN
```

In this example:

* 22.5 TOKEN would be burned
* 13.5 TOKEN would accumulate for holder rewards
* 9 TOKEN would accumulate for LP rewards
* 5 TOKEN would go to the platform


---

# 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.something.cool/cooldex/fees.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.
