# Contracts Overview

The protocol uses a modular **hub-and-spoke architecture** where the Core contract serves as the central hub, providing fundamental safety and routing guarantees for all parties interacting with the liquidity pool, members, affiliates, or games.

## Module Architecture and Roles

| Module         | V2 Purpose                                                                    | Role in Hub-and-Spoke |
| -------------- | ----------------------------------------------------------------------------- | --------------------- |
| Core           | Central router for all bets, deposits, and fee distributions.                 | The Hub               |
| Gateway        | Swaps any ERC20 (USDT, WBTC) to native tokens via Uniswap in one transaction. | Spoke                 |
| Liquidity Pool | O(1) gas-efficient pool with cumulative per-share accounting.                 | Spoke                 |
| Pass           | Soulbound NFT membership card required for all protocol access.               | Spoke                 |
| Affiliate      | Manages bonus distribution, referral trees, and daily claim limits.           | Spoke                 |
| DAO            | Sole authoritative venue for on-chain governance and voting power.            | Spoke                 |
| Game Templates | Standardized logic for House, PvP, Lottery, and Mirror games.                 | Spoke                 |

## Contract Details

| Contract Name               | Purpose                                                            | Dependencies                                                                     |
| --------------------------- | ------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| **Token**                   | Implements the ERC20 token.                                        | -                                                                                |
| **Timelock**                | Implements time-based access control for contract functions.       | -                                                                                |
| **Tariff**                  | Manages tariff plans and fee structures.                           | Core                                                                             |
| **Pass**                    | Implements ERC721 token with affiliate system and minting logic.   | ERC721, AffiliateMember                                                          |
| **Partner**                 | Allows partners to place bets and stake funds.                     | ERC20                                                                            |
| **Multisend**               | Allows bulk sending of ERC20 tokens.                               | ERC20                                                                            |
| **Multimint**               | Allows bulk minting of Pass tokens.                                | Pass                                                                             |
| **Metadata**                | Allows members to set metadata.                                    | Pass                                                                             |
| **Helper**                  | Contains helper functions for profit calculation and distribution. | -                                                                                |
| **GameInterface**           | Defines the interface for game contracts.                          | -                                                                                |
| **CoreInterface**           | Defines the interface for the core contract.                       | -                                                                                |
| **Core**                    | Implements core logic for game management, staking, and tariffs.   | ERC20, StakingInterface, GameInterface, Tariff, Timelock, AffiliateInterface     |
| **Common**                  | Contains common data structures.                                   | -                                                                                |
| **BetsMemory**              | Manages bets and statistics.                                       | Core                                                                             |
| **AffiliateFund**           | Manages the affiliate fund.                                        | ERC20                                                                            |
| **Affiliate**               | Implements affiliate logic.                                        | AccessControl, AffiliateInterface                                                |
| **ConservativeStaking**     | Conservative staking with pools.                                   | StakingInterface, AccessControl, ReentrancyGuard, Pass, ConservativeStakingPool  |
| **DynamicStaking**          | Dynamic staking with pools.                                        | StakingInterface, AccessControl, ReentrancyGuard, Pass, Core                     |
| **ConservativeStakingPool** | Pool for conservative staking.                                     | AccessControl, ReentrancyGuard                                                   |
| **DynamicStakingPool**      | Pool for dynamic staking.                                          | AccessControl, ReentrancyGuard                                                   |
| **StakingInterface**        | Interface for staking contracts.                                   | -                                                                                |
| **Vesting**                 | Manages token vesting.                                             | ERC20, Ownable                                                                   |
| **Roulette**                | Game contract for roulette.                                        | VRFCoordinatorV2Interface, AccessControl, VRFConsumerBaseV2, GameInterface, Core |
| **RouletteBet**             | Manages individual roulette bets.                                  | Ownable, BetInterface                                                            |
| **Predict**                 | Manages prediction games.                                          | AccessControl, GameInterface, CoreInterface, PredictGame                         |
| **PredictGame**             | Game contract for prediction games.                                | Ownable, Predict, ERC20, AggregatorV3Interface                                   |
| **PredictBet**              | Manages individual prediction bets.                                | Ownable, BetInterface, Common                                                    |
| **DataFeed**                | Manages and updates data from Chainlink.                           | AggregatorV3Interface                                                            |
| **DataFeedTest**            | Test version of DataFeed.                                          | DataFeed                                                                         |
| **AffiliateMember**         | Manages affiliate members.                                         | AccessControl                                                                    |
| **Lottery**                 | Game contract for lottery LUCKY ROUND.                             | VRFCoordinatorV2Interface, AccessControl, VRFConsumerBaseV2, GameInterface, Core |
| **LotteryBet**              | Manages individual lottery bets.                                   | Ownable, BetInterface                                                            |
| **AffiliateInterface**      | Interface for affiliate logic.                                     | -                                                                                |


---

# 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/contracts-overview.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.
