-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat-System leaderboard #104
feat-System leaderboard #104
Conversation
WalkthroughThe pull request introduces a new leaderboard system for a blockchain application, encapsulated in a JSON ABI file and a corresponding TOML configuration file. The JSON file defines multiple interfaces and structs, including Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@KevinMB0220 fix the github actions, you have to run sozo build, sozo test and finally sozo build |
📝 Pull Request Overview
Implements Leaderboard System in Cairo
Closes: Implement leaderboard system and functions #28 (reemplaza con el enlace al issue si corresponde)
🔄 Changes Made
Leaderboard System Creation
Leaderboard
system.create_leaderboard
: Initializes a leaderboard with attributes likename
,description
, andlast_updated
.add_entry
: Adds a new player entry to the leaderboard with details such asplayer_name
,score
,wins
, andlosses
.get_all_entries
: Retrieves all entries stored in the leaderboard.remove_entry
: Removes a player's entry from the leaderboard based onplayer_id
.update_entry
: Updates a player's stats in the leaderboard.calculate_score
: Computes the player's score based on predefined rules.get_slice
: Retrieves a segment of the leaderboard based on rank range (start
toend
).upgrade_entry_stats
: Updates a player's stats incrementally (e.g., adding new wins, losses, or highest scores).🔧 System Design
Data Models
Leaderboard
struct:leaderboard_id
: Unique identifier for the leaderboard.name
: Name of the leaderboard.description
: Description of the leaderboard's purpose.entries
: Array ofLeaderboardEntry
structs.last_updated
: Timestamp indicating the last update to the leaderboard.LeaderboardEntry
struct:player_id
: Unique identifier for the player.player_name
: Name of the player.score
: Calculated score of the player.wins
: Total wins.losses
: Total losses.highest_score
: Highest single-game score.is_active
: Boolean indicating if the player is active.🔬 Tests
Summary by CodeRabbit
New Features
Bug Fixes