Test
This document is better viewed at https://docs.etherisc.com/contracts/api/test |
Contracts
TestCoinAlternativeImplementation
import "@etherisc/gif-contracts/contracts/test/TestCoinAlternativeImplementation.sol";
TestCompromisedProduct
import "@etherisc/gif-contracts/contracts/test/TestCompromisedProduct.sol";
constructor(bytes32 fakeProductName, address tokenAddress, uint256 fakeComponentId, uint256 fakeRiskpoolId, address registryAddress)
public
Constructor function to initialize the component with the given parameters.
applyForPolicy(uint256 premium, uint256 sumInsured, bytes metaData, bytes applicationData) → bytes32 processId
external
Allows a policy holder to apply for a new policy by submitting an application with the specified premium, sum insured, metaData, and applicationData.
submitClaim(bytes32 policyId, uint256 claimAmount)
external
Allows a policy holder to submit a claim for the specified policy.
getApplicationDataStructure() → string dataStructure
external
Returns the data structure of the application.
getClaimDataStructure() → string dataStructure
external
Returns the data structure of the claim data.
getPayoutDataStructure() → string dataStructure
external
Returns the data structure of the payout information.
riskPoolCapacityCallback(uint256 capacity)
external
Callback function to update the risk pool’s capacity.
approvalCallback()
external
This function is a callback function that is called after an approval has been made.
resumeCallback()
external
This function is a callback function that is triggered when a paused contract is resumed.
pauseCallback()
external
Callback function that is called when the contract is paused. This function does not take any parameters.
TestOracle
import "@etherisc/gif-contracts/contracts/test/TestOracle.sol";
constructor(bytes32 oracleName, address registry)
public
Constructor function for creating an Oracle contract.
TestProduct
import "@etherisc/gif-contracts/contracts/test/TestProduct.sol";
-
constructor(productName, tokenAddress, capitalOwner, oracleId, riskpoolId, registryAddress)
-
applyForPolicy(premium, sumInsured, metaData, applicationData)
-
applyForPolicy(policyHolder, premium, sumInsured, metaData, applicationData)
-
newAppliation(premium, sumInsured, metaData, applicationData)
-
adjustPremiumSumInsured(processId, expectedPremiumAmount, sumInsuredAmount)
constructor(bytes32 productName, address tokenAddress, address capitalOwner, uint256 oracleId, uint256 riskpoolId, address registryAddress)
public
Constructor function for creating a new instance of the Product contract.
applyForPolicy(uint256 premium, uint256 sumInsured, bytes metaData, bytes applicationData) → bytes32 processId
external
Allows a policy holder to apply for a new insurance policy by submitting an application with the specified premium, sum insured, metadata and application data.
applyForPolicy(address payable policyHolder, uint256 premium, uint256 sumInsured, bytes metaData, bytes applicationData) → bytes32 processId
external
Creates a new insurance application and underwrites it if possible.
newAppliation(uint256 premium, uint256 sumInsured, bytes metaData, bytes applicationData) → bytes32 processId
external
Creates a new insurance application.
revoke(bytes32 processId)
external
Revokes a process identified by its processId. Only the policy holder can revoke a process.
collectPremium(bytes32 policyId) → bool success, uint256 fee, uint256 netPremium
external
Collects the premium for a specific policy.
collectPremium(bytes32 policyId, uint256 amount) → bool success, uint256 fee, uint256 netPremium
external
Collects the premium for a specific policy.
adjustPremiumSumInsured(bytes32 processId, uint256 expectedPremiumAmount, uint256 sumInsuredAmount)
external
Adjusts the premium and sum insured amounts for a given process ID.
submitClaim(bytes32 policyId, uint256 claimAmount) → uint256 claimId
external
Allows a policy holder to submit a claim for a specific policy.
submitClaimNoOracle(bytes32 policyId, uint256 claimAmount) → uint256 claimId
external
Allows a policy holder to submit a claim without the need for an oracle.
submitClaimWithDeferredResponse(bytes32 policyId, uint256 claimAmount) → uint256 claimId, uint256 requestId
external
Submits a claim for a specific policy with a deferred response from the oracle. Increases the claims counter and creates a new claim application. Then, requests a response from the oracle via an external call with encoded query data.
confirmClaim(bytes32 policyId, uint256 claimId, uint256 confirmedAmount)
external
Confirms the amount to be paid out for a specific claim.
declineClaim(bytes32 policyId, uint256 claimId)
external
Allows the owner of the contract to decline a claim.
createPayout(bytes32 policyId, uint256 claimId, uint256 payoutAmount) → uint256 payoutId
external
Creates a new payout for a specific policy and claim.
newPayout(bytes32 policyId, uint256 claimId, uint256 payoutAmount) → uint256 payoutId
external
Creates a new payout for a claim under a policy.
processPayout(bytes32 policyId, uint256 payoutId)
external
Processes a payout for a specific policy.
oracleCallback(uint256 requestId, bytes32 policyId, bytes responseData)
external
This function is called by the oracle to provide the response data for a specified policy ID and request ID.
getClaimId(bytes32 policyId) → uint256
external
Returns the claim ID associated with a given policy ID.
TestRegistryCompromisedController
import "@etherisc/gif-contracts/contracts/test/TestRegistryCompromisedController.sol";
TestRegistryControllerUpdated
import "@etherisc/gif-contracts/contracts/test/TestRegistryControllerUpdated.sol";
TestRiskpool
import "@etherisc/gif-contracts/contracts/test/TestRiskpool.sol";