Status: Draft
Version: 0.0.1
Authors: Nick Juliano (nick@arweave.org)
The Universal Content Marketplace (UCM) protocol facilitates the trustless exchange of atomic digital assets on the permaweb. It supports trading between any form of digital content, such as artwork, documents, or media files, using a decentralized order book system. UCM also incentivizes users with PIXL tokens, which are distributed based on purchasing activity, including tracked streaks for consecutive purchases.
This specification describes the UCM's functionality, including order creation, execution, and integration of PIXL token incentives.
- Atomic Assets: Unique, indivisible digital items representing content on the permaweb.
- PIXL Token: A reward token that incentivizes purchasing activity within UCM.
- Order Book: The data structure that stores active buy and sell orders for trading assets.
- Buy Streaks: A mechanism that tracks users' consecutive daily purchases, rewarding them with PIXL tokens.
- Swap Token: A token used in exchange for atomic assets. The default swap token is defined as
DEFAULT_SWAP_TOKEN
.
Each pair of tokens traded is associated with an order book entry containing multiple orders.
Orderbook = {
Pair = [TokenId, TokenId],
Orders = {
Id,
Creator,
Quantity,
OriginalQuantity,
Token,
DateCreated,
Price? (optional for market orders)
}[]
}[]
Each order represents a user's intent to buy or sell a specific quantity of atomic assets at a certain price (limit orders) or at the market price (market orders).
Finds the index of the token pair in the order book. This allows the system to efficiently look up and manage pairs of assets being traded.
Handles the creation of both market and limit orders. It:
- Validates the token pair and ensures the quantities and prices are positive integers.
- Executes the order by finding matches in the order book, fulfilling it as much as possible.
- Updates the order book with any remaining quantity from the order (in the case of limit orders).
- Notifies the creator about the success or failure of the order.
- Records matches and updates the executed orders list.
Handles error reporting and, if applicable, refunds the sender’s tokens in case of an invalid transaction.
This feature enables the automatic execution of PIXL token buybacks when there is sufficient quantity available in the order book for the PIXL_PROCESS
.
- Market Orders: Executed at the best available price in the order book. The protocol attempts to fill the entire order quantity based on existing limit orders.
- Limit Orders: Executed only if the market price meets the user's specified price. Any remaining unfilled quantity is added to the order book.
When users purchase atomic assets, they are eligible to receive PIXL tokens. The system tracks buy streaks, which are awarded for consecutive daily purchases. Buy streaks are calculated by sending a request to the PIXL process during the order execution phase.
For every set of matched orders, the VWAP is computed and stored for reference. This provides a clear view of the average price of traded assets over time.
Handles updating of executed orders, logging them with their relevant details (such as quantity, price, and involved parties).
Performs the calculation of buy streaks and manages the allocation of PIXL tokens to buyers based on their activity.
-
Order Creation:
- A user creates a new order to buy or sell an atomic asset.
- The system checks for matching orders in the order book.
- If there is a match, the order is fulfilled, and tokens are transferred between buyer and seller.
- If there are no matching orders, the system adds the order to the order book (for limit orders).
-
Order Matching:
- The order book matches the buy and sell orders, prioritizing those with the most favorable prices.
- For market orders, the entire available quantity is filled as long as there are sufficient assets available in the order book.
-
PIXL Token Reward:
- When an order is executed, the system calculates whether the user has maintained a buy streak.
- If eligible, the user receives PIXL tokens as a reward for consistent activity.
UCM captures a 0.5% fee. If the trade involves the $wAR token, the protocol purchases PIXL with the fee. It buys available orders, and if no “Sell” orders exist, it initiates a “Buy” order via a reverse Dutch auction. PIXL tokens received from these purchases are burned. The higher the trading volumes and marketplace fees, the more tokens are bought and burned.
Errors in the system (such as invalid token pairs, insufficient quantities, or pricing issues) are caught by the handleError
function, which returns any necessary tokens to the user and logs the error for further analysis.
The Universal Content Marketplace (UCM) protocol is a decentralized marketplace built on the permaweb, enabling users to trade atomic assets while incentivizing participation through the PIXL token. Its robust order book system supports both market and limit orders, ensuring efficient and trustless exchanges of digital assets.