Skip to content

BHORBOR/complete-solidity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TrendCraft Asset Marketplace

A decentralized marketplace for digital design assets on the Stacks blockchain, enabling creators to tokenize and sell their creative work while maintaining ownership rights and earning royalties.

Overview

TrendCraft is a specialized marketplace built on the Stacks blockchain that allows designers and creators to:

  • List and sell digital assets (design templates, UI kits, 3D models)
  • Set custom pricing and royalty arrangements
  • Track market trends and popular design movements
  • Build reputation through a review system
  • Securely transfer asset ownership using STX tokens

Key features:

  • Customizable pricing and royalty structures
  • Trend tracking and analytics
  • Reputation and review system
  • Secure ownership transfer
  • Secondary market support

Architecture

The marketplace is built around a single core smart contract that handles all marketplace operations:

graph TD
    A[Creator] -->|Create Listing| B[Marketplace Contract]
    C[Buyer] -->|Purchase Asset| B
    B -->|Record Sale| D[Ownership History]
    B -->|Update Trends| E[Category Trends]
    C -->|Submit Review| F[Review System]
    B -->|Calculate Fees| G[Payment Distribution]
    G -->|Platform Fee| H[Contract Owner]
    G -->|Payment| A
    B -->|Secondary Sale| I[Royalty Distribution]
Loading

Core Components:

  1. Listing Management: Creation, updating, and removal of asset listings
  2. Purchase System: Secure buying process with automatic fee distribution
  3. Ownership Tracking: Historical record of asset ownership
  4. Review System: Buyer feedback and rating mechanism
  5. Trend Analysis: Purchase tracking by category and time period

Contract Documentation

TrendCraft Marketplace Contract

The main contract (trendcraft-marketplace.clar) manages all marketplace operations.

Key Features

  • Listing Management

    • Create, update, and remove listings
    • Set prices and royalty percentages
    • Store asset metadata and URLs
  • Purchase Processing

    • Handle secure transactions
    • Distribute platform fees
    • Record ownership changes
    • Update trend data
  • Review System

    • Submit and store reviews
    • Track review status
    • Limit one review per purchase

Access Control

  • Only listing creators can modify their listings
  • Only buyers can submit reviews for purchased assets
  • Platform fees are sent to the contract owner
  • Maximum royalty percentage is capped at 15%

Getting Started

Prerequisites

  • Clarinet
  • Stacks wallet
  • STX tokens for transactions

Basic Usage

  1. Creating a Listing
(contract-call? .trendcraft-marketplace create-listing 
    "My Design Template"
    "A professional design template"
    u1000000 ;; Price in µSTX
    "templates"
    "preview-url"
    "full-asset-url"
    u10 ;; 10% royalty
)
  1. Purchasing an Asset
(contract-call? .trendcraft-marketplace purchase-asset u1)
  1. Submitting a Review
(contract-call? .trendcraft-marketplace submit-review 
    u1 ;; listing-id
    u5 ;; score
    "Great asset!"
)

Function Reference

Public Functions

Listing Management

(create-listing (title (string-ascii 100)) 
                (description (string-utf8 500)) 
                (price uint) 
                (category (string-ascii 50))
                (preview-url (string-utf8 200))
                (full-asset-url (string-utf8 200))
                (royalty-percent uint))

(update-listing (listing-id uint) ...)
(remove-listing (listing-id uint))

Transaction Functions

(purchase-asset (listing-id uint))
(resell-asset (listing-id uint) (new-price uint))

Review System

(submit-review (listing-id uint) (score uint) (comment (string-utf8 300)))

Read-Only Functions

(get-listing (listing-id uint))
(has-purchased (listing-id uint) (user principal))
(get-review (listing-id uint) (reviewer principal))
(get-category-trend (category (string-ascii 50)) (month-year (string-ascii 7)))
(get-ownership-history (listing-id uint) (index uint))

Development

Testing

  1. Install Clarinet
  2. Clone the repository
  3. Run tests:
clarinet test

Local Development

  1. Start Clarinet console:
clarinet console
  1. Deploy contract:
(contract-call? .trendcraft-marketplace ...)

Security Considerations

Limitations

  • Asset URLs are stored on-chain as strings
  • Trend analysis is based on block height for time approximation
  • Review scores are limited to 0-5 range

Best Practices

  • Verify asset ownership before reselling
  • Check listing status before purchasing
  • Keep sufficient STX for platform fees
  • Review asset details and seller reputation before purchasing
  • Ensure listing prices are set in µSTX (multiply by 1,000,000)

About

no description

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors