-
Notifications
You must be signed in to change notification settings - Fork 95
Closed
Labels
ContractStellar WaveIssues in the Stellar wave programIssues in the Stellar wave programgood first issueGood for newcomersGood for newcomers
Description
Description:
Create the on-chain shipment tracking contract that mirrors the off-chain shipment lifecycle. This provides an immutable, decentralized audit trail for each shipment's status changes.
Create:
contracts/shipment/Cargo.tomlcontracts/shipment/src/lib.rs
Acceptance Criteria:
-
ShipmentStatusenum:Created,Accepted,InTransit,Delivered,Completed,Disputed,Cancelled -
Shipmentstruct with#[contracttype]:id: u64,shipper: Address,carrier: Option<Address>,status: ShipmentStatus,created_at: u64,updated_at: u64 -
DataKey:Shipment(u64),Counter,ShipperList(Address),CarrierList(Address) -
initialize(env, admin)— admin setup -
create_shipment(env, shipper: Address)—shipper.require_auth(), returns new shipment ID, appends to shipper list -
accept_shipment(env, shipment_id, carrier: Address)—carrier.require_auth(), sets carrier,Created → Accepted, appends to carrier list -
mark_in_transit(env, shipment_id, carrier: Address)— carrier only,Accepted → InTransit -
mark_delivered(env, shipment_id, carrier: Address)— carrier only,InTransit → Delivered -
confirm_delivery(env, shipment_id, shipper: Address)— shipper only,Delivered → Completed -
cancel_shipment(env, shipment_id, caller: Address)— caller must be shipper or carrier, only fromCreatedorAccepted -
raise_dispute(env, shipment_id, caller: Address)— party to shipment, fromInTransitorDelivered -
resolve_dispute(env, shipment_id, admin: Address, complete: bool)— admin only -
get_shipment(env, id),get_shipper_shipments(env, shipper),get_carrier_shipments(env, carrier) - All shipments extend TTL ~1 year on write
- 10 unit tests covering happy path + error cases
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ContractStellar WaveIssues in the Stellar wave programIssues in the Stellar wave programgood first issueGood for newcomersGood for newcomers