> For the complete documentation index, see [llms.txt](https://docs.ionprotocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/ioninvariants.md).

# 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](broken://pages/X3pyVzPuZBs2ugcNRtlG) <a href="#state-variables" id="state-variables"></a>

#### [lens](broken://pages/X3pyVzPuZBs2ugcNRtlG) <a href="#lens" id="lens"></a>

```
IIonLens lens;
```

### [Functions](broken://pages/X3pyVzPuZBs2ugcNRtlG) <a href="#functions" id="functions"></a>

#### [constructor](broken://pages/X3pyVzPuZBs2ugcNRtlG) <a href="#constructor" id="constructor"></a>

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

#### [Invariant1](broken://pages/X3pyVzPuZBs2ugcNRtlG) <a href="#invariant1" id="invariant1"></a>

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

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

#### [Invariant2](broken://pages/X3pyVzPuZBs2ugcNRtlG) <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](broken://pages/X3pyVzPuZBs2ugcNRtlG) <a href="#invariant3" id="invariant3"></a>

Invariant1 accrued

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

#### [Invariant4](broken://pages/X3pyVzPuZBs2ugcNRtlG) <a href="#invariant4" id="invariant4"></a>

Invariant2 accrued

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