A comprehensive Clarity smart contract for managing Augmented Reality experiences on the Stacks blockchain. This contract enables creators to publish AR experiences, users to purchase and rate them, and provides a complete marketplace ecosystem.
- Experience Creation: Creators can publish AR experiences with metadata, pricing, and categorization
- Marketplace: Users can discover and purchase AR experiences using STX tokens
- Rating System: 5-star rating system with written reviews for purchased experiences
- Creator Profiles: Display names, bios, earnings tracking, and verification status
- Access Control: Secure ownership and permission management
- Dynamic Pricing: Flexible pricing per experience (including free experiences)
- Platform Fees: Configurable percentage-based platform fees (default 5%)
- Statistics Tracking: Download counts, average ratings, and earnings analytics
- Status Management: Creators can activate/deactivate their experiences
- Admin Controls: Contract owner can verify creators and manage platform settings
create-ar-experience(title, description, category, price, metadata-uri)- Create a new AR experiencetoggle-experience-status(experience-id)- Activate/deactivate an experience (creator only)
purchase-experience(experience-id)- Purchase access to an AR experiencerate-experience(experience-id, rating, review)- Rate and review a purchased experience
update-creator-profile(display-name, bio)- Update creator profile information
verify-creator(creator)- Verify a creator (admin only)set-platform-fee(new-fee)- Set platform fee percentage (admin only, max 20%)
get-experience(experience-id)- Get experience detailsget-user-purchase(user, experience-id)- Check purchase statusget-experience-rating(user, experience-id)- Get user's rating for an experienceget-creator-profile(creator)- Get creator profile informationhas-access(user, experience-id)- Check if user has access to an experienceget-experience-stats(experience-id)- Get experience statistics
u100- Owner only operationu101- Experience/resource not foundu102- Unauthorized accessu103- Resource already existsu104- Insufficient paymentu105- Invalid rating (must be 1-5)u106- Invalid input parameters
(contract-call? .ar-experiences create-ar-experience
"Virtual Museum Tour"
"Explore ancient artifacts in AR"
"Education"
u1000000
"ipfs://QmHash...")
(contract-call? .ar-experiences purchase-experience u1)
(contract-call? .ar-experiences rate-experience u1 u5 "Amazing experience!")
- Creator principal
- Title, description, category
- Price in microSTX
- Metadata URI (IPFS/Arweave)
- Creation timestamp
- Activity status
- Download count and ratings
- Purchase timestamp
- Access granted status
- Display name and bio
- Total experiences created
- Total earnings
- Verification status
- Input Validation: All user inputs are validated for type, length, and range
- Access Control: Function-level permissions and ownership checks
- Safe Arithmetic: Protected against overflow/underflow
- Transfer Safety: Proper STX transfer error handling
- Deploy the contract to Stacks blockchain
- The deployer becomes the contract owner
- Set initial platform fee if different from 5%
- Contract is ready for creators to publish AR experiences