Problem Statement
contracts/insurance/src/lib.rs mixes premium calculation, claim evidence handling, fraud detection, risk assessment, Sybil heuristics, premium property tests, and lazy reinsurance in one ~3300-line file.
Why it matters
Insurance has the highest gas surface and audit complexity in the workspace; the monolith blocks unit-level coverage targets and complicates independent verifier reviews.
Technical Context
mod premium_engine — premium math.
mod claim_pipeline — claim submission + evidence.
mod fraud_detection — fraud heuristics.
mod risk_assessment — risk scoring.
mod sybil_defense — anti-Sybil mapping.
mod lazy_reinsurance — quarterly reinsurance lookups.
Expected Outcome
- Each sub-module has its own message group.
- Sub-modules are randomly accessible via
contract.feature_x() calls.
- Public API surface unchanged.
- Storage layout preserved or migrated via documented mapping.
Acceptance Criteria
- Every existing
#[ink::test] continues to pass.
- Each sub-module independently exports at least one message.
cargo doc --no-deps renders an unambiguous doc-tree.
cargo clippy reduces warnings materially (target: ≥ 30 fewer).
Implementation Notes
Split by message-level boundaries: each sub-module owns its storage map and re-exports. Use storage::Mapping::default() defaults for non-init constructors.
Files or modules likely to be affected
contracts/insurance/src/lib.rs, new split files.
Dependencies
#3 (do the same for property-management first to learn).
Difficulty level
HARD.
Estimated effort
XL (~3 engineer-weeks).
Problem Statement
contracts/insurance/src/lib.rsmixes premium calculation, claim evidence handling, fraud detection, risk assessment, Sybil heuristics, premium property tests, and lazy reinsurance in one ~3300-line file.Why it matters
Insurance has the highest gas surface and audit complexity in the workspace; the monolith blocks unit-level coverage targets and complicates independent verifier reviews.
Technical Context
mod premium_engine— premium math.mod claim_pipeline— claim submission + evidence.mod fraud_detection— fraud heuristics.mod risk_assessment— risk scoring.mod sybil_defense— anti-Sybil mapping.mod lazy_reinsurance— quarterly reinsurance lookups.Expected Outcome
contract.feature_x()calls.Acceptance Criteria
#[ink::test]continues to pass.cargo doc --no-depsrenders an unambiguous doc-tree.cargo clippyreduces warnings materially (target: ≥ 30 fewer).Implementation Notes
Split by message-level boundaries: each sub-module owns its
storagemap and re-exports. Usestorage::Mapping::default()defaults for non-init constructors.Files or modules likely to be affected
contracts/insurance/src/lib.rs, new split files.Dependencies
#3 (do the same for property-management first to learn).
Difficulty level
HARD.
Estimated effort
XL (~3 engineer-weeks).