# IonInvariants

[Git Source](https://github.com/Ion-Protocol/ion-protocol/blob/88cc595825f1dc2eb738fb93e172a3e8ab7a5c43/src/periphery/IonInvariants.sol)

This contract will be deployed on mainnet and be used to check the invariants of the Ion system offchain every block.

### [State Variables](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/broken-reference) <a href="#state-variables" id="state-variables"></a>

#### [lens](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/broken-reference) <a href="#lens" id="lens"></a>

```
IIonLens lens;
```

### [Functions](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/broken-reference) <a href="#functions" id="functions"></a>

#### [constructor](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/broken-reference) <a href="#constructor" id="constructor"></a>

```
constructor(IIonLens _lens);
```

#### [Invariant1](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/broken-reference) <a href="#invariant1" id="invariant1"></a>

Liquidity in pool + debt to pool >= total supply.

```
function Invariant1(IIonPool ionPool) external view;
```

#### [Invariant2](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/broken-reference) <a href="#invariant2" id="invariant2"></a>

\[Sum of all (ilk total normalized debt \* ilk rate)] + unbacked debt >= debt to pool.

```
function Invariant2(IIonPool ionPool) external view;
```

#### [Invariant3](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/broken-reference) <a href="#invariant3" id="invariant3"></a>

Invariant1 accrued

```
function Invariant3(IIonPool ionPool) external view;
```

#### [Invariant4](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/broken-reference) <a href="#invariant4" id="invariant4"></a>

Invariant2 accrued

```
function Invariant4(IIonPool ionPool) external view;
```
