Trade Ledger (TradeLedger)

The TradeLedger struct represents a marketplace registry for a specific NFT collection and trading currency.

Structure Definition:

public struct TradeLedger has key {
    id: UID,
    collection_id: ID,
    collection_creator: address,  // Store collection creator
    collection_name: String,      // Store collection name
    collection_description: String, // Store description
    collection_uri: Url,          // Store metadata URI
    collection_logo_uri: Url,     // Store logo URI
    current_supply: u64,          // Track collection supply
    max_supply: u64,              // Track collection max supply
    is_mutable: bool,             // Track if collection is mutable
    has_deny_list_authority: bool, // Track deny list authority
    deny_list_size: u64,          // Track deny list size
    currency_type: TypeName,
    offers: Table<ID, TradeOffer>,
    user_offers: Table<address, vector<ID>>,
    price_index: Table<u64, vector<ID>>, 
    sorted_prices: vector<u64>,
    total_active_offers: u64,
    buy_offers: Table<ID, BuyOffer>,
    user_buy_offers: Table<address, vector<ID>>,
    buy_price_index: Table<u64, vector<ID>>, 
    sorted_buy_prices: vector<u64>,
    total_active_buy_offers: u64,
    timestamp: u64
    }

Purpose

  • Maintains trade offers and buy offers for a specific NFT collection.

  • Tracks active prices to support efficient price discovery.

  • Links users to their offers, enabling faster retrieval of trades.

Last updated