# Config

INIT Configuration contract.

## View Functions

### whitelistedWLps

Get whether the wrapped LP contract address is supported.

```solidity
function whitelistedWLps(address _wlp) external view returns (bool);
```

### getModeConfig

Get mode's configuration.

{% hint style="info" %}
If the mode does not exist, then the return values will be Solidity's default values (0 values).
{% endhint %}

```solidity
function getModeConfig(uint16 _mode) external view returns (address[] memory collTokens, address[] memory borrTokens, uint maxHealthAfterLiq_e18, uint8 maxCollWLpCount);
```

Parameters:

| Name    | Type     | Description        |
| ------- | -------- | ------------------ |
| `_mode` | `uint16` | mode to get config |

Returns:

| Name                    | Type        | Description                                      |
| ----------------------- | ----------- | ------------------------------------------------ |
| `collTokens`            | `address[]` | supported collateral tokens in the mode          |
| `borrTokens`            | `address[]` | supported borrow tokens in the mode              |
| `maxHealthAfterLiq_e18` | `uint256`   | max health after liquidation allowed in the mode |
| `maxCollWLpCount`       | `uint8`     | max wLp collateral count allowed in the mode     |

### getPoolConfig

Get lending pool's configuration.

{% hint style="info" %}
If the lending pool does not exist, then the return values will be Solidity's default values (0 values).
{% endhint %}

```solidity
struct PoolConfig {
    uint128 supplyCap; // pool supply cap
    uint128 borrowCap; // pool borrow cap
    bool canMint; // pool mint status
    bool canBurn; // pool burn status
    bool canBorrow; // pool borrow status
    bool canRepay; // pool repay status
    bool canFlash; // pool flash status
}

function getPoolConfig(address _pool) external view returns (PoolConfig memory config);
```

Parameters:

| Name    | Type      | Description                               |
| ------- | --------- | ----------------------------------------- |
| `_pool` | `address` | lending pool address to get configuration |

Returns:

| Name     | Type         | Description                                                                                                                                                               |
| -------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config` | `PoolConfig` | <p>pool configuration, containing:<br>- supply cap<br>- borrow cap<br>- can mint flag<br>- can burn flag<br>- can borrow flag<br>- can repay flag<br>- can flash flag</p> |

### isAllowedForBorrow

Get whether the lending pool is allowed to borrow in the specified mode.

```solidity
function isAllowedForBorrow(uint16 _mode, address _pool) external view returns (bool flag);
```

Parameters:

| Name    | Type      | Description                   |
| ------- | --------- | ----------------------------- |
| `_mode` | `uint16`  | mode to check                 |
| `_pool` | `address` | lending pool address to check |

Returns:

| Name   | Type   | Description                                                             |
| ------ | ------ | ----------------------------------------------------------------------- |
| `flag` | `bool` | boolean flag whether the lending pool is allowed for borrow in the mode |

### isAllowedForCollateral

Get whether the lending pool is allowed for collateral in the specified mode.

```solidity
function isAllowedForCollateral(uint16 _mode, address _pool) external view returns (bool flag);
```

Parameters:

| Name    | Type      | Description                   |
| ------- | --------- | ----------------------------- |
| `_mode` | `uint16`  | mode to check                 |
| `_pool` | `address` | lending pool address to check |

Returns:

| Name   | Type   | Description                                                                 |
| ------ | ------ | --------------------------------------------------------------------------- |
| `flag` | `bool` | boolean flag whether the lending pool is allowed for collateral in the mode |

### getTokenFactors

Get token factors for the specified mode and lending pool.

{% hint style="info" %}
If the mode does not exist, then the return values will be Solidity's default values (0 values).
{% endhint %}

```solidity
struct TokenFactors {
    uint128 collFactor_e18; // collateral factor in 1e18 (1e18 = 100%)
    uint128 borrFactor_e18; // borrow factor in 1e18 (1e18 = 100%)
}

function getTokenFactors(uint16 _mode, address _pool) external view returns (TokenFactors memory factors);
```

Parameters:

| Name    | Type      | Description                               |
| ------- | --------- | ----------------------------------------- |
| `_mode` | `uint16`  | mode to get token factors                 |
| `_pool` | `address` | lending pool address to get token factors |

Returns:

| Name           | Type           | Description                                                               |
| -------------- | -------------- | ------------------------------------------------------------------------- |
| `tokenFactors` | `TokenFactors` | <p>token factors including:<br>- collFactor\_e18<br>- borrFactor\_e18</p> |

### getMaxHealthAfterLiq\_e18

Get mode's max health allowed after liquidation with `10^18` precision.

{% hint style="info" %}
If the mode does not exist, then the return values will be Solidity's default values (0 values).
{% endhint %}

```solidity
function getMaxHealthAfterLiq_e18(uint16 _mode) external view returns (uint maxHealthAfterLiq_e18);
```

Parameters:

| Name    | Type     | Description                              |
| ------- | -------- | ---------------------------------------- |
| `_mode` | `uint16` | mode to get max health after liquidation |

Returns:

| Name                    | Type      | Description                                                         |
| ----------------------- | --------- | ------------------------------------------------------------------- |
| `maxHealthAfterLiq_e18` | `uint256` | mode's max health allowed after liquidation with `10^18` precision. |

### getModeStatus

Get the mode's status.

{% hint style="info" %}
If the mode does not exist, then the return values will be Solidity's default values (0 values).
{% endhint %}

```solidity
struct ModeStatus {
    bool canCollateralize; // mode collateralize status
    bool canDecollateralize; // mode decollateralize status
    bool canBorrow; // mode borrow status
    bool canRepay; // mode repay status
}

function getModeStatus(uint16 _mode) external view returns (ModeStatus memory modeStatus);
```

Parameters:

| Name    | Type     | Description        |
| ------- | -------- | ------------------ |
| `_mode` | `uint16` | mode to get status |

Returns:

| Name         | Type         | Description                                                                                                                      |
| ------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| `modeStatus` | `ModeStatus` | <p>mode status including:<br>- can collateralize flag<br>- can decollateralize flag<br>- can borrow flag<br>- can repay flag</p> |

### getModeMaxCollWLpCount

Get a mode's max collateral wrapped LP count

```solidity
function getModeMaxCollWLpCount(uint16 _mode) external view returns (uint8 count);
```

Parameters:

| Name    | Type     | Description                                 |
| ------- | -------- | ------------------------------------------- |
| `_mode` | `uint16` | mode to get max collateral wrapped LP count |

Returns:

| Name    | Type    | Description                     |
| ------- | ------- | ------------------------------- |
| `count` | `uint8` | max collateral wrapped LP count |
