Skip to content

Feat/add create match entrypoint#973

Merged
Olowodarey merged 8 commits into
Arena1X:mainfrom
tech-adrian:feat/add-create-match-entrypoint
Jun 16, 2026
Merged

Feat/add create match entrypoint#973
Olowodarey merged 8 commits into
Arena1X:mainfrom
tech-adrian:feat/add-create-match-entrypoint

Conversation

@tech-adrian

Copy link
Copy Markdown
Contributor

Create Match Entrypoint Implementation (#964)

Summary

Added the critical missing create_match entrypoint that allows event creators to add football matches to their events. This completes the contract's match management functionality.

Changes

  • src/match.rs: New MatchError enum with 6 error variants and core create_match implementation with full validation flow
  • src/lib.rs: Exposed create_match and list_event_matches as contract entrypoints with proper error-to-panic mapping
  • tests/match_tests.rs: 9 comprehensive test cases covering success path, all error conditions, and sorting behavior

Implementation Details

  • Authorization required (caller.require_auth())
  • Contract pause check
  • Event existence and cancellation validation
  • Creator-only permission enforcement
  • Team name validation (non-empty, ≤100 chars, different names)
  • Match time validation (must be in future)
  • Atomic match creation with event counter increment and indexing
  • Event emission with (match_id, event_id, team_a, team_b, match_time)
  • Matches returned from list_event_matches sorted by match_time (ascending)

Tests Passing

All 12 match tests pass, including edge cases for authorization, validation, and sorting.

Closes

#964

- test_create_match_success: creator can add matches; match_count increments and list works
- test_create_match_unauthorized: non-creator cannot add matches
- test_create_match_event_not_found: error handling for missing events
- test_create_match_event_cancelled: cannot add matches to cancelled events
- test_create_match_invalid_team_names_empty: rejects empty team names
- test_create_match_invalid_team_names_too_long: rejects names exceeding MAX_TEAM_NAME_LEN
- test_create_match_invalid_team_names_identical: rejects identical team names
- test_create_match_past_time_rejected: rejects non-future match times
- test_create_multiple_matches_sorted_by_time: verifies matches are sorted by match_time in list
@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
insight-arena-4rll Ready Ready Preview, Comment Jun 16, 2026 3:42pm

@tech-adrian

Copy link
Copy Markdown
Contributor Author

@Olowodarey please review

@Olowodarey

Copy link
Copy Markdown
Collaborator

@tech-adrian well done but you are yet too add tests pls check issues discription

@tech-adrian

Copy link
Copy Markdown
Contributor Author

@tech-adrian well done but you are yet too add tests pls check issues discription

done tests added

@Olowodarey

Copy link
Copy Markdown
Collaborator

@tech-adrian clean job welldone for your effort thank you

@Olowodarey Olowodarey merged commit cd8b40f into Arena1X:main Jun 16, 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.

2 participants