Developer Guide

To get started with building with the Mimo protocol, let's walk through the process of opening a vault and minting PAR.


The VaultsCore contract is the main interface for the user to interact with the Mimo protocol’s collateralized debt system, such as depositing, borrowing, repaying, and liquidating debt. It stores the collateral, manages the safety reserve, and handles all debt calculations.
The VaultsCore contract has the following interface:
interface IVaultsCore {
function deposit ( address _collateralType , uint256 _amount ) external ;
function depositByVaultId ( uint256 _vaultId , uint256 _amount ) external ;
function depositAndBorrow ( address _collateralType , uint256 _depositAmount ,
uint256 _borrowAmount ) external ;
function withdraw ( uint256 _vaultId , uint256 _amount ) external ;
function withdrawAll ( uint256 _vaultId ) external ;
function borrow ( uint256 _vaultId , uint256 _amount ) external ;
function repayAll ( uint256 _vaultId ) external ;
function repay ( uint256 _vaultId , uint256 _amount ) external ;
function liquidate ( uint256 _vaultId ) external ;
In addition to ERC20 collateral types, VaultsCore supports ETH directly through functions such as depositETH, withdrawETH and depositAndBorrowETH.

Opening a vault

As of July 2021, the Mimo Protocol Vaults supports the following collateral assets: WETH, WBTC, and USDC.
To create a vault and deposit WETH collateral equal to DEPOSIT_AMOUNT to it, follow these steps:
  • Approve the collateral ERC20 asset (WETH) to the VaultsCore address equal to at least the DEPOSIT_AMOUNT.
WETH.approve(VaultsCore address, DEPOSIT_AMOUNT)
  • Call the VaultsCore.deposit() function with the desired collateral address and deposit amount.
VaultsCore.deposit(WETH address, DEPOSIT_AMOUNT)
  • You can view your vault details from the VaultsCore.vaults()view function.
myVaultId = VaultsDataProvider.vaultId(WETH address, your address);
myVault = VaultsDataProvider.vaults(vaultId)
  • Each Vault has the following information:
struct Vault {
address collateralType;
address owner;
uint256 collateralBalance;
uint256 baseDebt;
uint256 createdAt;

Borrowing and minting PAR

To borrow and mint PAR equal to BORROW_AMOUNT, call the VaultsCore.borrow() function.
VaultsCore.borrow(myVaultId, BORROW_AMOUNT);
Your maximum borrow amount is equal to:
Max Borrow amount = collateral deposit amount * collateral price / collateralization ratio (e.g. 1.6)
Make sure you do not borrow beyond your maximum borrow amount to avoid getting liquidated.