Skip to content

feat: add NFT Marketplace contract with auctions, offers, and royalty enforcement - #63

Merged
memplethee-lab merged 6 commits into
SourceXXL:mainfrom
uadamu00005-netizen:feat/Market
Aug 30, 2026
Merged

feat: add NFT Marketplace contract with auctions, offers, and royalty enforcement#63
memplethee-lab merged 6 commits into
SourceXXL:mainfrom
uadamu00005-netizen:feat/Market

Conversation

@uadamu00005-netizen

Copy link
Copy Markdown
Contributor

Closes #62

Summary

Implements a comprehensive NFT marketplace module enabling P2P NFT trading, English and Dutch auctions, royalty enforcement, and collection management with integrated payment settlement.

Changes

New Contract (contracts/nft-marketplace/)

  • Fixed-price listings with configurable currency support and payment escrow
  • English auctions with bid increments, auto-extension on late bids, and hammer-down settlement
  • Dutch auctions with linear time-based price decay to a configurable floor
  • Royalty enforcement at transaction level with per-creator split configuration
  • Offer-based trading with time-limited make/accept/cancel flows
  • Collection management with IPFS metadata pinning and on-chain verification
  • Bulk operations for atomic batch listing and auction creation (up to 50 items)
  • Marketplace fees with governance-controlled platform/creator/collection splits

Shared Crate Updates

  • Added 9 NFT-specific error codes (range 2000–2008)
  • Added 8 marketplace event emitters (nft_listed, nft_sold, nft_bid, nft_auction, nft_settle, nft_offer, royalty_paid, collection_registered)

Key Design Decisions

  • Separate MarketError enum — Soroban's #[contracterror] macro limits enums to 50 variants; marketplace errors live in their own enum to avoid exceeding the shared crate's limit
  • Sentinel address pattern — Auction current_bidder uses the contract's own address as a "no bids yet" placeholder, checked via current_bid > 0
  • Checks-effects-interactions — All state mutations precede token transfers for atomic safety
  • Lazy royalty evaluation — Royalties computed and distributed only at sale time, not at listing time

Test Coverage

31 unit tests covering:

  • Initialization, config, and currency whitelist management
  • Collection registration with royalty splits
  • Full listing lifecycle (list → buy → verify balances and fee distribution)
  • English auction with multiple bidders, bid validation, and auto-extension
  • Dutch auction price decay, buy, and cancel
  • Offer lifecycle (make → accept, make → cancel, expiry handling)
  • Royalty distribution to multiple creators
  • Bulk listing and auction creation
  • Edge cases (zero price, bad metadata hash, non-whitelisted currency, floor ≥ start)

Acceptance Criteria

  • Fixed-price listings allow immediate purchase at specified price
  • English auctions properly track bids with current highest bidder
  • Auction auto-extends if bid received in final minutes
  • Dutch auctions show accurate current price based on time decay
  • Royalties deducted and distributed to creators per royalty split
  • NFT transferred to buyer only after payment confirmed
  • Payment escrow holds funds until transfer completion
  • Collection metadata stored and retrievable with verified IPFS hashes
  • Offers can be created, accepted, or cancelled within time windows
  • Bulk operations execute atomically for all items
  • Marketplace fees deducted accurately and distributed per splits
  • 100% unit test coverage including auction edge cases (multiple bidders, extensions)

@memplethee-lab
memplethee-lab merged commit e33f87e into SourceXXL:main Aug 30, 2026
3 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.

Module: NFT Marketplace - Advanced NFT Trading and Auction Platform

2 participants