A decentralized gaming platform built on Stacks blockchain that manages game assets (NFTs), player registration, leaderboard tracking, and reward distribution.
- NFT Game Assets: Mint and transfer unique in-game items
- Player Management: Registration and score tracking
- Leaderboard System: Track player performance
- Reward Distribution: Automated reward calculations based on player scores
- Administrative Controls: Secure admin management system
- Unique identifiers for in-game items
- Metadata storage including:
- Name (max 50 characters)
- Description (max 200 characters)
- Rarity level
- Power level (0-1000)
- Registration with entry fee
- Score tracking
- Games played counter
- Total rewards earned
- Leaderboard position
- Admin whitelist system
- Game configuration management
- Asset minting controls
- Score update authorization
- Adds a new administrator to the whitelist
- Requires existing admin authorization
- Parameters:
new-admin: Principal to be added as admin
- Sets up game parameters
- Parameters:
entry-fee: Cost to register (1-1000)max-entries: Maximum leaderboard entries (1-500)
- Creates new game NFT
- Parameters:
name: Asset namedescription: Asset descriptionrarity: Rarity levelpower-level: Power rating (0-1000)
- Transfers NFT ownership
- Parameters:
token-id: Asset identifierrecipient: New owner's principal
- Registers new player
- Requires entry fee payment
- Initializes player statistics
- Updates player's score
- Parameters:
player: Player's principalnew-score: Updated score (0-10000)
- Distributes rewards to eligible players
- Automated calculation based on scores
- Minimum score requirement: 100
- Reward formula: score × 10
| Code | Description |
|---|---|
| u1 | Not authorized |
| u2 | Invalid game asset |
| u3 | Insufficient funds |
| u4 | Transfer failed |
| u5 | Leaderboard full |
| u6 | Already registered |
| u7 | Invalid reward |
| u8 | Invalid input |
| u9 | Invalid score |
| u10 | Invalid fee |
| u11 | Invalid entries |
| u12 | Player not found |
- Role-based administration
- Secure principal validation
- Transaction authorization checks
- Ownership verification for transfers
- Safe principal validation
- Input validation for all operations
- Balance checks for transactions
- Secure reward distribution
- Protected prize pool management
-
Administrative Access
- Only authorized admins can perform privileged operations
- Admin additions require existing admin approval
-
Asset Management
- Verify ownership before transfers
- Validate all metadata inputs
- Maintain asset uniqueness
-
Player Operations
- Validate registration requirements
- Ensure score updates are authorized
- Protect player statistics
-
Reward Distribution
- Verify eligibility before rewards
- Secure calculation process
- Safe distribution mechanism
- Language: Clarity
- Platform: Stacks Blockchain
- Token Standard: NFT
- Storage: Map-based data structure
- Access Control: Principal-based
- The contract uses map structures for efficient data storage
- NFT implementation follows standard token patterns
- Modular design allows for future expansions
- Built-in safety checks prevent common vulnerabilities
- Clear separation of administrative and user functions