Skip to content

suzanabel/Augmented-Reality-Experiences

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

AR Experiences Smart Contract

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.

Features

Core Functionality

  • 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

Advanced Features

  • 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

Contract Functions

Public Functions

Experience Management

  • create-ar-experience(title, description, category, price, metadata-uri) - Create a new AR experience
  • toggle-experience-status(experience-id) - Activate/deactivate an experience (creator only)

Marketplace

  • purchase-experience(experience-id) - Purchase access to an AR experience
  • rate-experience(experience-id, rating, review) - Rate and review a purchased experience

Profile Management

  • update-creator-profile(display-name, bio) - Update creator profile information

Admin Functions

  • verify-creator(creator) - Verify a creator (admin only)
  • set-platform-fee(new-fee) - Set platform fee percentage (admin only, max 20%)

Read-Only Functions

  • get-experience(experience-id) - Get experience details
  • get-user-purchase(user, experience-id) - Check purchase status
  • get-experience-rating(user, experience-id) - Get user's rating for an experience
  • get-creator-profile(creator) - Get creator profile information
  • has-access(user, experience-id) - Check if user has access to an experience
  • get-experience-stats(experience-id) - Get experience statistics

Error Codes

  • u100 - Owner only operation
  • u101 - Experience/resource not found
  • u102 - Unauthorized access
  • u103 - Resource already exists
  • u104 - Insufficient payment
  • u105 - Invalid rating (must be 1-5)
  • u106 - Invalid input parameters

Usage Examples

Creating an AR Experience

(contract-call? .ar-experiences create-ar-experience 
  "Virtual Museum Tour" 
  "Explore ancient artifacts in AR" 
  "Education" 
  u1000000 
  "ipfs://QmHash...")

Purchasing an Experience

(contract-call? .ar-experiences purchase-experience u1)

Rating an Experience

(contract-call? .ar-experiences rate-experience u1 u5 "Amazing experience!")

Data Structure

AR Experience

  • Creator principal
  • Title, description, category
  • Price in microSTX
  • Metadata URI (IPFS/Arweave)
  • Creation timestamp
  • Activity status
  • Download count and ratings

User Purchase

  • Purchase timestamp
  • Access granted status

Creator Profile

  • Display name and bio
  • Total experiences created
  • Total earnings
  • Verification status

Security Features

  • 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

Deployment

  1. Deploy the contract to Stacks blockchain
  2. The deployer becomes the contract owner
  3. Set initial platform fee if different from 5%
  4. Contract is ready for creators to publish AR experiences

About

The AR Experiences Smart Contract is a comprehensive Clarity-based marketplace solution designed for the Stacks blockchain that enables creators to monetize and distribute Augmented Reality experiences while providing users with a secure platform to discover, purchase, and interact with AR content.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors