Artinals Protocol
  • Introduction
    • What is Artinals?
    • Overview of the Modules
    • Key Concepts and Terminology
  • Getting Started
    • Prerequisites
    • Cloning the Repository
    • Building and Testing the Modules
  • ART20
    • Overview and Capabilities
    • Data Structures
      • NFT
      • CollectionCap
      • UserBalance
      • TokenIdCounter
      • Dual IDs
    • Events
      • NFTMintedEvent
      • CollectionCreatedEvent
      • MetadataUpdateEvent
      • BurnEvent
      • TransferEvent
      • Additional Events
    • Functions and Entry Points
      • Initializing the Module
      • Creating Collections
      • Minting ART20 NFTs
      • Updating Metadata
      • Transfer and Burn Operations
      • Batch Operations
      • Deny List Mechanics and Authority
      • Custom Transfers
    • Value Sources (API, Oracle)
    • Best Practices & Examples
  • SALE Module
    • Purpose and Functionality
    • Interdependence
    • Price Index Module
    • Liquidity Module
    • Data Structures
      • NFTSale
      • NFTListing
  • Events
    • SaleCreated
    • NFTPurchased
    • PriceUpdateEvent
    • CurrencyWithdrawn
    • DenyList & Related Events
    • PoolCreatedEvent
    • OrderCanceled
    • OrderExecuted
  • Functions and Entry Points
    • Creating a Sale
    • Adding NFTs to a Sale
    • Purchasing NFTs from a Sale
    • Withdrawing Proceeds
    • Managing Sale State
    • Core Trading Functionality
  • Integrating with ART20
  • Examples & Best Practices
  • MARKET Module
    • Introduction
    • Testnet (Beta)
    • Smart Contract Overview
    • Data Structures
      • Trade Ledger (TradeLedger)
      • Trade Offer (TradeOffer)
      • Buy Offer (BuyOffer)
      • Ledger Registry (LedgerRegistry)
    • Event Structures
      • Offer Created (OfferCreated)
      • Offer Accepted (OfferAccepted)
      • Buy Offer Created (BuyOfferCreated)
      • Buy Offer Accepted (BuyOfferAccepted)
      • Batch Transactions
    • Event Emissions
    • Functions and Entry Points
      • Trade Ledger Management
      • Register Ledger
      • Get Trade Ledger
      • Create Sell Offer
      • Accept Sell Offer
      • Cancel Sell Offer
      • Create Buy Offer
      • Accept Buy Offer
      • Cancel Buy Offer
      • Batch Accept Sell Offers
      • Batch Accept Buy Offers
  • Security Mechanisms
  • TRADE Module
    • Introduction
    • Purpose and Ecosystem Role
    • Data Structures
      • TradingPool
      • LiquidityPosition
      • PriceOracle
      • CollectionPool
    • Events
      • PoolCreated
      • LiquidityAdded
      • LiquidityRemoved
      • TradeExecuted
      • PoolStatusChanged
      • PoolFeesUpdated
    • Functions and Entry Points
      • Creating and Managing Liquidity Pools
      • Adding/Removing Liquidity
      • Swapping NFTs and Tokens
      • Fee Mechanics and Distribution
      • Emergency Operations and Recovery
  • Working with Price Oracles
  • Metrics and Statistics (24h Volumes, TWAP, Price Impact)
  • Integration with SALE and ART20
  • Integration and Workflows
    • Typical User Journeys
      • Creating a Collection and Minting Tokens (ART20)
      • Listing and Selling NFTs (SALE)
      • Providing Liquidity and Trading NFTs (TRADE)
    • Example Scripts and Transactions
    • Interactions Between Modules
  • Security, Permissions, and Deny Lists
    • Introduction
    • Role of Deny List in ART20
    • Creator vs. Owner Permissions
    • Fee Distribution and Authority
    • Best Practices for Secure Deployment
  • Testing and Troubleshooting
    • Running Unit Tests
    • Common Issues and Solutions
    • Debugging and Emitting Debug Events
  • Advanced Topics
    • Value Sources (API Endpoints and Oracle Addresses)
    • Batch Update Operations
    • Customizing Parameters (Fees, Supply, Price Ranges)
    • Extensibility and Future Integrations
  • Appendices
    • Move Language and Sui Concepts
    • Glossary of Terms
    • Code Style and Conventions
  • Building on Top of the Artinals Contract
    • Overview
    • Package ID
    • Import Modules
    • Commom Integration Patterns
    • Best Practices
    • Common Errors and Solutions
Powered by GitBook
On this page
  1. Functions and Entry Points

Core Trading Functionality

close_sale<CURRENCY>(...) and reopen_sale<CURRENCY>(...) The SALE module provides a comprehensive set of functions to facilitate NFT trading using an order book model. These functions allow users to create and manage buy and sell orders, match orders automatically, and analyze market liquidity.

Core Trading Functionality:

  • Order Creation:

    • create_sell_order<CURRENCY>: Allows users to create sell (ask) orders by specifying the NFTs to sell, quantity, and price per NFT.

    • create_buy_order<CURRENCY>: Enables users to create buy (bid) orders by specifying the desired quantity and maximum price per NFT.

  • Order Matching:

    • match_orders<CURRENCY>: This function automatically matches compatible buy and sell orders based on price and time priority. It executes trades by transferring NFTs from sellers to buyers and payment from buyers to sellers.

  • Order Cancellation:

    • cancel_order<CURRENCY>: Allows users to cancel their existing buy or sell orders.

  • Liquidity Analysis:

    • get_liquidity_metrics<CURRENCY>: Calculates and returns key liquidity metrics for a given pool, such as total bid and ask volumes, market depth, and bid-ask ratio.

    • get_liquidity_depth<CURRENCY>: Provides a more detailed view of liquidity by analyzing price levels, order volumes, and weighted average prices.

Entry Points:

The following functions serve as entry points for interacting with the trading functionality:

  • create_trade_pool<CURRENCY>: Creates a new NFT trading pool for a specific collection and currency. This is the initial step required to enable trading for a collection.

  • create_sell_order<CURRENCY>: Allows users to place sell orders into the order book.

  • create_buy_order<CURRENCY>: Allows users to place buy orders into the order book.

  • cancel_order<CURRENCY>: Enables users to cancel their existing orders.

These entry points provide a clear and well-defined interface for users to interact with the trading system. By utilizing these functions, users can participate in the NFT marketplace, create and manage orders, and contribute to the overall liquidity and price discovery process.

PreviousManaging Sale StateNextIntegrating with ART20

Last updated 4 months ago