Insurance

Pays out Vault in case of default

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

EMERGENCY_ADMIN

function EMERGENCY_ADMIN() external view returns (bytes32)

Returns

GOVERNANCE

function GOVERNANCE() external view returns (bytes32)

Returns

clearingHouse

function clearingHouse() external view returns (contract IClearingHouse)

ClearingHouse contract

Returns

fundInsurance

function fundInsurance(uint256 amount) external nonpayable

Fund insurance. In case of bad debt, first recapitalize the Vault.

Parameters

getRoleAdmin

function getRoleAdmin(bytes32 role) external view returns (bytes32)

Returns the admin role that controls role. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.

Parameters

Returns

grantRole

function grantRole(bytes32 role, address account) external nonpayable

Grants role to account. If account had not been already granted role, emits a {RoleGranted} event. Requirements: - the caller must have role's admin role. May emit a {RoleGranted} event.

Parameters

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)

Returns true if account has been granted role.

Parameters

Returns

isEmergencyAdmin

function isEmergencyAdmin(address account) external view returns (bool)

Parameters

Returns

isGovernor

function isGovernor(address account) external view returns (bool)

Parameters

Returns

removeInsurance

function removeInsurance(uint256 amount) external nonpayable

Withdraw some amount from the Insurance

Parameters

renounceRole

function renounceRole(bytes32 role, address account) external nonpayable

Revokes role from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role, emits a {RoleRevoked} event. Requirements: - the caller must be account. May emit a {RoleRevoked} event.

Parameters

revokeRole

function revokeRole(bytes32 role, address account) external nonpayable

Revokes role from account. If account had been granted role, emits a {RoleRevoked} event. Requirements: - the caller must have role's admin role. May emit a {RoleRevoked} event.

Parameters

setClearingHouse

function setClearingHouse(contract IClearingHouse newClearingHouse) external nonpayable

Update the ClearingHouse

Parameters

settleDebt

function settleDebt(uint256 amount) external nonpayable

Settle bad debt in the Vault (in UA)settleDebt won't revert if the Insurance balance isn't large enough to cover the debt amount, so from the point of view of the Vault it'll seem like the Insurance paid back the debt (while it's not). Yet Insurance will keep track of this accounting imbalance with the systemBadDebt variable. The first action of the Insurance will be to spur this debt before adding new funds to the Insurance balance (see fundInsurance).

The UA amount transferred to the Vault is not assigned to any user's balance because the Vault cancels the debt of the individual user when calling settleDebt (see settleLiquidationOnCollaterals).

Parameters

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)

See {IERC165-supportsInterface}.

Parameters

Returns

systemBadDebt

function systemBadDebt() external view returns (uint256)

Debt which could not be settled by insurance

Returns

token

function token() external view returns (contract IERC20Metadata)

Insurance token

Returns

vault

function vault() external view returns (contract IVault)

Vault contract

Returns

Events

ClearingHouseChanged

event ClearingHouseChanged(contract IClearingHouse newClearingHouse)

Emitted when a new ClearingHouse is connected to the issuer

Parameters

InsuranceRemoved

event InsuranceRemoved(uint256 amount)

Emitted when some insurance reserves are withdrawn by governance

Parameters

RoleAdminChanged

event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)

Parameters

RoleGranted

event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

RoleRevoked

event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)

Parameters

SystemDebtChanged

event SystemDebtChanged(uint256 newSystemDebt)

Emitted when the system debt is updated, upwards or downwards

Parameters

Errors

Insurance_ClearingHouseAlreadySet

error Insurance_ClearingHouseAlreadySet()

Emitted when the clearingHouse has already been set (one time call function)

Insurance_ClearingHouseZeroAddress

error Insurance_ClearingHouseZeroAddress()

Emitted when the proposed clearingHouse address is equal to the zero address

Insurance_InsufficientInsurance

error Insurance_InsufficientInsurance()

Emitted when locked insurance falls below insurance ratio

Insurance_SenderNotClearingHouse

error Insurance_SenderNotClearingHouse()

Emitted when the sender is not the clearingHouse address

Insurance_SenderNotVault

error Insurance_SenderNotVault()

Emitted when the sender is not the vault address

Insurance_ZeroAddressConstructor

error Insurance_ZeroAddressConstructor(uint8 paramIndex)

Emitted when the zero address is provided as a parameter in the constructor

Parameters

PRBMathSD59x18__MulInputTooSmall

error PRBMathSD59x18__MulInputTooSmall()

Emitted when one of the inputs is MIN_SD59x18.

PRBMathSD59x18__MulOverflow

error PRBMathSD59x18__MulOverflow(uint256 rAbs)

Emitted when the intermediary absolute result overflows SD59x18.

Parameters

PRBMath__MulDivFixedPointOverflow

error PRBMath__MulDivFixedPointOverflow(uint256 prod1)

Emitted when the result overflows uint256.

Parameters

Last updated