Skip to content

[CT-08] Add insurance tracking to shipment contract #916

@mftee

Description

@mftee

Problem

Whether a shipment is insured is tracked only in the PostgreSQL database. The Soroban blockchain has no record of insurance status, so on-chain escrow dispute and refund decisions cannot reference insurance — the two systems are completely decoupled with no shared truth.

Proposed Solution

Add insurance metadata to a new shipment contract inside contracts/package/shipment-insurance/ so that insurance status is provably recorded on-chain and accessible to other contracts.

Note: All work must be done inside the contracts/package/ directory. Do not modify any existing contract files outside this folder.

Acceptance Criteria

  • create_shipment accepts is_insured: bool, insurance_premium: i128, and insurance_policy_id: String
  • get_insurance_status(shipment_id) returns { is_insured, premium, policy_id }
  • When a dispute is opened on an insured shipment, the contract emits an InsuranceClaim event with the policy ID
  • Uninsured shipments store is_insured: false and zero values for premium and policy ID
  • insurance_policy_id maximum length is 64 characters; longer values return PolicyIdTooLong error
  • Unit tests cover: insured shipment creation, uninsured shipment creation, dispute event on insured shipment

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions