Target Contract: reputation-scoring-contract
Labels: phase-3-reputation, core-logic, cross-contract
Description: The core module function. A user submits a 1-5 star review. This issue handles bounding, cross-contract payment verification, spam prevention, and state updates.
Tasks:
src/types.rs: Define ExpertStats { total_score: u64, total_reviews: u64 }.
src/error.rs: Add InvalidScore = 4, InvalidBookingState = 5, UserMismatch = 6, AlreadyReviewed = 7.
src/storage.rs: Map DataKey::ExpertStats(Address) -> ExpertStats and DataKey::ReviewExists(u64) -> bool.
src/contract.rs: Implement submit_review(env, user, expert, booking_id, score: u32, review_uri: String).
- Require user.require_auth(). Check score >= 1 && score <= 5.
- Assert !storage::is_paused().
- Cross-Contract: Invoke Vault's get_booking. Assert status is Complete, and addresses match.
- Spam Check: Assert ReviewExists(booking_id) is false. Flag it as true.
- State Update: Add score to total_score, increment total_reviews.
src/events.rs: Implement review_submitted(expert, user, booking_id, score, review_uri).
src/lib.rs: Expose submit_review and get_expert_stats.
src/test.rs: Mock Vault. Test success path, invalid score failure, and duplicate review panic.
Acceptance Criteria:
- Immutable, verified, and spam-resistant review logic is fully operational.
Target Contract: reputation-scoring-contract
Labels: phase-3-reputation, core-logic, cross-contract
Description: The core module function. A user submits a 1-5 star review. This issue handles bounding, cross-contract payment verification, spam prevention, and state updates.
Tasks:
src/types.rs: Define ExpertStats { total_score: u64, total_reviews: u64 }.src/error.rs: Add InvalidScore = 4, InvalidBookingState = 5, UserMismatch = 6, AlreadyReviewed = 7.src/storage.rs: Map DataKey::ExpertStats(Address) -> ExpertStats and DataKey::ReviewExists(u64) -> bool.src/contract.rs: Implement submit_review(env, user, expert, booking_id, score: u32, review_uri: String).src/events.rs: Implement review_submitted(expert, user, booking_id, score, review_uri).src/lib.rs: Expose submit_review and get_expert_stats.src/test.rs: Mock Vault. Test success path, invalid score failure, and duplicate review panic.Acceptance Criteria: