Tier: 🟡 Medium
Description:
Create contracts/shipment/src/events.rs — the heart of the Hash-and-Emit pattern. This module contains helper functions that call env.events().publish() to emit structured events to the Stellar ledger.
Context:
In Navin's architecture, heavy data (GPS, sensor readings, metadata) is NOT stored on-chain. Instead, the contract emits events containing only the shipment_id, status, and a data_hash (SHA-256 of the full payload). The Express backend indexes these events, and the frontend verifies them directly against a Stellar RPC node.
Tasks:
emit_shipment_created(env, shipment_id, sender, receiver, data_hash)
emit_status_updated(env, shipment_id, old_status, new_status, data_hash)
emit_milestone_recorded(env, shipment_id, checkpoint, data_hash, reporter)
emit_escrow_deposited(env, shipment_id, from, amount)
emit_escrow_released(env, shipment_id, to, amount)
emit_dispute_raised(env, shipment_id, raised_by, reason_hash)
- Use
env.events().publish((topic_symbol,), data) with descriptive topic symbols
File locations:
- New file →
contracts/shipment/src/events.rs
Acceptance Criteria:
- All emit functions compile and use
env.events().publish()
- Topic symbols are descriptive (e.g.,
Symbol::new(env, "shipment_created"))
- Doc comments explaining what each event contains and who listens for it
PR Checklist:
Reference: Read CONTRIBUTING.md before starting.
⭐ Star the Navin repository — it helps the project grow!
Tier: 🟡 Medium
Description:
Create
contracts/shipment/src/events.rs— the heart of the Hash-and-Emit pattern. This module contains helper functions that callenv.events().publish()to emit structured events to the Stellar ledger.Context:
In Navin's architecture, heavy data (GPS, sensor readings, metadata) is NOT stored on-chain. Instead, the contract emits events containing only the
shipment_id,status, and adata_hash(SHA-256 of the full payload). The Express backend indexes these events, and the frontend verifies them directly against a Stellar RPC node.Tasks:
emit_shipment_created(env, shipment_id, sender, receiver, data_hash)emit_status_updated(env, shipment_id, old_status, new_status, data_hash)emit_milestone_recorded(env, shipment_id, checkpoint, data_hash, reporter)emit_escrow_deposited(env, shipment_id, from, amount)emit_escrow_released(env, shipment_id, to, amount)emit_dispute_raised(env, shipment_id, raised_by, reason_hash)env.events().publish((topic_symbol,), data)with descriptive topic symbolsFile locations:
contracts/shipment/src/events.rsAcceptance Criteria:
env.events().publish()Symbol::new(env, "shipment_created"))PR Checklist:
events.rscreated with all emit functionscargo fmt— no formatting issuescargo clippy --all-targets --all-features -- -D warnings— no warningscargo test— all tests passcargo build --target wasm32-unknown-unknown --release— WASM buildsReference: Read CONTRIBUTING.md before starting.