# Vault

[`FathomVault`](https://github.com/Into-the-Fathom/fathom-vaults-smart-contracts/blob/master/contracts/vault/FathomVault.sol) is proxy, and its implementation is [`VaultPackage`](https://github.com/Into-the-Fathom/fathom-vaults-smart-contracts/blob/master/contracts/vault/packages/VaultPackage.sol).

The `VaultPackage` serves as the template for creating and managing vaults within the Fathom ecosystem. It supports a variety of operations including asset management, strategy implementation, and fee assessment in an efficient and secure manner.

### **State Variables**

* **profitMaxUnlockTime** (`uint256`): Maximum time over which profits from the vault are unlocked.
* **assetContract** (`ERC20`): ERC20 token contract address of the vault's primary asset.
* **decimalsValue** (`uint8`): Decimal precision of the vault's primary asset.
* **sharesName** (`string`): Name of the token shares issued by the vault.
* **sharesSymbol** (`string`): Symbol of the token shares issued by the vault.
* **factory** (`address`): Address of the factory contract that deployed the vault.
* **accountant** (`address`): Address of the accountant contract responsible for managing the vault's fee assessments.
* **assetType** (`uint256`): Type identifier for the asset, addressing specific behaviors or requirements.
* **defaultQueue** (`address[]`): The default strategy queue used for managing assets.
* **useDefaultQueue** (`bool`): Flag determining if the default strategy queue is always used.
* **depositLimit** (`uint256`): Maximum amount of assets that can be deposited into the vault.
* **depositLimitModule** (`address`): Address of the contract handling dynamic deposit limits.
* **withdrawLimitModule** (`address`): Address of the contract handling dynamic withdrawal limits.
* **minimumTotalIdle** (`uint256`): Minimum amount of total idle assets required in the vault.
* **strategies** (`mapping(address => StrategyParams)`): Mapping of strategy addresses to their operational parameters.

### Set Functions

#### **`setAccountant`**

* **Arguments**:
  * `newAccountant` (`address`): Address of the new accountant contract.

#### **`setDefaultQueue`**

* **Arguments**:
  * `newDefaultQueue` (`address[] calldata`): Array of strategy addresses to update the default queue.

#### **`setUseDefaultQueue`**

* **Arguments**:
  * `_useDefaultQueue` (`bool`): New boolean value to set the use of the default queue.

#### **`setDepositLimit`**

* **Arguments**:
  * `_depositLimit` (`uint256`): New deposit limit for the vault.

#### **`setDepositLimitModule`**

* **Arguments**:
  * `_depositLimitModule` (`address`): Address of the new deposit limit module.

#### **`setWithdrawLimitModule`**

* **Arguments**:
  * `_withdrawLimitModule` (`address`): Address of the new withdrawal limit module.

#### **`setMinimumTotalIdle`**

* **Arguments**:
  * `_minimumTotalIdle` (`uint256`): New minimum total idle assets for the vault.

#### **`setProfitMaxUnlockTime`**

* **Arguments**:
  * `_newProfitMaxUnlockTime` (`uint256`): New maximum time for profit unlocking.

#### **`addStrategy`**

* **Arguments**:
  * `newStrategy` (`address`): Address of the new strategy to add to the vault.

#### **`revokeStrategy`**

* **Arguments**:
  * `strategy` (`address`): Strategy address to revoke.
  * `force` (`bool`): Flag to force revocation, potentially incurring losses.

#### **`updateMaxDebtForStrategy`**

* **Arguments**:
  * `strategy` (`address`): Strategy address to update.
  * `newMaxDebt` (`uint256`): New maximum debt for the strategy.

#### **`shutdownVault`**

Shuts down the vault, preventing new deposits and initiating asset liquidation processes.

### Read Functions

#### **`getDebt`**

* **Arguments**:
  * `strategy` (`address`): Strategy address to query the current debt.
* **Returns**: Current debt amount for the specified strategy.

#### **`totalSupply`**

Returns the total supply of shares issued by the vault.

#### **`totalAssets`**

Returns the total assets managed by the vault, including both idle assets and those engaged in strategies.

#### **`unlockedShares`**

Returns the number of shares that have been unlocked based on the vault's profit unlocking schedule.

#### **`pricePerShare`**

Returns the current price per share of the vault, based on the underlying asset value.

### Events

#### **`UpdatedAccountant`**

* **Parameters**:
  * `newAccountant` (`address`): Address of the updated accountant.

#### **`UpdatedDefaultQueue`**

* **Parameters**:
  * `newDefaultQueue` (`address[]`): Updated array of strategy addresses for the default queue.

#### **`UpdatedUseDefaultQueue`**

* **Parameters**:
  * `_useDefaultQueue` (`bool`): Updated flag state for using the default queue.

#### **`UpdatedDepositLimit`**

* **Parameters**:
  * `_depositLimit` (`uint256`): New deposit limit set for the vault.

#### **`UpdatedDepositLimitModule`**

* **Parameters**:
  * `_depositLimitModule` (`address`): Address of the newly set deposit limit module.

#### **`UpdatedWithdrawLimitModule`**

* **Parameters**:
  * `_withdrawLimitModule` (`address`): Address of the newly set withdrawal limit module.

#### **`UpdatedMinimumTotalIdle`**

* **Parameters**:
  * `_minimumTotalIdle` (`uint256`): New minimum total idle assets set for the vault.

#### **`UpdatedProfitMaxUnlockTime`**

* **Parameters**:
  * `_newProfitMaxUnlockTime` (`uint256`): New maximum time for unlocking vault profits.
