Skip to content

Comments

feat(contract): cancel mission state#50

Merged
Kaylahray merged 1 commit intoQuid-proquo:mainfrom
Josue19-08:feat/cancel-mission
Feb 20, 2026
Merged

feat(contract): cancel mission state#50
Kaylahray merged 1 commit intoQuid-proquo:mainfrom
Josue19-08:feat/cancel-mission

Conversation

@Josue19-08
Copy link
Contributor

@Josue19-08 Josue19-08 commented Feb 20, 2026

Summary

  • Implements cancel_mission(env: Env, id: u64) -> Result<(), QuidError> in the Quid Store contract
  • Adds InvalidState = 8 error variant to QuidError for the state validation constraint
  • A mission cannot be cancelled if its status is already Completed; returns QuidError::InvalidState in that case
  • Owner authentication is enforced via mission.owner.require_auth()

Changes

  • error.rs: Added InvalidState = 8 error variant
  • lib.rs: Implemented cancel_mission following the steps in the issue (load → auth → validate → update → save → return)
  • test.rs: Added 4 tests covering all acceptance criteria

Test plan

  • test_cancel_mission_success — status updates to Cancelled from Created
  • test_cancel_mission_fails_if_completed — panics with Error(Contract, #8) when already Completed
  • test_cancel_mission_from_started_status — can cancel from Started status
  • test_cancel_mission_not_found — panics with Error(Contract, #1) for unknown mission IDs
  • All 18 tests pass (cargo test)
  • WASM build succeeds (cargo build --target wasm32-unknown-unknown --release)

Closes #37

Add cancel_mission function that sets a mission status to Cancelled.
Validates that a Completed mission cannot be cancelled (returns InvalidState error).
Also adds the InvalidState error variant and 4 new tests covering all acceptance criteria.

Closes Quid-proquo#37

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Contributor

@Kaylahray Kaylahray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Josue19-08 , You did Great.

@Kaylahray Kaylahray merged commit 78d62f5 into Quid-proquo:main Feb 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contract] Implement cancel_mission Logic

2 participants