Overview
Invoice descriptions, attachments, and rich metadata cannot fit in contract storage cost-efficiently. Add a metadata_hash field to point to off-chain content (IPFS CID or SHA-256 hash) stored alongside the invoice.
Acceptance Criteria
InvoiceParams gains metadata_hash: Option<BytesN<32>>
- Hash stored in per-invoice persistent storage
get_invoice returns metadata_hash in the invoice struct
update_metadata_hash(invoice_id, new_hash: BytesN<32>) callable only by the creator; emits MetadataUpdated event
metadata_hash is optional — existing invoices without it return None
- Contract does NOT validate or fetch the off-chain content — hash is stored as-is
MetadataUpdated { invoice_id, old_hash, new_hash, ledger } event emitted on update
- Integration tests: create with hash, create without hash, update hash, verify stored value
Overview
Invoice descriptions, attachments, and rich metadata cannot fit in contract storage cost-efficiently. Add a
metadata_hashfield to point to off-chain content (IPFS CID or SHA-256 hash) stored alongside the invoice.Acceptance Criteria
InvoiceParamsgainsmetadata_hash: Option<BytesN<32>>get_invoicereturnsmetadata_hashin the invoice structupdate_metadata_hash(invoice_id, new_hash: BytesN<32>)callable only by the creator; emitsMetadataUpdatedeventmetadata_hashis optional — existing invoices without it returnNoneMetadataUpdated { invoice_id, old_hash, new_hash, ledger }event emitted on update