Insure
Search
K

RiskPoolCore

RiskPoolCore

This contract holds the core logic for Insure Protocol. It also has function calls permitted only to the RiskPoolManager.

View Methods

getPolicy

function getPolicy(uint256 policyId) external view returns (struct CoreLibrary.Policy)
Returns all the information of the associated policy.
Return Value
Type
Description
uint256
Policy id
uint256
The premium paid by the insured
uint256
The cover amount
uint256
The value of insured asset at the time of policy purchase.
uint256
The expiry timestamp
address
The address of the insured
uint8
The threshold below which the policy will be paid out
bool
Is the policy utilized or not
string
The symbol of the asset covered

getAssets

function getAssets() external view returns (string[])
Returns all the assets supported by Insure Protocol.
Return Value
Type
Description
string[]
Symbols of the assets supported

Write Methods

initAsset

Only available toRISK_POOL_MANAGERrole.
function initAsset(string assetSymbol) external
Add support for a new asset
Call Params
Name
Type
Description
assetSymbol
string
The symbol of the new asset that is being supported

ABI

RiskPoolCore ABI
[
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "previousAdmin",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "AdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "beacon",
"type": "address"
}
],
"name": "BeaconUpgraded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"inputs": [],
"name": "admin",
"outputs": [
{
"internalType": "address",
"name": "admin_",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "changeAdmin",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "implementation",
"outputs": [
{
"internalType": "address",
"name": "implementation_",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
}
],
"name": "upgradeTo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newImplementation",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"name": "upgradeToAndCall",
"outputs": [],
"stateMutability": "payable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
},
{
"inputs": [],
"name": "RiskPoolCore__AssetAlreadyInitialized",
"type": "error"
},
{
"inputs": [],
"name": "RiskPoolCore__NotPoolManager",
"type": "error"
},
{
"inputs": [],
"name": "RiskPoolCore__UnlockBeforeExpiry",
"type": "error"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "uint256",
"name": "assetId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "string",
"name": "asset",
"type": "string"
}
],
"name": "AssetInitialized",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "uint8",
"name": "version",
"type": "uint8"
}
],
"name": "Initialized",
"type": "event"
},
{
"inputs": [],
"name": "CORE_REVISION",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "addressesProvider",
"outputs": [
{
"internalType": "contract AddressesProvider",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"name": "assetIds",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getAssets",
"outputs": [
{
"internalType": "string[]",
"name": "",
"type": "string[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "policyId",
"type": "uint256"
}
],
"name": "getPolicy",
"outputs": [
{
"components": [
{
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "premium",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "payOutAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "assetValue",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "endTime",
"type": "uint256"
},
{
"internalType": "address",
"name": "insured",
"type": "address"
},
{
"internalType": "uint8",
"name": "threshold",
"type": "uint8"
},
{
"internalType": "bool",
"name": "utilized",
"type": "bool"
},
{
"internalType": "string",
"name": "asset",
"type": "string"
}
],
"internalType": "struct CoreLibrary.Policy",
"name": "",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "assetSymbol",
"type": "string"
}
],
"name": "initAsset",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract AddressesProvider",
"name": "_addressesProvider",
"type": "address"
}
],
"name": "initialize",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "isActive",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "isFreezed",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "lockedAssets",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "policyCount",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "policyId",
"type": "uint256"
}
],
"name": "updateStateOnApplyCover",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "assetSymbol",
"type": "string"
},
{
"internalType": "uint256",
"name": "endTime",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "premium",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "payOutAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "currentAssetPrice",
"type": "uint256"
},
{
"internalType": "uint8",
"name": "payOutThreshold",
"type": "uint8"
},
{
"internalType": "address",
"name": "reciever",
"type": "address"
}
],
"name": "updateStateOnPolicy",
"outputs": [
{
"internalType": "uint256",
"name": "policyId",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "timestamp",
"type": "uint256"
}
],
"name": "updateStateOnUnlock",
"outputs": [
{
"internalType": "uint256",
"name": "unlocksAt",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "unlockAmount",
"type": "uint256"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_logic",
"type": "address"
},
{
"internalType": "address",
"name": "admin_",
"type": "address"
},
{
"internalType": "bytes",
"name": "_data",
"type": "bytes"
}
],
"stateMutability": "payable",
"type": "constructor"
}
]