Solidity contract integration
Get list of whitelisted policies
First import interfaces
IContractRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
pragma experimental ABIEncoderV2;
interface IContractsRegistry {
function getPolicyBookRegistryContract() external view returns (address);
}IPolicyBookFabric.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.7.4;
interface IPolicyBookFabric {
enum ContractType {
CONTRACT,
STABLECOIN,
SERVICE,
EXCHANGE,
VARIOUS
}
}IPolicyBookRegistry.sol
Then insert this code
Returns
Name
Type
Description
_policyBooksArr
address[]
List of whitelisted policies
_stats
IPolicyBookRegistry.PolicyBookStats[]
The array of policies stats (struct PolicyBookStats)
Arguments
None
Purchase policy
Before calling this function the msg.sender should approve the address(this) to spend the totalPrice get by the following method in PolicyBook.sol:
converted in stblPrice:
First import interfaces
IPolicyBookFacade.sol
IPolicyBook.sol
Then insert this code
Returns
None
Arguments
Name
Type
Description
policyBookAddress
address
The address of the chosen policy
_epochsNumber
uint256
The period policy will cover
_coverTokens
uint256
The amount paid for the coverage
_distributor
address
The address of the distributor if it was sold by a distributor, he will get a fee
Get list of purchased policies
First import interfaces
IContractRegistry.sol
IClaimingRegistry.sol
IPolicyRegistry.sol
Then insert this code
Returns
Name
Type
Description
_policiesCount
uint256
The number of police in the array
_policyBooksArr
address[]
The array of policy books addresses
_policies
IPolicyRegistry.PolicyInfo[]
The array of policies info (struct PolicyInfo)
_policyStatuses
IClaimingRegistry.ClaimStatus[]
The array of status of claim (enum ClaimStatus)
Arguments
Name
Type
Description
_isActive
bool
If true, returns an array with information about active policies, if false, about inactive
Earn interest
Before calling this function the msg.sender should approve the address(this) to spend the _liquidityAmount converted in stblAmount
First import interfaces
IPolicyBookFacade.sol
IPolicyBook.sol
Then insert this code
Returns
None
Arguments
Name
Type
Description
policyBookAddress
address
The address of the chosen policy
_liquidityAmount
uint256
The amount of coverage provision
Last updated
Was this helpful?