A decentralized marketplace built on StarkNet using Cairo 1.0, allowing product management, purchases with ERC20 tokens, and order tracking.
- Create, update, and delete products
- Product details include name, price, stock, description, category, and image
- Prevent duplicate product names
- Track product inventory
- Owner: Full control over the marketplace
- Admins: Can manage products
- Buyers: Can purchase products
- Multi-product purchases in a single transaction
- Order history tracking
- Detailed order items tracking
- Total sales tracking
- ERC20 token integration for payments
- Secure fund withdrawal mechanism
- Balance checking before purchases
src/
├── contracts/
│ └── super_market.cairo # Main contract implementation
├── events/
│ └── super_market_event.cairo # Event definitions
├── interfaces/
│ └── ISuper_market.cairo # Contract interface
└── lib.cairo # Library entry point
tests/
Product: Stores product informationPurchaseItem: Handles purchase requestsOrder: Tracks purchase historyOrderItem: Stores individual items in orders
transfer_ownership: Transfer contract ownershipadd_admin: Add new adminremove_admin: Remove existing adminis_admin: Check admin status
add_product: Create new productupdate_product: Modify existing productdelete_product: Remove productget_products: Retrieve all products
buy_product: Purchase multiple productsget_order_items: Retrieve order detailsget_all_orders: Get all orders (admin only)get_total_sales: Get total sales amount
withdraw_funds: Withdraw contract balance
- Scarb
- StarkNet Foundry
- Clone the repository
- Install dependencies:
scarb installRun the tests using:
scarb testFor detailed deployment instructions, see the Deployment Guide.
- Role-based access control
- Stock validation
- Payment validation
- Duplicate product prevention
- Safe fund withdrawal
This project is licensed under the MIT License - see the LICENSE file for details.