> For the complete documentation index, see [llms.txt](https://docs.atoma.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.atoma.fi/security/contracts.md).

# Smart Contract

Both vaults are upgradeable ERC-4626 contracts on Arbitrum, built on OpenZeppelin and verified on Arbiscan. Each vault is a UUPS proxy that points to a shared implementation.

## Addresses

| Contract                | Address                                                                                                                |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Atoma Index vault (AVS) | [`0xCC56410e1a136aF0eCEb7241c6aE394F4d8b581c`](https://arbiscan.io/address/0xCC56410e1a136aF0eCEb7241c6aE394F4d8b581c) |
| Atoma RWA vault (AVS2)  | [`0x1C788E14d8e5B446e3F71B5142e2edaBcAB36da1`](https://arbiscan.io/address/0x1C788E14d8e5B446e3F71B5142e2edaBcAB36da1) |
| Vault implementation    | [`0xfe1630da561e82fefb56e37796faee917331215f`](https://arbiscan.io/address/0xfe1630da561e82fefb56e37796faee917331215f) |
| USDC (asset)            | [`0xaf88d065e77c8cC2239327C5EDb3A432268e5831`](https://arbiscan.io/address/0xaf88d065e77c8cC2239327C5EDb3A432268e5831) |

## Roles

| Role                  | Held by                                                                                                                |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| Owner                 | Multisig                                                                                                               |
| Operator, Atoma Index | [`0xC3678E12b287436E5AAC22e66724F28453A1613b`](https://arbiscan.io/address/0xC3678E12b287436E5AAC22e66724F28453A1613b) |
| Operator, Atoma RWA   | [`0x89596008ACa72cD54d2e28B22c3cc2800d7d8190`](https://arbiscan.io/address/0x89596008ACa72cD54d2e28B22c3cc2800d7d8190) |

## Functions

### Anyone

| Function             | What it does                                                                                                   |
| -------------------- | -------------------------------------------------------------------------------------------------------------- |
| `deposit`, `mint`    | Deposit USDC and receive shares. Minimum 100 USDC, within the deposit cap, rejected while deposits are paused. |
| `requestWithdrawal`  | Move shares into escrow and queue them for the next epoch.                                                     |
| `claimWithdrawal`    | Claim the USDC of a settled epoch, less the 0.5% withdrawal fee, which stays in the contract until collected.  |
| `withdraw`, `redeem` | Disabled. Withdrawals go through the epoch queue.                                                              |

### Operator

| Function                    | What it does                                                                     |
| --------------------------- | -------------------------------------------------------------------------------- |
| `updateTotalAssets`         | Publish a NAV update: at most one every 30 minutes, with a change of at most 2%. |
| `settleEpoch`               | Settle an ended epoch at the current share price.                                |
| `crystallizePerformanceFee` | Charge the performance fee, at most once every 7 days.                           |
| `collectWithdrawalFees`     | Collect the withdrawal fees accrued in the contract.                             |
| `pause`                     | Pause deposits.                                                                  |

### Owner

| Function                                                  | What it does                                                                                                          |
| --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| `upgradeToAndCall`                                        | Upgrade the vault implementation.                                                                                     |
| `setUpdateBounds`                                         | Change the NAV update limits.                                                                                         |
| `setEpochDuration`                                        | Change the epoch length, between 1 hour and 30 days, starting from the next epoch.                                    |
| `setMaxTotalAssets`                                       | Change the deposit cap.                                                                                               |
| `whitelistCapitalDestination`, `revokeCapitalDestination` | Approve or remove an address that can receive USDC from the contract. A new address becomes usable after 24 hours.    |
| `capitalWithdraw`                                         | Send USDC to an approved address. USDC owed to settled withdrawals and accrued withdrawal fees stays in the contract. |
| `capitalDeposit`                                          | Return USDC to the contract.                                                                                          |
| `setOperator`                                             | Replace the operator.                                                                                                 |
| `unpause`                                                 | Resume deposits.                                                                                                      |
| `resyncTotalAssets`                                       | Set total assets directly while the vault is paused.                                                                  |

## Fixed in the contract code

| Constant                         | Value    |
| -------------------------------- | -------- |
| Minimum deposit                  | 100 USDC |
| Performance fee                  | 20%      |
| Withdrawal fee                   | 0.5%     |
| Performance fee period           | 7 days   |
| Delay for new transfer addresses | 24 hours |

These values can change only through an upgrade.
