Ledger Registry (LedgerRegistry)

A mapping system that tracks all trade ledgers.

Structure Definition

public struct LedgerRegistry has key {
    id: UID,                            // Unique identifier for the registry
    ledgers: Table<LedgerKey, ID>       // Mapping from (collection_id, currency_type) → TradeLedger ID
}

Ledger Key

A composite key struct that helps in uniquely identifying trade ledgers.

public struct LedgerKey has store, copy, drop {
    collection_id: ID,                  // NFT collection ID
    currency_type: TypeName             // Currency used for trading
}

Purpose

  • Ensures each NFT collection has a unique ledger for its trading activity.

  • Provides quick lookups for existing ledgers.

Last updated