CollateralManager
Functions
initialize
function initialize(
) external
addCollateral
function addCollateral(
) external
setPriceFeed
function setPriceFeed(
) external
setCollateralRatio
function setCollateralRatio(
) external
setDiscountRatio
function setDiscountRatio(
) external
setDepositCap
function setDepositCap(
) external
setMaxCollateralTokensPerAccount
function setMaxCollateralTokensPerAccount(
) external
setMmRatioBuffer
function setMmRatioBuffer(
) external
setDebtNonSettlementTokenValueRatio
function setDebtNonSettlementTokenValueRatio(
) external
setLiquidationRatio
function setLiquidationRatio(
) external
setCLInsuranceFundFeeRatio
function setCLInsuranceFundFeeRatio(
) external
setDebtThreshold
function setDebtThreshold(
) external
setWhitelistedDebtThreshold
function setWhitelistedDebtThreshold(
) external
setCollateralValueDust
function setCollateralValueDust(
) external
Same decimals as the settlement token
getClearingHouseConfig
function getClearingHouseConfig(
) external returns (address)
Get the address of clearing house config
Return Values:
clearingHouseConfig
address
address of clearing house config
getVault
function getVault(
) external returns (address)
Get the address of vault
Return Values:
vault
address
address of vault
getCollateralConfig
function getCollateralConfig(
address token
) external returns (struct Collateral.Config)
Get collateral config by token address
Parameters:
token
address
address of token
Return Values:
collateral
struct Collateral.Config
config
getPriceFeedDecimals
function getPriceFeedDecimals(
address token
) external returns (uint8)
Get price feed decimals of the collateral token
Parameters:
token
address
address of token
Return Values:
decimals
uint8
of the price feed
getPrice
function getPrice(
address token
) external returns (uint256)
Get the price of the collateral token
Parameters:
token
address
address of token
Return Values:
price
uint256
of the certain period
getMaxCollateralTokensPerAccount
function getMaxCollateralTokensPerAccount(
) external returns (uint8)
getMmRatioBuffer
function getMmRatioBuffer(
) external returns (uint24)
Get the minimum margin ratio - mmRatio
before the account's collateral is liquidatable
6 decimals, same decimals as _mmRatio
getDebtNonSettlementTokenValueRatio
function getDebtNonSettlementTokenValueRatio(
) external returns (uint24)
Get the maximum debt / nonSettlementTokenValue
before the account's collaterals are liquidated
6 decimals
getLiquidationRatio
function getLiquidationRatio(
) external returns (uint24)
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:
liquidation
uint24
ratio
getCLInsuranceFundFeeRatio
function getCLInsuranceFundFeeRatio(
) external returns (uint24)
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:
insurance
uint24
fund fee ratio
getDebtThreshold
function getDebtThreshold(
) external returns (uint256)
Get the default maximum debt (denominated in settlement token) allowed before an account’s collateral is liquidatable.
6 decimals
getDebtThresholdByTrader
function getDebtThresholdByTrader(
) external returns (uint256)
Get the maximum whitelisted debt (denominated in settlement token) allowed before an account’s collateral is liquidatable.
6 decimals
getTotalWhitelistedDebtThreshold
function getTotalWhitelistedDebtThreshold(
) external returns (uint256)
Get the total whitelisted debt (denominated in settlement token) allowed
6 decimals
getCollateralValueDust
function getCollateralValueDust(
) external returns (uint256)
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:
Dust
uint256
collateral value
isCollateral
function isCollateral(
address token
) public returns (bool)
Check if the given token is one of collateral tokens
Parameters:
token
address
address of token
Return Values:
true
bool
if the token is one of collateral tokens
requireValidCollateralMmRatio
function requireValidCollateralMmRatio(
uint24 mmRatioBuffer
) public returns (uint24)
Require and get the the valid collateral maintenance margin ratio by mmRatioBuffer
Parameters:
mmRatioBuffer
uint24
safe margin ratio buffer; 6 decimals, same decimals as _mmRatio
Return Values:
collateralMmRatio
uint24
the collateral maintenance margin ratio
Last updated
Was this helpful?