Skip to content

Add a contract entrypoint returning an investor's stacked-insurance coverage breakdown per policy #1734

Description

@Baskarayelu

📋 Description

investment.rs tracks insurance policies and exposes total_active_coverage_percentage and has_active_insurance, but there is no read returning a per-policy breakdown (provider, coverage bps, premium, active flag) for a given investment. Clients can only see the aggregate.

Why this matters: when coverage is stacked across providers, users need to see the constituent policies — who covers what and at what premium. A per-policy breakdown read makes stacked insurance transparent. Read-only and self-contained.

🎯 Requirements & Context

  • Add get_insurance_breakdown(env, investment_id) -> Vec<(Address, u32, i128, bool)> (provider, coverage_bps, premium, active).
  • Return an empty vec for investments with no insurance.
  • Derive from the stored policies; do not change total_active_coverage_percentage.
  • Add /// doc comments.

Context & constraints

🛠️ Suggested Execution

git checkout -b feature/insurance-breakdown-query
cargo test -p quicklendx-contracts insurance_breakdown -- --nocapture
cargo clippy -p quicklendx-contracts --all-targets -- -D warnings
  • Edge cases: no policies (empty); single policy; multiple stacked policies (order stable); claimed/inactive policy flagged.

Example commit message

feat(insurance): add per-policy get_insurance_breakdown read

Surfaces provider/coverage/premium/active per policy so stacked coverage is
transparent.

✅ Acceptance Criteria & Guidelines

Requirement Target
Per-policy breakdown from stored data Required
Empty vec for no insurance Required
Test coverage ≥ 95%
cargo clippy clean Required
Timeframe 96 hours from assignment

💬 Community & Support

Join Discord: https://discord.gg/VpngvTjWa — comment to claim. 🚀

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions