# The Vault Architecture

At the heart of ATFi is the **Commitment Vault**.

## What is a Vault?

The `VaultATFi.sol` contract is an ERC-4626 compatible vault that manages a single "event" or commitment period. Each vault is deployed by the `FactoryATFi` contract, ensuring bytecode verification and safety.

### Properties of a Vault

| Property              | Description                                               |
| --------------------- | --------------------------------------------------------- |
| **Asset**             | The token used for staking (e.g., USDC, WETH).            |
| **Stake Amount**      | The fixed amount required to participate (e.g., 10 USDC). |
| **Commitment Period** | The time window from `Staking Open` to `Settlement`.      |
| **Participants**      | A list of addresses that have staked.                     |
| **Yield Strategy**    | (Optional) Where the funds are deployed (e.g., Morpho).   |

## State Machine

The vault enforces a strict state machine to prevent fund loss:

1. **Created:** Vault is deployed. Verification logic is inactive.
2. **Staking Open:** Users call `stake()`. Funds are held in the vault.
3. **Event Started:** Staking closes. Optionally, funds are moved to a Yield Strategy.
4. **Settled:** Owner finalizes the event. Yield is redeemed. Penalties calculated.
5. **Claim:** Users call `claim()` to withdraw their share.
