> For the complete documentation index, see [llms.txt](https://deephigh.gitbook.io/deephigh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://deephigh.gitbook.io/deephigh/lending-invariant/invariant/omni.md).

# Omni

Omni by Beta is a novel composable, dynamic, and capital efficient money market primitive. In comparison to existing money market designs that make trade-offs between asset capital efficiency and liquidity to support more assets, the Omni protocol is able to support a wide array of collateral and borrow assets with zero fragmentation and maximal capital efficiency.

### Collateral Deposit

<table><thead><tr><th width="300">Invariants</th><th width="60" align="center">O/X</th><th>Description</th></tr></thead><tbody><tr><td>Collateral deposits must not be allowed when the protocol is in a paused state.</td><td align="center">O</td><td>It checks through the <code>whenNotPaused</code> modifier.</td></tr><tr><td>The block state of the market where collateral is deposited must be updated to the latest status.</td><td align="center">O</td><td>-</td></tr></tbody></table>

### Collateral Withdraw

<table><thead><tr><th width="300">Invariants</th><th width="60" align="center">O/X</th><th>Description</th></tr></thead><tbody><tr><td>Users can withdraw collateral only within the limits that do not exceed the set Loan-to-Value (LTV) ratio.</td><td align="center">O</td><td>-</td></tr><tr><td>The block state of the market where collateral is withdrawn must be updated to the latest status.</td><td align="center">O</td><td>-</td></tr></tbody></table>

### Borrow

<table><thead><tr><th width="300">Invariants</th><th width="60" align="center">O/X</th><th>Description</th></tr></thead><tbody><tr><td>Loans must not be allowed when the protocol is in a paused state.</td><td align="center">O</td><td>It checks through the <code>whenNotPaused</code> modifier.</td></tr><tr><td>The borrower must be registered in the relevant market.</td><td align="center">O</td><td>-</td></tr><tr><td>After executing the loan, the market's total borrow amount must not exceed the set borrow cap.</td><td align="center">O</td><td>-</td></tr><tr><td>Borrowers cannot exceed the Loan-to-Value (LTV) ratio relative to their collateral.</td><td align="center">O</td><td>-</td></tr><tr><td>Before executing a loan, the target market's block state must be updated to the latest status.</td><td align="center">O</td><td>-</td></tr></tbody></table>

### Repay

<table><thead><tr><th width="300">Invariants</th><th width="60" align="center">O/X</th><th>Description</th></tr></thead><tbody><tr><td>The block state of the repayment market must be updated to the latest status.</td><td align="center">O</td><td>-</td></tr><tr><td>Repaying more than the borrowed amount is not allowed.</td><td align="center">O</td><td>There is no error handling, but an underflow occurs.</td></tr></tbody></table>

### Liquidation

<table><thead><tr><th width="300">Invariants</th><th width="60" align="center">O/X</th><th>Description</th></tr></thead><tbody><tr><td>The liquidator can only liquidate borrowers whose Loan-to-Value (LTV) ratio exceeds the limit, resulting in a liquidity shortfall.</td><td align="center">O</td><td>-</td></tr><tr><td>The liquidator's repayment amount must not exceed the close factor relative to the borrower's total borrow amount.</td><td align="center">O</td><td>-</td></tr><tr><td>Both the market for the borrowed asset and the collateral asset must be updated with the latest block information.</td><td align="center">O</td><td>-</td></tr><tr><td>The liquidator and the borrower cannot be the same account.</td><td align="center">X</td><td>-</td></tr><tr><td>The amount of collateral the liquidator receives cannot exceed the total collateral balance of the borrower.</td><td align="center">O</td><td>In the seize calculation logic, it cannot exceed the limit.</td></tr><tr><td>The collateral and borrowed assets involved in the liquidation must be under the same administrative entity.</td><td align="center">O</td><td>-</td></tr></tbody></table>

### Interest and Reward

<table><thead><tr><th width="300">Invariants</th><th width="60" align="center">O/X</th><th>Description</th></tr></thead><tbody><tr><td>The borrow interest rate must not exceed the set maximum value.</td><td align="center">O</td><td>-</td></tr><tr><td>During interest calculation, related state variables like total reserves, total borrows, and market indices must be updated to their latest statuses.</td><td align="center">O</td><td>-</td></tr><tr><td>For fixed-point arithmetic, steps should be taken to prevent rounding issues in low decimal places, such as using correct operation order or a fixed-point library.</td><td align="center">O</td><td>-</td></tr></tbody></table>

### Oracle

<table><thead><tr><th width="300">Invariants</th><th width="60" align="center">O/X</th><th>Description</th></tr></thead><tbody><tr><td>The price of the underlying asset retrieved from the oracle must not be zero; if the price is zero, the transaction should be halted.</td><td align="center">O</td><td>-</td></tr><tr><td>It verifies that the oracle value is up-to-date.</td><td align="center">O</td><td>-</td></tr></tbody></table>

***
