Skip to content

Instantly share code, notes, and snippets.

@tyndallm
Created September 11, 2018 15:48
Show Gist options
  • Select an option

  • Save tyndallm/d3c84c76ef2de2b36dda2f574527a1ce to your computer and use it in GitHub Desktop.

Select an option

Save tyndallm/d3c84c76ef2de2b36dda2f574527a1ce to your computer and use it in GitHub Desktop.
PolicyContract interface
pragma solidity ^0.4.18;
interface PolicyContract {
/// Activate a policy
function registerPolicyStart(
bytes32 policyId,
address insured
) public returns (bool _success);
/// Record all premium payments
function registerPayment(
bytes32 policyId,
address payer,
address beneficiary,
uint256 unitsOfPayment,
address tokenAddress
) public returns (bool _success);
/// Since policies must be explicity in their claims outcomes
/// a user should be able to request an accurate claim payout
/// representation for a given scenario. Not entirely sure
/// how these 'coverageConditions' and 'outcomes' should be
/// structured
function getExpectedClaimValue(
bytes32 policyId,
bytes32 coverageCondition,
bytes32 outcome,
uint256 timestamp
) public view returns (uint256);
/// Should be easy to determine: length * premium payment
function getExpectedPremiumAccrued(
bytes32 policyId,
uint256 timestamp
) public view returns (uint256);
/// Lookup payment history, can be used to determine whether
/// a policy is up to date on payments
function getPremiumPaidToDate(
bytes32 policyId
) public view returns (uint256);
function getPolicyEndTimestamp(
bytes32 _policyId
) public view returns (uint);
/// details of claim submission get stored on-chain in claims registry
/// Claims registry must track and record every execution of claim
function registerClaim(
bytes32 policyId,
bytes32 coverageCondition,
bytes32 outcome,
address reporter
) public view returns (uint);
/// you could potentially have different oracles for each coverage condition
function getOracle(
bytes32 coverageCondition
) public view returns (address);
/// Triggering value for coverage condition should be known
function getTriggerOutcome(
bytes32 coverageCondition
) public view returns (bytes32);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment