feat: Implemented Openzeppelin ERC1155 sticker and also its community usage system to #37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📋 Overview
This PR implements the core foundation for the community sticker system, addressing both Issue #35 (Core Sticker Contract) and Issue #36 (Usage System & Limits). The implementation establishes a complete ERC1155-based sticker ecosystem with creation, management, and usage tracking capabilities.
🎯 Features Implemented
✅ Core Sticker Contract (#35)
ERC1155 Integration: Full OpenZeppelin ERC1155Component implementation for fungible sticker tokens
Sticker Creation: Open creation system with automatic token minting and unique ID generation
Metadata Management: Comprehensive on-chain storage for name, description, tags, category, creator, and content hash
Creator Tracking: Complete creator attribution system with immutable ownership records
Validation System: String length limits and non-empty checks for all metadata fields
Query Functions: Full suite of read operations including:
get_sticker_metadata() - Retrieve complete sticker details
get_stickers_by_creator() - List all stickers by creator address
get_total_sticker_count() - Global sticker counter
get_sticker_creation_timestamp() - Immutable creation timestamps
✅ Community Sticker Usage System (#36)
Daily Limit System: Configurable free usage limits (default: 10 uses/day)
Usage Tracking: Per-user daily usage counting with automatic daily resets
Payment Integration: Ready framework for excess usage payments (ERC20 integration ready)
Event System: Comprehensive events for usage, payments, and daily resets
Admin Controls: Configurable limits, costs, and treasury address management
🏗 Technical Architecture
Core Sticker Contract (StickerContract):
OpenZeppelin ERC1155Component with Ownable access control
Structured metadata storage with validation
Creator-to-sticker mapping system
Sequential ID generation with global counter
Usage System (CommunityStickerUsage):
Daily usage tracking with (user, day) tuple storage
Configurable limits and payment parameters
Event-driven architecture for monitoring
Admin-controlled configuration
📊 Storage Optimization
Efficient Metadata: Fixed-length string limits for gas optimization
Minimal Mapping: Optimized storage patterns for frequent read/write operations
Scalable Design: Support for unlimited stickers and users
🧪 Acceptance Criteria Met
####Issue #35 ✅
Users can create new community stickers with complete metadata
Each creation mints ERC1155 tokens automatically
Stickers retrievable by ID with full metadata
Creator can view all their created stickers
Accurate total sticker counting
Immutable content reference storage
Proper OpenZeppelin ERC1155Component integration
Correct event emission for all operations
Unique sequential sticker IDs
Immutable creator attribution
Metadata validation prevents invalid entries
Accurate immutable timestamps
Issue #36 ✅
Users can use stickers within daily limits
Accurate usage counting and incrementing
Proper daily limit enforcement
Automatic daily usage resets
Payment framework for excess usage
Reliable daily reset mechanism
Secure payment processing foundation
Efficient usage validation
Comprehensive event emission
🔗 Dependencies Resolved
Built on ERC1155 standard for multi-token functionality
Integrated with Ownable for admin controls
Prepared for ERC20 integration for payment processing
Full event system for external indexing
close #35 and
close #36