Skip to content

Add Market Component with Listing Management#33

Merged
codebestia merged 5 commits intomainfrom
feat/offer-and-listing
Aug 8, 2025
Merged

Add Market Component with Listing Management#33
codebestia merged 5 commits intomainfrom
feat/offer-and-listing

Conversation

@codebestia
Copy link
Contributor

📋 Summary

This PR introduces a comprehensive market component system for the Trajectfi Starknet project, enabling NFT listing and management functionality. The changes establish the foundation for a decentralized marketplace where users can list their NFTs for lending.

🚀 Key Changes

New Components Added

  • Market Component (src/components/market.cairo): Core marketplace functionality with listing management
  • Market Interface (src/interfaces/imarket.cairo): Defines the contract interface for market operations

Data Structures

  • Listing Struct (src/types.cairo): Comprehensive data structure for marketplace listings including:
    • NFT contract and token ID
    • Token contract and amount details
    • Borrow/repayment amounts for lending
    • Loan duration and status tracking
    • Timestamp management

Core Functionality

  • Listing Management: Create, close, and query listings
  • Flexible Listing Types: Support for both direct sales and lending scenarios
  • Query Capabilities: Filter listings by NFT contract or token contract
  • Status Tracking: Track listing status (OPEN, CLOSED, etc.)

🔧 Technical Implementation

Market Component Features

  • Storage Management: Efficient storage using Starknet's Map structure
  • Counter System: Automatic listing ID generation
  • Interface Compliance: Implements IMarket trait for standardized operations

Listing Operations

  • create_listing(): Create new marketplace listings
  • close_listing(): Close existing listings
  • get_listing(): Retrieve specific listing details
  • get_listings(): Get all listings
  • get_listings_by_nft(): Filter by NFT contract
  • get_listings_by_token(): Filter by token contract

�� Files Changed

Added

  • src/components/market.cairo - Main market component implementation
  • src/interfaces/imarket.cairo - Market interface definition

Modified

  • src/types.cairo - Added Listing struct and ListingStatus enum
  • src/lib.cairo - Updated module declarations
  • src/trajectfi.cairo - Integrated market component

Removed

  • src/components/signing.cairo - Replaced with market functionality

Type: Feature
Breaking Changes: Yes (replaced signing component)

@codebestia codebestia merged commit 617d703 into main Aug 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant