Surge Manifests
Building Atomic Transactions with Radix
A Radix transaction manifest is a human-readable blueprint for building atomic transactions, allowing multiple actions, resource movements, and authorization checks (via badges) to be composed and executed seamlessly. It ensures predictable outcomes by specifying fees and resource constraints, enabling developers and users to clearly understand and trust the transaction they are signing. Once ready, the manifest is translated into a cryptographically signed binary format for efficient network submission and processing by the Radix Engine.
How user requests are handled
User requests, such as MarginOrders and RemoveCollateral, are promptly recorded in their Surge trading accounts for potential execution by the Surge exchange, contingent on approval. The keeper network diligently monitors these requests, both new and pending, and relays them to the Surge Exchange, accompanied by the latest Oracle prices. While keepers lack direct authority, they are indispensable for conducting off-chain computations and continuous monitoring. Upon a user placing a request, it is swiftly logged in their trading account. Within seconds, the keeper assesses the request's feasibility and, if deemed viable, submits it to the exchange for execution, utilizing the most recent oracle data. This efficient process explains the brief "Pending Request" notification on the user interface, soon followed by "Trade executed."
Requesting a MarginOrder Trade
Placing a request for a MarginOrder, be it a market order, limit, stop limit with or without take profits or stop losses, log or short, with or without delays...
Exchange
Description: The exchange component responsible for processing the order.
Example:
component_rdx1czpfv5d9wwwpnv283vsstt4qdg7mnp6p9a9p5jfa3fykd2cqjaqnza
Note: This address changes when the exchange is upgraded, as indicated by the
EventSignalUpgrade
structure:
Delay
Description: The number of seconds before the order becomes valid for execution.
Example:
0
Expiry
Description: The number of seconds after the order becomes valid, at which point the order expires.
Example:
3153600000
Trading Account
Description: The trading account used to place the order.
Example:
component_rdx1cq02dya605d6y4w6zlz82kcdcqsx66hx6w0zel4nwvxk7l9jxzxl92
Note: The correct proof associated with the trading account's level 3 authorization must be present.
Pair
Description: The trading pair for the order.
Example:
SUI/USD
Amount
Description: The size of the order.
Positive value indicates a long position.
Negative value indicates a short position.
Reduce Only
Description: Determines if the order can only decrease a position.
false
: Can both increase or decrease a position.true
: Can only decrease a position.
Price Limit
Description: Specifies the price limit for the order.
Enum<0u8>()
: None (market order).Enum<1u8>(Decimal("{limit_price}"))
: Oracle price must be greater than or equal to limit price (short limit or long stop limit).Enum<2u8>(Decimal("{limit_price}"))
: Oracle price must be less than or equal to limit price (long limit or short stop limit).
Slippage Limit
Description: Defines the slippage limit, which is equivalent to the fee.
Enum<0u8>(Decimal("{limit_slippage}"))
: None.Enum<1u8>(Decimal("{limit_slippage}"))
: Fee must be less than or equal tolimit_slippage * trade_value / 100
(percentage limit).Enum<2u8>(Decimal("{limit_slippage}"))
: Fee must be less than or equal tolimit_slippage
(absolute limit).
Note: Maximum fee is 1%.
Take Profit
Description: Sets a take profit condition.
Enum<0u8>()
: None.Enum<1u8>(Decimal("{tp_price}"))
: Opposing limit order attp_price
.
Stop Loss
Description: Sets a stop loss condition.
Enum<0u8>()
: None.Enum<1u8>(Decimal("{sl_price}"))
: Opposing stop limit order atsl_price
.
Note: Take profit (TP) and stop loss (SL) are separate OCO (One Cancels the Other) reduce-only orders that start dormant and are activated by the execution of the main order.
Last updated