# 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;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionprotocol.io/devs/smart-contract-architecture/periphery/ioninvariants.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
