Skip to main content

IInsuranceFund

Functions

repay

  function repay(
) external

If insurance has negative accountValue of vault, will deposit amount to vault

distributeFee

  function distributeFee(
) external returns (uint256 surplus)

If balance of InsuranceFund is over distributionThreshold, transfer diff to SurplusBeneficiary

Insurance Fund should only distribute revenues surplus earned on the platform. In other words, funds directly held in the Insurance Fund contract (insuranceFundWalletBalance) contributes to insuranceFundTotalBalance but not necessarily to surplus. Anyone can send funds to Insurance Fund and help it reach distributionThreshold sooner, but once surplus exceeds the revenues earned on the platform (insuranceFundFreeCollateral), sending more funds won’t increase surplus further

Return Values:

NameTypeDescription
surplusuint256The surplus of distribution

getToken

  function getToken(
) external returns (address token)

Get settlement token address

Return Values:

NameTypeDescription
tokenaddressThe address of settlement token

getBorrower

  function getBorrower(
) external returns (address vault)

(Deprecated function, will be removed in the next release), Get borrower(Vault) address

Return Values:

NameTypeDescription
vaultaddressThe address of Vault

getVault

  function getVault(
) external returns (address vault)

Get Vault address

Return Values:

NameTypeDescription
vaultaddressThe address of Vault

getInsuranceFundCapacity

  function getInsuranceFundCapacity(
) external returns (int256 capacityX10_S)

Get InsuranceFund capacity

Return Values:

NameTypeDescription
capacityX10_Sint256The capacity value (settlementTokenValue + walletBalance) in settlement token's decimals

getDistributionThreshold

  function getDistributionThreshold(
) external returns (uint256 distributionThreshold)

Get insurance distributution threshold, this value is for fee distribution

Return Values:

NameTypeDescription
distributionThresholduint256The distribution threshold number

getSurplusBeneficiary

  function getSurplusBeneficiary(
) external returns (address surplusBeneficiary)

Get SurplusBeneficiary

Return Values:

NameTypeDescription
surplusBeneficiaryaddressThe address of SurplusBeneficiary

Events

BorrowerChanged

  event BorrowerChanged(
address borrower
)

(Deprecated function, will be removed in the next release), In the previous version Vault used to "borrow" from IF by calling IF.borrow(). We have since removed the behavior but kept the variable name "borrower" for backward-compatibility

Parameters:

NameTypeDescription
borroweraddressThe address of the borrower (actually is Vault address)

VaultChanged

  event VaultChanged(
address vault
)

Parameters:

NameTypeDescription
vaultaddressThe address of the vault

Repaid

  event Repaid(
uint256 repaidAmount,
uint256 tokenBalanceAfterRepaid
)

Parameters:

NameTypeDescription
repaidAmountuint256Repaid amount of the token
tokenBalanceAfterRepaiduint256InsuranceFund's token balance after repay

DistributionThresholdChanged

  event DistributionThresholdChanged(
uint256 distributionThreshold
)

We will transfer fee to SurplusBeneficiary if InsuranceFund free collateral is over distribution threshold

Parameters:

NameTypeDescription
distributionThresholduint256Distribution threshold amount

SurplusBeneficiaryChanged

  event SurplusBeneficiaryChanged(
address surplusBeneficiary
)

Parameters:

NameTypeDescription
surplusBeneficiaryaddressThe address of SurplusBeneficiary

FeeDistributed

  event FeeDistributed(
uint256 surplus,
uint256 insuranceFundCapacity,
uint256 insuranceFundFreeCollateral,
uint256 distributionThreshold
)

Parameters:

NameTypeDescription
surplusuint256The amount of distribution
insuranceFundCapacityuint256The capacity of insuranceFund contract
insuranceFundFreeCollateraluint256The free collateral(usdc) of insuranceFund contract in vault
distributionThresholduint256The distribution threshold amount