> For the complete documentation index, see [llms.txt](https://docs.artinals.com/artinals-protocol/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.artinals.com/artinals-protocol/sale-module/data-structures/nftsale.md).

# NFTSale

The SALE module defines several key data structures to manage NFT sales, liquidity pools, and related information:

**1. `NFTSale<phantom CURRENCY>`:**

* Represents an NFT sale, holding details such as the price per NFT, creator address, collection ID, sale status, and the NFTs themselves (stored as dynamic fields).
* The `CURRENCY` phantom type parameter allows for specifying the currency used in the sale.

**2. `NFTPool<phantom CURRENCY>`:**

* Represents a liquidity pool for trading NFTs within a specific collection.
* Stores an order book (`OrderBook`) containing buy (bid) and sell (ask) orders.
* The `CURRENCY` phantom type parameter defines the currency used for trading.

**3. `OrderBook`:**

* Contains two vectors: `asks` and `bids`, each storing `NFTOrderEntry` structs.

**4. `NFTOrderEntry`:**

* Represents an individual order in the order book, containing details like price, owner, quantity, and filled quantity.

**5. `PoolRegistry`:**

* A global registry that keeps track of all created `NFTPool` objects.
* Stores a table mapping collection IDs to vectors of registered currency types.

**6. `NFTListing<phantom CURRENCY>`:**

* Represents an NFT listed for sale within an `NFTSale`.
* Stores the NFT itself, the sale ID, and the price.

**7. `NFTFieldKey<phantom CURRENCY>`:**

* Used as a key for storing NFTs as dynamic fields within `NFTSale` and `NFTPool` objects.

These data structures work together to provide a robust and efficient system for managing NFT sales and liquidity pools. The use of phantom types ensures type safety and allows for specifying different currencies for sales and trades.
