Skip to content

feat: Add-update_creation_fee#1073

Merged
Olowodarey merged 1 commit into
Arena1X:mainfrom
ONEONUORA:Add-update_creation_fee
Jun 23, 2026
Merged

feat: Add-update_creation_fee#1073
Olowodarey merged 1 commit into
Arena1X:mainfrom
ONEONUORA:Add-update_creation_fee

Conversation

@ONEONUORA

Copy link
Copy Markdown
Contributor

close #1031
close #1025
close #1022
close #1020

Summary of Changes

This PR implements several enhancements to the creator-event-manager contract:

1. Admin: Creation Fee Updates

  • Goal: Allow the contract admin to adjust the event creation fee stored under DataKey::CreationFee(0) post-deployment.
  • Implementation:
    • Added update_creation_fee(env, caller, new_fee) in src/admin.rs and wired it into src/lib.rs.
    • Enforces require_is_admin signature validation and rejects fees <= 0.
    • Emits an ("admin", "creation_fee_updated") event upon success.
  • Tests: Added tests in tests/admin_tests.rs for admin authorization, immediate update reflection via get_creation_fee(), and strictly positive fee validation.

2. Match: Retrieve Single Match by ID

  • Goal: Provide a way to fetch a single match by its globally unique match_id.
  • Implementation:
    • Implemented get_match(env, match_id) -> Match in src/match.rs and wired it into src/lib.rs.
    • Added MatchNotFound error code to MatchError.
    • Loads match details from DataKey::Match(match_id) and extends the TTL on each read.
  • Tests: Added tests in tests/match_tests.rs verifying successful match lookups, match_not_found panics, and storage TTL extension.

3. Prediction: Join Event Event Publication

  • Goal: Publish a contract event on a successful participant join.
  • Implementation:
    • Updated emit_user_joined in src/prediction.rs to publish a ("participant", "joined") event with the payload containing (event_id, user_address).
  • Tests: Added tests in tests/prediction_tests.rs asserting exactly one matching event is published on a successful join, and failed joins (e.g. invalid invite code) emit no event.

4. Views: check Event Finalized view

  • Goal: Provide a lightweight check to determine if an event is finalized without loading the full Event struct.
  • Implementation:
    • Added is_event_finalized(env, event_id) -> bool in src/views.rs and wired it into src/lib.rs to retrieve only the is_finalized flag.
  • Tests: Added tests in tests/views_tests.rs verifying view accuracy for active, cancelled, and finalized events, as well as event_not_found panic behavior.

Verification Status

All contract unit and integration tests compile and pass successfully:

  • Command: cargo test
  • Result: ok. 248 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.11s

@vercel

vercel Bot commented Jun 23, 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 23, 2026 8:23pm

@drips-wave

drips-wave Bot commented Jun 23, 2026

Copy link
Copy Markdown

@ONEONUORA 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

@Olowodarey Olowodarey merged commit 32db905 into Arena1X:main Jun 23, 2026
4 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

2 participants