InceptionVaultCore
The
IncepionVaultsCore
contract is the main interface for users to interact with the Inception Vault. It handles all the Inception Vault logic, which is the exact same logic used in the MIMO protocol but for a new ERC20 collateral. It also owns the global state (cumulative rate & last refresh) and perform all state updates.The contract leverages the existing MIMO protocol architecture to perform checks and queries :
- Health checks, liquidation bonus and discounts calculations are done through the LiquidationManager
The contract also stores all ERC20 collaterals.
The Inception
VaultConfig
is the equivalent of the CollateralConfig
in the ConfigProvider
with the exception of the collateralType
as there can only be one inceptionCollateral
per inception vault.This configuration is set by the inception vault owner at deployment.
Param Name | Type | Description |
---|---|---|
liquidationRatio | uint256 | LTV ratio from which an inception vault is open for liquidation |
minCollateralRatio | uint256 | Minimum LTV ratio for a vault to be considered healthy |
borrowRate | uint256 | The interest rate paid over time by borrowers (e.g. 2%.) |
originationFee | uint256 | Fee applied when borrowing/opening a loan |
liquidationBonus | uint256 | Liquidation bonus earned by liquidators |
liquidationFee | uint256 | Fee charged to the borrower for getting his collateral liquidated |
Initializer function to set state variables upon cloning.
Requirements :
- Can only be called once
- Set liquidation fee must be greater or equal than
WAD
Param Name | Type | Description |
---|---|---|
vaultConfig | struct | VaultConfig struct with all inception vault configuration parameters |
inceptionCollateral | IERC20 | The address of the ERC20 token that will be set as inceptionCollateral |
addressProvider | IAddressProvider | AddressProvider address |
adminInceptionVault | IAdminInceptionVault | AdminInceptionVault address |
inceptionVaultsDataProvider | IInceptionVaultsDataProvider | InceptionVaultsDataProvider address |
inceptionPriceFeed | IInceptionVaultPriceFeed | InceptionVaultPriceFeed address |
Deposits inception collateral ERC20 token into the vault of the owner as collateral. A new vault is created if no vault exists for the caller.
Param Name | Type | Description |
---|---|---|
_amount | uint256 | The amount of tokens to be deposited in WEI |
Deposits inception collateral ERC20 token into the specified vault as collateral.
Param Name | Type | Description |
---|---|---|
_vaultId | uint256 | The ID of the vault in which to deposit the inceptionCollateral |
_amount | uint256 | The amount of tokens to be deposited in WEI |
Deposit inceptionCollateral ERC20 token into the vault of the msg.sender as collateral and borrows the specified amount of tokens in WEI.
Requirements :
- Can only be called by the vault owner
- The
AdminInceptionVault
stableX
balance must be greater or equal than the borrowed amount - The operation must not result in an unhealthy vault
Param Name | Type | Description |
---|---|---|
_depositAmount | uint256 | The amount of inception collateral to be deposited in WEI |
_borrowAmount | uint256 | The amount of borrowed StableX tokens in WEI |
Borrows new PAR tokens from a vault.
Requirements :
- Can only be called by the vault owner
- The
AdminInceptionVault
stableX
balance must be greater or equal than the borrowed amount - The operation must not result in an unhealthy vault
Param Name | Type | Description |
---|---|---|
_vaultId | uint256 | The ID of the vault from which to borrow |
_amount | uint256 | The amount of borrowed inceptionCollateral tokens in WEI |
Withdraws inception collateral ERC20 token from a vault.
Requirements :
- Can only be called by the vault owner
- The operation must not result in an unhealthy vault
Param Name | Type | Description |
---|---|---|
_vaultId | uint256 | The ID of the vault from which to withdraw the inception collateral |
_amount | uint256 | The amount of inceptionCollateral ERC20 tokens to be withdrawn in WEI |
Repays an outstanding PAR balance to a vault and update the outstanding vault debt to the current time.
Param Name | Type | Description |
---|---|---|
_vaultId | | The ID of the vault for which to repay the outstanding debt balance |
_amount | | The amount of PAR tokens in WEI to be repaid |
Repay all debt of a vault.
Param Name | Type | Description |
---|---|---|
_vaultId | uint256 | The ID of the vault for which to repay the debt |
Liquidates a vault that is below the liquidation threshold by repaying its outstanding debt.
Requirements :
- The vault must be unhealthy
Param Name | Type | Description |
---|---|---|
_vaultId | uint256 | The ID of the vault to liquidate |
Liquidates a vault partially that is below the liquidation threshold by repaying part of its outstanding debt, update the outstanding vault debt to the current time and pay a liquidation bonus to the liquidator. A liquidation fee can also be applied to the borrower during the liquidation.
Requirements :
- The vault must be unhealthy
Param Name | Type | Description |
---|---|---|
_vaultId | uint256 | The ID of the vault to liquidate |
_amount | uint256 | The amount of debt + liquidation fee to repay |
Returns the current
cumulativeRate
Returns the timestamp of the last
cumulativeRate
refresh.Returns the inception vault configuration.
Returns the
AddressProvider
address.Returns the inception vault collateral.
Returns the
AdminInceptionVault
address.Returns the
InceptionVaultsDataProvider
address.Returns the
InceptionVaultPriceFeed
address.Last modified 7mo ago