feat(contracts): CT-05, CT-08, CT-10, CT-12 — document expiry, insurance, reputation tests, bulk registration#938
Open
A6dulmalik wants to merge 1 commit into
Conversation
CT-05 (document-registry): Add document expiry support with optional expires_at timestamp, is_valid() query, get_document_status() returning Active/Expired/Revoked, and revoke_document(). Expired records preserved for audit. CT-08 (shipment-insurance): Add on-chain insurance metadata to shipments with is_insured, insurance_premium, insurance_policy_id fields. Emits InsuranceClaim event on dispute for insured shipments. Policy ID capped at 64 chars (PolicyIdTooLong error). CT-10 (tests/reputation): Comprehensive test suite for the reputation contract covering add_rating (scores 1-5 valid, 0/6 invalid), composite score with known expected values, duplicate rating rollback, get_reputation breakdown, and update_stats on-time percentage. CT-12 (document-bulk): Atomic batch document registration up to 10 docs. Returns BatchLimitExceeded if >10, HashAlreadyRegistered on any duplicate (including within-batch). Full rollback if any validation fails.
|
@A6dulmalik is attempting to deploy a commit to the Mftee's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@A6dulmalik Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements four Stellar smart contract issues assigned to A6dulmalik. All contracts are in
contracts/package/and follow the existing codebase patterns (#![no_std], soroban-sdk 22.0.0, persistent storage with TTL_LEDGERS=6_307_200).CT-05 — Document Registry with Expiry (
contracts/package/document-registry/)register_documentaccepts optionalexpires_at: Option<u64>(Unix timestamp)is_valid(doc_id)returnsfalseif pastexpires_ator revokedget_document_status(doc_id)returnsActive,Expired, orRevokedexpires_atare permanently valid unless revokedCT-08 — Shipment Insurance Tracking (
contracts/package/shipment-insurance/)create_shipmentacceptsis_insured: bool,insurance_premium: i128,insurance_policy_id: Stringget_insurance_status(shipment_id)returns{ is_insured, premium, policy_id }open_disputeemitsInsuranceClaimevent with policy ID when shipment is insuredis_insured: falseand zero valuesinsurance_policy_idmax 64 chars; longer returnsPolicyIdTooLongCT-10 — Reputation Contract Test Suite (
contracts/package/tests/reputation/)add_rating: scores 1–5 succeed; scores 0 and 6 returnInvalidScoreDuplicateRatingget_reputation: verifies all three score components (rating, on-time, completion)update_stats: on-time percentage updates correctly; unauthorized caller failsCT-12 — Bulk Document Registration (
contracts/package/document-bulk/)register_documents_batch(docs: Vec<DocumentEntry>)whereDocumentEntry = { hash, doc_type, ipfs_cid, expires_at }BatchLimitExceededHashAlreadyRegisteredVec<BytesN<32>>— the list of document IDs (hashes) createdCloses #913
Closes #916
Closes #918
Closes #920