This tutorial guides you through the process of integrating your application with the PropChain decentralized insurance platform.
- Access to a Substrate-based network with PropChain contracts deployed.
- Familiarity with the
PropertyInsurancecontract API. - A property already registered in the
PropertyTokencontract.
Before creating a policy, you should calculate the expected premium for the property.
// Parameters: property_id, coverage_amount, coverage_type
let premium_calc = insurance.calculate_premium(
property_id,
500000, // $500,000 coverage
CoverageType::Comprehensive
)?;
println!("Estimated Premium: ${}", premium_calc.premium_amount);
println!("Deductible: ${}", premium_calc.deductible);Insurance policies are backed by risk pools. You must select an appropriate pool for your coverage type.
// List available risk pools for Comprehensive coverage
let pools = insurance.get_pools_by_coverage(CoverageType::Comprehensive);
let pool_id = pools[0].id;Once the premium is calculated and a pool is selected, you can issue the policy.
let policy_id = insurance.create_policy(
property_id,
CoverageType::Comprehensive,
500000,
pool_id,
31536000, // 1 year in seconds
"ipfs://Qm...metadata"
)?;Note: The user must have sufficient balance to pay the premium_amount.
In the event of a covered loss, a claim can be submitted for the policy.
let claim_id = insurance.submit_claim(
policy_id,
10000, // Claim amount: $10,000
"Fire damage in the kitchen",
"ipfs://Qm...incident_report"
)?;Claims go through an assessment process (managed by automated oracles or authorized assessors). Once approved, the payout is processed automatically.
// Monitor claim status
let claim = insurance.get_claim(claim_id).unwrap();
match claim.status {
ClaimStatus::Approved => println!("Claim approved, payout incoming!"),
ClaimStatus::Rejected => println!("Claim rejected: {}", claim.rejection_reason),
_ => println!("Claim pending assessment"),
}Users can also participate as liquidity providers for risk pools to earn premiums.
// Deposit 10,000 tokens into the risk pool
insurance.provide_pool_liquidity(pool_id, 10000)?;- Always verify the
PropertyValuationbefore setting coverage amounts. - Ensure the policy duration aligns with the property's legal registration period.
- Regularly monitor
ClaimSubmittedevents for real-time tracking.