# Fee Structure

The Tournament Builder, developed for Forge Digital Ventures, involves several types of fees:

## Protocol Fees

Fixed fees charged for using the tournament builder:

1. **Creation Fee**: `3_000_000 lovelace (3 ADA)` - Charged at tournament creation
   * Sent to Anvil fee address during tournament creation
2. **Settlement Fee**: `2_000_000 lovelace (2 ADA)` - Charged during tournament settlement
   * Sent to Forge Digital Ventures fee address during tournament settlement

## Participant Fees

Fees charged per participant:

1. **Per-Participant Protocol Fee**: `1_000_000 lovelace (1 ADA)` - Charged for each participant during settlement
   * Calculated as `entryFee * bracketSize` and sent to Forge Digital Ventures fee address during settlement
2. **Tournament Entry Fee**: Custom amount defined by tournament administrator
   * Optional, can be set to zero for free tournaments

## Fee Calculation Concepts

The tournament builder manages fees through several key mechanisms:

### Total Entry Fee

The total entry fee for each participant is the sum of:

* Protocol per-participant fee (1 ADA)
* Optional tournament-specific entry fee defined by the administrator

### Tournament Balance Requirements

The tournament builder enforces a minimum locked amount in the tournament UTXO using the following formula:

```
lockedAmount = totalPayout + heldFees - unpaidEntryFees
```

Where:

* `totalPayout`: Sum of all payout structure amounts and fixed payouts
* `heldFees`: Protocol fees that will be paid at settlement time
* `unpaidEntryFees`: Entry fees that haven't been collected yet (for empty slots)

This ensures the tournament has sufficient funds to cover all prizes and fees when it's settled, even if not all slots are filled yet.

### Example Fee Calculation

{% tabs %}
{% tab title="Small Tournament" %}
For a tournament with:

* 16 participants
* 10 ADA entry fee

The minimum locked value in the tournament UTXO would be:

```
Creation Fee + Settlement Fee + (Per-Participant Fee × Bracket Size) + (Entry Fee × Bracket Size)
= 3 ADA + 2 ADA + (1 ADA × 16) + (10 ADA × 16)
= 3 ADA + 2 ADA + 16 ADA + 160 ADA
= 181 ADA (or 181,000,000 lovelace)
```

{% endtab %}

{% tab title="Large Tournament" %}
For a tournament with:

* 64 participants
* 5 ADA entry fee

The minimum locked value in the tournament UTXO would be:

```
Creation Fee + Settlement Fee + (Per-Participant Fee × Bracket Size) + (Entry Fee × Bracket Size)
= 3 ADA + 2 ADA + (1 ADA × 64) + (5 ADA × 64)
= 3 ADA + 2 ADA + 64 ADA + 320 ADA
= 389 ADA (or 389,000,000 lovelace)
```

{% endtab %}

{% tab title="Free Tournament" %}
For a tournament with:

* 32 participants
* 0 ADA entry fee (free tournament)

The minimum locked value in the tournament UTXO would be:

```
Creation Fee + Settlement Fee + (Per-Participant Fee × Bracket Size) + (Entry Fee × Bracket Size)
= 3 ADA + 2 ADA + (1 ADA × 32) + (0 ADA × 32)
= 3 ADA + 2 ADA + 32 ADA + 0 ADA
= 37 ADA (or 37,000,000 lovelace)
```

{% endtab %}
{% endtabs %}

### Prize Distribution

The total prize pool is calculated from:

* Based on the payout structure defined in the tournament configuration
* Any fixed payouts to specific addresses. Fixed payouts are not directly related to the tournament participants.

When a tournament concludes, prizes are distributed according to this configuration, and protocol fees are automatically paid.

These mechanisms ensure the sustainability of the protocol while allowing tournament creators to define their own economic structure.

## Fee Refund Process

If a participant cancels their registration before being added to the tournament by the administrator:

* The complete entry fee amount (including any tournament-specific fees) is returned to the participant
* This is handled through the registration validator's 'Cancel' action
* Cancellation is only possible during Phase 1 of the registration process, before the participant has been added to the tournament

This refund mechanism provides financial protection for participants who need to withdraw from a tournament.

## Related Documentation

* For implementation details of registration and cancellation, see the [Registration Management API](/tournament-builder/registration.md)
* For a complete workflow guide, see the [Integration Flow](/tournament-builder/integration-flow.md)


---

# 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://dev.ada-anvil.io/tournament-builder/fee-structure.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.
