Skip to content

fix: Event Attendance Check-In NFT - #412

Open
Muyideen-js wants to merge 1 commit into
MindFlowInteractive:mainfrom
Muyideen-js:solver/issue-387-3-a1
Open

Muyideen-js wants to merge 1 commit into
MindFlowInteractive:mainfrom
Muyideen-js:solver/issue-387-3-a1

Conversation

@Muyideen-js

Copy link
Copy Markdown

Summary

Implemented the contracts/attendance_nft Soroban smart contract as required by issue #387.

New files added:

  • contracts/attendance_nft/Cargo.toml – package manifest following workspace conventions (cdylib + rlib, workspace soroban-sdk dep, testutils feature).
  • contracts/attendance_nft/src/lib.rs – full contract implementation.
  • contracts/attendance_nft/src/test.rs – comprehensive unit tests.

Cargo.toml (workspace root) – added "contracts/attendance_nft" to the members list.

Contract design:

Feature Implementation
Event creation with check-in window create_event(name, window_start, window_end) -> event_id; validates window_start < window_end; restricted to admin via require_auth.
Check-in during the window check_in(player, event_id) -> token_id; reads ledger timestamp; panics if outside [window_start, window_end].
Non-transferable attendance token AttendanceToken struct (soulbound). transfer() always panics with "Attendance tokens cannot be transferred".
Prevent double check-in DataKey::CheckedIn(Address, u32) persisted guard; panics "Already checked in" on second attempt.
Restrict event creation to organizers admin.require_auth() before any state mutation in create_event.
Unit tests 15 tests covering initialization, event creation, check-in happy-paths, window enforcement (before/after), double check-in prevention, multi-player, non-transferability, and edge cases.

Changed files

  • Cargo.toml
  • contracts/attendance_nft/Cargo.toml
  • contracts/attendance_nft/src/lib.rs
  • contracts/attendance_nft/src/test.rs

Test plan

Run from the workspace root (or inside contracts/attendance_nft):

cargo test -p attendance-nft

Expected passing tests:

  • test_initialize_succeeds
  • test_double_initialize_panics (#[should_panic])
  • test_create_event_returns_incrementing_ids
  • test_get_event_returns_correct_metadata
  • test_create_event_invalid_window_panics (#[should_panic])
  • test_create_event_requires_admin_auth (#[should_panic])
  • test_checkin_inside_window_mints_token
  • test_checkin_records_guard_flag
  • test_tokens_of_returns_all_owned_tokens
  • test_multiple_players_same_event
  • test_checkin_before_window_panics (#[should_panic])
  • test_checkin_after_window_panics (#[should_panic])
  • test_double_checkin_same_event_panics (#[should_panic])
  • test_same_player_can_attend_different_events
  • test_transfer_always_panics (#[should_panic])
  • test_checkin_unknown_event_panics (#[should_panic])
  • test_get_event_nonexistent_returns_none
  • test_get_token_nonexistent_returns_none

This PR was created as a draft by the issue solver bot. It will remain a
draft until repository CI passes.

Closes #387

@drips-wave

drips-wave Bot commented Nov 21, 2026

Copy link
Copy Markdown

@Muyideen-js 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! 🚀

Learn more about application limits

@Muyideen-js
Muyideen-js marked this pull request as ready for review November 21, 2026 15:02
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.

Event Attendance Check-In NFT

2 participants