Borrowing with OnVault

OnVault enables borrowers to lock collateral (Real Estate RWA tokens) to borrow stablecoins in the form of USDAO. This allows access to liquidity without selling the underlying asset. Borrowing with OnVault follows a structured approach to ensure security, collateralization, and system stability.

How to Borrow with OnVault

1. Opening a Vault

A borrower must first create a Vault to lock their RWA tokens as collateral.

  • Function: openVault(uint _maxFeePercentage, uint _USDAOAmount, uint256 _collateralAmount, address _upperHint, address _lowerHint)

  • Requirements:

    • Collateralization ratio must be at least 110% in Normal Mode and 125% in Recovery Mode.

    • An issuance fee is applied and added to the debt.

  • Gas Compensation: 200 USDAO is reserved for gas compensation during liquidation.

2. Adding Collateral

Increase your collateral in the Vault to improve the collateralization ratio or to borrow more USDAO.

  • Function: addRPTN(uint256 _collateralAmount, address _upperHint, address _lowerHint)

3. Borrowing USDAO

You can issue USDAO from your Vault, subject to maintaining the minimum collateralization ratio.

  • Function: withdrawUSDAO(uint _maxFeePercentage, uint _USDAOAmount, address _upperHint, address _lowerHint)

4. Repaying Debt

Repay the borrowed USDAO to reduce your debt and reclaim your collateral.

  • Function: repayUSDAO(uint _USDAOAmount, address _upperHint, address _lowerHint)

5. Adjusting Vault

Simultaneously adjust collateral and debt in a single transaction to optimize your Vault.

  • Function: _adjustVault(address _borrower, uint _collWithdrawal, uint _USDAOChange, uint256 _collateralAmount, bool _isDebtIncrease, address _upperHint, address _lowerHint, uint _maxFeePercentage)

6. Closing the Vault

Repay all debt and withdraw all collateral to close the Vault.

  • Function: closeVault()

Collateralization and Liquidation

  • Collateralization Ratio (CR): The value of collateral divided by the borrowed USDAO. Maintaining a ratio above the required level is crucial to avoid liquidation.

  • Liquidation Conditions:

    • Normal Mode: Vaults with an individual collateralization ratio (ICR) below 110% are eligible for liquidation.

    • Recovery Mode: Triggered when the total collateralization ratio (TCR) drops below 125%. Liquidation conditions are relaxed, but certain borrower actions are restricted to protect system stability.

  • Liquidation Mechanism:

    • Redistributes debt and collateral to other Vaults or offsets the debt based on the ICR.

    • Gas Compensation: Liquidators are incentivized with 200 USDAO and 0.5% of the collateral.

Core Smart Contracts

  • BorrowerOperations.sol – Handles Vault creation, collateral adjustments, and debt issuance/repayment.

  • VaultManager.sol – Manages Vault states and liquidation processes.

  • OnVaultBase.sol – Provides global constants and shared functions for other contracts.

  • USDAO.sol – Implements the stablecoin logic.

  • SortedVaults.sol – Maintains a sorted list of Vaults based on their collateralization ratios.

Last updated