# Settings

The settings directory contains facets and libraries that pull necessary information needed from multiple assets, platform and modifiers.

#### `assets`

Asset settings are stored using the Cache Lib, so they don't have their own library. Each asset used as a lending token has a set of settings assigned to them which are used in various functions.

**`libraries`**

The `libraries` directory contains information about multiple assets, including:

* `aToken` found in `AssetATokenLib`
* `cToken` found in `AssetCTokenLib`
* `yVault` found in `AssetYVaultLib`
* `pPool` found in `AssetPPoolLib`

The information pulled from these assets relate to their `MaxDebtRatio`, `MaxLoanAmount` and

`MaxTVLLib`, which are all in their respective solidity files.

`**AssetSettingsDataFacet**`

The Data Facet uses the libraries to pull necessary information (`MaxTVL` & `MaxLoanAmount`) of different assets.

`**AssetSettingsFacet**`

Perhaps the most used file in the entire directory, the Asset Settings Facet contains functions that do the following:

* `isAssetSettingsInitialized` digs in the `CacheLib` to check if it's respective asset settings exists
* `getMaxTVLAmount` gets the max total value locked of an asset
* `createAssetSetting` creates settings for an asset in the `CacheLib`
* `updateAssetSetting` updates an asset with the given parameter

#### `pausable`

Contains files that help pause and un-pause facets

* `PausableMods`
  * Has the modifier `paused` which is used by multiple files in the protocol to check if a facet is paused or not
* `PausableFacet`
  * Has the function `pause`, which is required to be called by the `PAUSER` role. It pauses the entire facet when passed true, un-pauses the asset when passed false

#### `platform`

Contains files to modify the platform settings. All the platform settings are stored in the `AppStorageLib`

* `PlatformSettingsLib` contains functions that retrieve the percentage value for submissions, maximum tolerance value, safety interval value, response expiry length and more
* `PlatformSettingsFacet` contains functions that create, update and get platform settings value
* `names.sol` contains all the variables of platform settings names that are hashed

#### `SettingsFacet`

Contains multiple functions that:

* `addAuthorizedAddress` adds a wallet address to the list of authorized wallets
* `addAuthorizedAddressList` adds a list of wallet addresses to the list of authorized wallets
* `removeAuthorizedAddress` revokes the role of a wallet address from the list of authorized wallets by removing it
* `hasAuthorization` checks whether an account has authorization by checking if it has the `AUTHORIZED` role
* `setNFTLiquidationController` sets a new address to which NFTs should be sent to when liquidating an NFT
* `getNFTLiquidationController` gets the new address where the NFTs are sent to be liquidated
