# Contracts

### How It All Works Together

#### The Evolution Flow:

1. **Player mints NFT** → Gets base stats in both contracts
2. **Player fights enemies** → Energy decreases, XP increases, maybe level up
3. **Player walks in real world** → Oracle updates stamina
4. **Player opens loot box** → Random strength bonus
5. **NFT metadata updates** → Shows current evolved stats

#### The Data Flow:

```
Real World → Oracle → GameEngine → TraitFusion → NFT Metadata
```

#### Key Innovations:

1. **Dual Storage**: Base traits (static) + Dynamic traits (evolving)
2. **Real-World Integration**: Physical activity affects game stats
3. **Provable Randomness**: Chainlink VRF ensures fair loot
4. **Cross-Chain Ready**: Snapshots enable blockchain portability
5. **Role-Based Security**: Different contracts have different permissions

#### Security Features:

1. **Ownership Checks**: Only NFT owner can perform actions
2. **Cooldowns**: Prevent spam and exploitation
3. **Rate Limiting**: Oracle updates have minimum intervals
4. **Reentrancy Protection**: Prevents attack vectors
5. **Access Control**: Role-based permissions throughout

This system creates truly living NFTs that grow and change based on both gameplay and real-world activities, with provable randomness and cross-chain capabilities!
