ICollateralManager
Functions
getVault
Get the address of vault
Return Values:
Name | Type | Description |
---|---|---|
| address | address of vault |
getClearingHouseConfig
Get the address of clearing house config
Return Values:
Name | Type | Description |
---|---|---|
| address | address of clearing house config |
getCollateralConfig
Get collateral config by token address
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
Return Values:
Name | Type | Description |
---|---|---|
| struct Collateral.Config | config |
getPriceFeedDecimals
Get price feed decimals of the collateral token
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
Return Values:
Name | Type | Description |
---|---|---|
| uint8 | of the price feed |
getPrice
Get the price of the collateral token
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
Return Values:
Name | Type | Description |
---|---|---|
| uint256 | of the certain period |
getMaxCollateralTokensPerAccount
Get the max number of collateral tokens per account
Return Values:
Name | Type | Description |
---|---|---|
| uint8 | number of collateral tokens per account |
getMmRatioBuffer
Get the minimum margin ratio - mmRatio
before the account's collateral is liquidatable
6 decimals, same decimals as _mmRatio
getDebtNonSettlementTokenValueRatio
Get the maximum debt / nonSettlementTokenValue
before the account's collaterals are liquidated
6 decimals
getLiquidationRatio
Get the maximum ratio of debt can be repaid in one transaction
6 decimals. For example, liquidationRatio
= 50% means the liquidator can repay as much as half of the trader’s debt in one liquidation
Return Values:
Name | Type | Description |
---|---|---|
| uint24 | ratio |
getCLInsuranceFundFeeRatio
Get the insurance fund fee ratio when liquidating a trader's collateral
6 decimals. For example, clInsuranceFundFeeRatio
= 5% means the liquidator will pay 5% of transferred settlement token to insurance fund
Return Values:
Name | Type | Description |
---|---|---|
| uint24 | fund fee ratio |
getDebtThreshold
Get the default maximum debt (denominated in settlement token) allowed before an account’s collateral is liquidatable.
6 decimals
getDebtThresholdByTrader
Get the maximum whitelisted debt (denominated in settlement token) allowed before an account’s collateral is liquidatable.
6 decimals
getTotalWhitelistedDebtThreshold
Get the total whitelisted debt (denominated in settlement token) allowed
6 decimals
getCollateralValueDust
Get the threshold of the minium repaid. If a trader’s collateral value (denominated in settlement token) falls below the threshold, the liquidator can convert it with 100% liquidationRatio
so there is no dust left
6 decimals
Return Values:
Name | Type | Description |
---|---|---|
| uint256 | collateral value |
isCollateral
Check if the given token is one of collateral tokens
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
Return Values:
Name | Type | Description |
---|---|---|
| bool | if the token is one of collateral tokens |
requireValidCollateralMmRatio
Require and get the the valid collateral maintenance margin ratio by mmRatioBuffer
Parameters:
Name | Type | Description |
---|---|---|
| uint24 | safe margin ratio buffer; 6 decimals, same decimals as _mmRatio |
Return Values:
Name | Type | Description |
---|---|---|
| uint24 | the collateral maintenance margin ratio |
Events
CollateralAdded
Emitted when owner add collateral
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
| address | address of price feed |
| uint24 | collateral ratio |
| uint24 | discount ratio for the collateral liquidation |
| uint256 | max amount of collateral that can be deposited |
ClearingHouseConfigChanged
Emitted when owner update the address of clearing house config
Parameters:
Name | Type | Description |
---|---|---|
| address | address of clearing house config |
VaultChanged
Emitted when owner update the address of vault
Parameters:
Name | Type | Description |
---|---|---|
| address | address of vault |
PriceFeedChanged
Emitted when owner update the price feed address of a collateral token
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
| address | address of price feed |
CollateralRatioChanged
Emitted when owner update the collateral ratio of a collateral token
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
| uint24 | collateral ratio |
DiscountRatioChanged
Emitted when owner change the discount ratio
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
| uint24 | discount ratio for the collateral liquidation |
DepositCapChanged
Emitted when owner update the deposit cap of a collateral token
Parameters:
Name | Type | Description |
---|---|---|
| address | address of token |
| uint256 | max amount of the collateral that can be deposited |
MaxCollateralTokensPerAccountChanged
Emitted when owner init or update the max collateral tokens that per account can have, this is can prevent high gas cost.
Parameters:
Name | Type | Description |
---|---|---|
| uint8 | max amount of collateral tokens that per account can have |
MmRatioBufferChanged
Emitted when owner init or update the maintenance margin ratio buffer, the value provides a safe range between the mmRatio & the collateralMMRatio.
Parameters:
Name | Type | Description |
---|---|---|
| uint24 | safe buffer number (bps) |
DebtNonSettlementTokenValueRatioChanged
Emitted when owner init or update the debt non-settlement token value ratio, maximum debt / nonSettlementTokenValue
before the account's is liquidatable
Parameters:
Name | Type | Description |
---|---|---|
| uint24 | debt non-settlement token value ratio, ≤ 1 |
LiquidationRatioChanged
Emitted when owner init or update the liquidation ratio, the value presents the max repaid ratio of the collateral liquidation.
Parameters:
Name | Type | Description |
---|---|---|
| uint24 | liquidation ratio, ≤ 1 |
CLInsuranceFundFeeRatioChanged
Emitted when owner init or update the clearing house insurance fund fee ratio, charge fee for clearing house insurance fund.
Parameters:
Name | Type | Description |
---|---|---|
| uint24 | clearing house insurance fund fee ratio, ≤ 1 |
DebtThresholdChanged
Emitted when owner init or update the debt threshold, maximum debt allowed before an account’s collateral is liquidatable.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | debt threshold |
WhitelistedDebtThresholdChanged
Emitted when owner init or update the whitelisted debt threshold, maximum debt allowed before an account’s collateral is liquidatable.
Parameters:
Name | Type | Description |
---|---|---|
| address | whitelisted debt threshold |
CollateralValueDustChanged
Emitted when owner init or update the collateral value dust, if a trader’s debt value falls below this dust threshold, the liquidator will ignore the liquidationRatio.
Parameters:
Name | Type | Description |
---|---|---|
| uint256 | collateral value dust |
Last updated