Skip to content

[Contract] — Feature: Add cancel_event entrypoint (creator-only) #1019

Description

@Olowodarey

Background

The Event struct already has cancel() method, is_cancelled: bool field,
and several downstream functions (e.g. create_match, join_event) guard
against cancelled events. The error code EventError::EventCancelled is also
defined.

Goal

Add cancel_event(env, caller, event_id) that marks an event as cancelled
(only the event creator may do this, only before finalization).

Tasks

  1. Add EventError::AlreadyFinalized (if not already present) and
  2. Add pub fn cancel_event(env: &Env, caller: Address, event_id: u64) -> Result<(), EventError> in src/event.rs:
  3. Wire into lib.rs:
  4. Add tests in a new tests/cancel_event_tests.rs:

Acceptance Criteria

  • Only the event creator can cancel; cancellation is irreversible.
  • Cancelled events block joins, match creation, and predictions.
  • A contract event ("event", "cancelled") is emitted on success.

Files

contracts/creator-event-manager/src/event.rs,
contracts/creator-event-manager/src/lib.rs,
contracts/creator-event-manager/tests/cancel_event_tests.rs,

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions