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
  • Dependencies
  • Constants & Error Codes
  1. MARKET Module

Smart Contract Overview

Module Name: module artinals_markets::MARKET;

This module is responsible for enabling a decentralized NFT marketplace on the Sui blockchain. It provides functionalities for listing, buying, selling, and batch transactions of NFTs while ensuring security, transparency, and efficiency.

Dependencies

The MARKET module relies on several core Sui libraries and external modules:

  • Sui Standard Libraries

    • sui::coin – Handles fungible tokens used for transactions.

    • sui::table – Manages order book and trade ledger.

    • sui::event – Emits blockchain events for tracking trades.

    • sui::clock – Provides blockchain timestamps.

    • sui::dynamic_object_field – Stores NFT metadata efficiently.

  • ART20 Integration

    • Uses artinals::ART20::NFT, UserBalance, and CollectionCap for NFT interactions.

Constants & Error Codes

The contract defines several error codes for validating transactions and ensuring security.

Error Codes

Error Code
Meaning

ENotOfferOwner = 2

The sender is not the owner of the offer.

E_NOT_CREATOR = 8

The sender is not the creator of the collection.

EInsufficientBalance = 3

The user does not have enough balance to complete the transaction.

EOfferNotOpen = 4

The offer is either closed or already completed.

ECollectionMismatch = 6

The NFT collection does not match the expected collection.

EInvalidCurrency = 7

The provided currency is not valid for this offer.

E_OVERFLOW = 1

Integer overflow detected in arithmetic operations.

E_INVALID_BATCH_SIZE = 2

The batch size exceeds the allowed limit.

E_ADDRESS_DENIED = 3

The sender’s address is denied from performing this action.

E_INVALID_AMOUNT = 4

The amount provided is invalid.

E_BALANCE_CREATION_FAILED = 5

The user balance creation process failed.

EOFFER_NOT_FOUND = 2

The offer does not exist or was removed.

EOFFER_ALREADY_FILLED = 3

The offer has already been fulfilled.

ELedgerExists = 30

The ledger for this collection already exists.

ELedgerNotFound = 31

No matching ledger found for the specified collection.

Offer Status Constants

Constant
Value
Description

MAX_U64

18446744073709551615

Maximum value of a u64 integer.

MAX_BATCH_SIZE

200

Maximum number of NFTs or offers processed in a single batch.

PreviousTestnet (Beta)NextData Structures

Last updated 3 months ago