CollateralManager

  function initialize(
  ) external

addCollateralarrow-up-right

  function addCollateral(
  ) external

setPriceFeedarrow-up-right

  function setPriceFeed(
  ) external

setCollateralRatioarrow-up-right

  function setCollateralRatio(
  ) external

setDiscountRatioarrow-up-right

  function setDiscountRatio(
  ) external

setDepositCaparrow-up-right

setMaxCollateralTokensPerAccountarrow-up-right

setMmRatioBufferarrow-up-right

setDebtNonSettlementTokenValueRatioarrow-up-right

setLiquidationRatioarrow-up-right

setCLInsuranceFundFeeRatioarrow-up-right

setDebtThresholdarrow-up-right

setWhitelistedDebtThresholdarrow-up-right

setCollateralValueDustarrow-up-right

Same decimals as the settlement token

getClearingHouseConfigarrow-up-right

Get the address of clearing house config

Return Values:arrow-up-right

Name
Type
Description

clearingHouseConfig

address

address of clearing house config

Get the address of vault

Return Values:arrow-up-right

Name
Type
Description

vault

address

address of vault

getCollateralConfigarrow-up-right

Get collateral config by token address

Parameters:arrow-up-right

Name
Type
Description

token

address

address of token

Return Values:arrow-up-right

Name
Type
Description

collateral

struct Collateral.Config

config

getPriceFeedDecimalsarrow-up-right

Get price feed decimals of the collateral token

Parameters:arrow-up-right

Name
Type
Description

token

address

address of token

Return Values:arrow-up-right

Name
Type
Description

decimals

uint8

of the price feed

Get the price of the collateral token

Parameters:arrow-up-right

Name
Type
Description

token

address

address of token

Return Values:arrow-up-right

Name
Type
Description

price

uint256

of the certain period

getMaxCollateralTokensPerAccountarrow-up-right

getMmRatioBufferarrow-up-right

Get the minimum margin ratio - mmRatio before the account's collateral is liquidatable

6 decimals, same decimals as _mmRatio

getDebtNonSettlementTokenValueRatioarrow-up-right

Get the maximum debt / nonSettlementTokenValue before the account's collaterals are liquidated

6 decimals

getLiquidationRatioarrow-up-right

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:arrow-up-right

Name
Type
Description

liquidation

uint24

ratio

getCLInsuranceFundFeeRatioarrow-up-right

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:arrow-up-right

Name
Type
Description

insurance

uint24

fund fee ratio

getDebtThresholdarrow-up-right

Get the default maximum debt (denominated in settlement token) allowed before an account’s collateral is liquidatable.

6 decimals

getDebtThresholdByTraderarrow-up-right

Get the maximum whitelisted debt (denominated in settlement token) allowed before an account’s collateral is liquidatable.

6 decimals

getTotalWhitelistedDebtThresholdarrow-up-right

Get the total whitelisted debt (denominated in settlement token) allowed

6 decimals

getCollateralValueDustarrow-up-right

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:arrow-up-right

Name
Type
Description

Dust

uint256

collateral value

isCollateralarrow-up-right

Check if the given token is one of collateral tokens

Parameters:arrow-up-right

Name
Type
Description

token

address

address of token

Return Values:arrow-up-right

Name
Type
Description

true

bool

if the token is one of collateral tokens

requireValidCollateralMmRatioarrow-up-right

Require and get the the valid collateral maintenance margin ratio by mmRatioBuffer

Parameters:arrow-up-right

Name
Type
Description

mmRatioBuffer

uint24

safe margin ratio buffer; 6 decimals, same decimals as _mmRatio

Return Values:arrow-up-right

Name
Type
Description

collateralMmRatio

uint24

the collateral maintenance margin ratio

Last updated