# Error Codes

## Core Protocol Invariants

The system maintains four foundational rules:

* **Token Conservation:** Inflows must always equal outflows per transaction.
* **Atomic Fee Payment:** Partner and Manager fees are always paid together or both skipped.
* **Terminal State Uniqueness:** Every bet reaches exactly one final state.
* **Daily Drawdown:** Sum of game reserves cannot exceed 5% of the pool's day-start balance.

## Core Contract Errors (C01–C12)

| Code | Description                      |
| ---- | -------------------------------- |
| C01  | Tariff profit exceeds fee amount |
| C02  | Tariff not found                 |
| C03  | Invalid Game contract version    |
| C04  | Game not found                   |
| C05  | Invalid staking address          |
| C06  | Staking not found                |
| C07  | Invalid Pass membership          |
| C08  | Insufficient allowance           |
| C09  | Invalid tariff price             |
| C10  | Invalid stake profit for tariff  |
| C11  | Invalid bet amount               |
| C12  | Invalid stake amount             |

## Partner Contract Errors (PA01–PA02)

| Code | Description           |
| ---- | --------------------- |
| PA01 | Bet amount is zero    |
| PA02 | Staked amount is zero |

## Conservative Staking Pool (CSP01–CSP07)

| Code  | Description             |
| ----- | ----------------------- |
| CSP01 | Pool at full capacity   |
| CSP02 | Staker not pooled       |
| CSP03 | Stake period ongoing    |
| CSP04 | Stake already withdrawn |
| CSP05 | Claimable rewards exist |
| CSP06 | No tokens available     |
| CSP07 | No stakers present      |

## Conservative Staking (CS01–CS05)

| Code | Description                                     |
| ---- | ----------------------------------------------- |
| CS01 | Stake below minimum                             |
| CS02 | New minimum outside range                       |
| CS03 | Distribution only during calculation window     |
| CS04 | Operations prohibited during calculation window |
| CS05 | Pool creation blocked during calculation window |

## Dynamic Staking (DS01–DS12)

DS01–DS04, DS06–DS12 cover timing windows, staking minimums, balance verification, pool interactions, and distribution constraints.

## Dynamic Staking Pool (DSP01–DSP08)

DSP01–DSP08 cover capacity, membership, withdrawal, and distribution restrictions.

## Pass Errors (PS01–PS07, AM01)

| Code | Description               |
| ---- | ------------------------- |
| PS01 | Account already owns pass |
| PS02 | Inviter not member        |
| PS03 | Inviter unqualified       |
| PS04 | Parent not member         |
| PS05 | Non-transferable pass     |
| PS06 | Minting disabled          |
| PS07 | Caller not member         |
| AM01 | Zero affiliate address    |

## Predict Errors (P01–P09)

| Code    | Description                   |
| ------- | ----------------------------- |
| P01     | Unauthorized access           |
| P02–P04 | Invalid input data            |
| P05–P08 | Invalid game parameters       |
| P09     | Unregistered staking contract |

## Predict Game (PG01–PG06)

PG01–PG06 cover game state, round capacity, calculation timing, and data validity constraints.

## Affiliate (A01–A04)

| Code | Description        |
| ---- | ------------------ |
| A01  | Pass required      |
| A02  | Nothing claimable  |
| A03  | Bonus insufficient |
| A04  | Input out of range |

## Affiliate Fund (AF01–AF04)

| Code | Description           |
| ---- | --------------------- |
| AF01 | Value below minimum   |
| AF02 | Value exceeds maximum |
| AF03 | No claimable funds    |
| AF04 | Already claimed today |


---

# 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.celestium.digital/smartcontracts-description/error-codes.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.
