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

# Subvault Technical Docs

### Contract Overview

**Contract Name**: `Subvault`\
**Symbol**: `STS`\
**Token Type**: ERC20 (non-transferable)\
**Primary Asset**: USDC (ERC20-compatible stablecoin)\
**Stake Token**: STS (Subvault Token Share)\
**Security Modules**: Pausable, ReentrancyGuard, Ownable, Chainalysis Oracle

### 🗃 Data Structures

```solidity
solidityCopyEditstruct StakeRecord {
    uint256 stsShares;      // Amount of STS minted during stake
    uint256 durationDays;   // Lock period (0, 90, 180)
    uint256 lockEndTime;    // Epoch time after which stake can be redeemed
    bool active;            // Active status
}
```

User stakes are stored in:

```solidity
solidityCopyEditmapping(address => StakeRecord[]) public userStakeRecords;
```

### 🧠 Business Logic Flow

#### Staking

1. User approves and calls `stake(amount, duration)`
2. STS minted and stake recorded
3. USDC transferred in

#### Unstaking

1. Lock expires → user calls `unstake(index)`
2. STS burned → USDC redeemed

#### Acquisition

1. Admin calls `withdrawForAcquisition(to, amount)`
2. Vault USDC decreases → STS dilution occurs

### 📦 Deployment Details

* **Compiler**: Solidity 0.8.17 (locked)
* **Libraries**: OpenZeppelin ERC20, SafeERC20, Pausable, ReentrancyGuard, Ownable
* **Decimals**: STS follows 18 decimals; USDC assumed to use 6
* **Chainalysis Oracle**: Must be deployed and compatible with `SanctionsList` interface
