Developer Docs
Search
K

Insurance

Pays out Vault in case of default

Methods

DEFAULT_ADMIN_ROLE

function DEFAULT_ADMIN_ROLE() external view returns (bytes32)

Returns

Name
Type
Description
_0
bytes32
undefined

EMERGENCY_ADMIN

function EMERGENCY_ADMIN() external view returns (bytes32)

Returns

Name
Type
Description
_0
bytes32
undefined

GOVERNANCE

function GOVERNANCE() external view returns (bytes32)

Returns

Name
Type
Description
_0
bytes32
undefined

clearingHouse

function clearingHouse() external view returns (contract IClearingHouse)
ClearingHouse contract

Returns

Name
Type
Description
_0
contract IClearingHouse
undefined

fundInsurance

function fundInsurance(uint256 amount) external nonpayable
Fund insurance. In case of bad debt, first recapitalize the Vault.

Parameters

Name
Type
Description
amount
uint256
Amount of UA tokens to be transfered

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

Name
Type
Description
role
bytes32
undefined

Returns

Name
Type
Description
_0
bytes32
undefined

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

Name
Type
Description
role
bytes32
undefined
account
address
undefined

hasRole

function hasRole(bytes32 role, address account) external view returns (bool)
Returns true if account has been granted role.

Parameters

Name
Type
Description
role
bytes32
undefined
account
address
undefined

Returns

Name
Type
Description
_0
bool
undefined

isEmergencyAdmin

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

Parameters

Name
Type
Description
account
address
undefined

Returns

Name
Type
Description
_0
bool
undefined

isGovernor

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

Parameters

Name
Type
Description
account
address
undefined

Returns

Name
Type
Description
_0
bool
undefined

removeInsurance

function removeInsurance(uint256 amount) external nonpayable
Withdraw some amount from the Insurance

Parameters

Name
Type
Description
amount
uint256
UA amount to withdraw from the Insurance

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

Name
Type
Description
role
bytes32
undefined
account
address
undefined

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

Name
Type
Description
role
bytes32
undefined
account
address
undefined

setClearingHouse

function setClearingHouse(contract IClearingHouse newClearingHouse) external nonpayable
Update the ClearingHouse

Parameters

Name
Type
Description
newClearingHouse
contract IClearingHouse
Address of the new ClearingHouse

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

Name
Type
Description
amount
uint256
Amount of tokens withdrawn for settlement

supportsInterface

function supportsInterface(bytes4 interfaceId) external view returns (bool)
See {IERC165-supportsInterface}.

Parameters

Name
Type
Description
interfaceId
bytes4
undefined

Returns

Name
Type
Description
_0
bool
undefined

systemBadDebt

function systemBadDebt() external view returns (uint256)
Debt which could not be settled by insurance

Returns

Name
Type
Description
_0
uint256
undefined

token

function token() external view returns (contract IERC20Metadata)
Insurance token

Returns

Name
Type
Description
_0
contract IERC20Metadata
undefined

vault

function vault() external view returns (contract IVault)
Vault contract

Returns

Name
Type
Description
_0
contract IVault
undefined

Events

ClearingHouseChanged

event ClearingHouseChanged(contract IClearingHouse newClearingHouse)
Emitted when a new ClearingHouse is connected to the issuer

Parameters

Name
Type
Description
newClearingHouse
contract IClearingHouse
undefined

InsuranceRemoved

event InsuranceRemoved(uint256 amount)
Emitted when some insurance reserves are withdrawn by governance

Parameters

Name
Type
Description
amount
uint256
undefined

RoleAdminChanged

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

Parameters

Name
Type
Description
role indexed
bytes32
undefined
previousAdminRole indexed
bytes32
undefined
newAdminRole indexed
bytes32
undefined

RoleGranted

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

Parameters

Name
Type
Description
role indexed
bytes32
undefined
account indexed
address
undefined
sender indexed
address
undefined

RoleRevoked

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

Parameters

Name
Type
Description
role indexed
bytes32
undefined
account indexed
address
undefined
sender indexed
address
undefined

SystemDebtChanged

event SystemDebtChanged(uint256 newSystemDebt)
Emitted when the system debt is updated, upwards or downwards

Parameters

Name
Type
Description
newSystemDebt
uint256
undefined

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

Name
Type
Description
paramIndex
uint8
undefined

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

Name
Type
Description
rAbs
uint256
undefined

PRBMath__MulDivFixedPointOverflow

error PRBMath__MulDivFixedPointOverflow(uint256 prod1)
Emitted when the result overflows uint256.

Parameters

Name
Type
Description
prod1
uint256
undefined
Last modified 11mo ago