> For the complete documentation index, see [llms.txt](https://moonsters-nfts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moonsters-nfts.gitbook.io/docs/smart-contracts/main-contracts.md).

# Main Contracts

{% stepper %}
{% step %}

### **Collection Contracts** (NFT Storage)

These contracts are responsible for **storing all NFT data** (<mark style="color:green;">**Moonsters**</mark> and <mark style="color:orange;">**eggs**</mark>).

They execute the **three main functions**:

* [x] **Mint** → Creates new Moonsters or eggs on the blockchain.
* [x] **Burn** → Removes NFTs when sacrificed or evolved.
* [x] **Update** → Modifies an NFT's attributes after an evolution or state change.

```
📁 MoonsterCollection.sol → Manages the Moonster collection.
📁 EggCollection.sol → Manages the egg collection.
```

{% endstep %}

{% step %}

### **Utility Contracts** (Data Processing)

These contracts **manage logic and data transformation** before sending them to **Collection Contracts**.

They act as intermediaries, ensuring that game rules are met before modifying an NFT.

<pre><code>📁 MoonsterUtilities.sol → Manages Moonster evolution, training, and attribute updates.
<strong>📁 EggUtilities.sol → Controls egg rarity logic and distribution.
</strong></code></pre>

{% endstep %}

{% step %}

### **Metadata Contracts** (On-Chain Metadata)

Metadata contracts <mark style="color:yellow;">**dynamically generate**</mark> NFT attributes and data **in real-time**, without external servers.

When any [<mark style="color:purple;">**DApp**</mark>](https://moonsters-nfts.gitbook.io/docs/resources/quick-access.md) or marketplace like OpenSea requests the `tokenURI`, these contracts **construct the metadata in Base64 format** on the fly.

<pre><code><strong>📁 MoonsterMetadata.sol → Generates metadata for Moonsters.
</strong>📁 EggMetadata.sol → Generates metadata for eggs.
</code></pre>

{% endstep %}

{% step %}

### **Core Contracts** (Game Economy & Rewards)

These contracts manage the game economy, reward system, and user interactions within the ecosystem.

```
📁 MoonVault.sol → Manages the reward system and ETH distribution to Moonster holders.
📁 StarDustToken.sol → Handles the $SDUST token, used for evolution, food, and training.
📁 Users.sol → Records player activity and their interactions with Moonsters.
📁 DailyQuests.sol & ProgressQuests.sol → Manage daily and progressive quests.
```

{% endstep %}
{% endstepper %}
