Orders Overview
Signet’s Orders system provides a flexible, secure mechanism for conditional cross-chain transactions. It uses the Permit2 standard to enable users to express complex transaction intents that execute only when specific conditions are met.
What are orders?
Orders are signed messages that express a user’s intent to trade assets across chains. They consist of:
- Inputs: The tokens a user is willing to provide (using Permit2 for authorization)
- Outputs: The tokens and amounts the user expects to receive in return
- Conditions: Requirements that must be met for the order to execute
1// Signed orders
2pub struct SignedOrder {
3 /// The permit batch.
4 #[serde(flatten)]
5 pub permit: Permit2Batch,
6 /// The desired outputs.
7 pub outputs: Vec<Output>,
8}
9
10// Permit2 batches
11pub struct Permit2Batch {
12 pub permit: <PermitBatchTransferFrom as SolType>::RustType,
13 pub owner: Address,
14 pub signature: Bytes,
15}
Source: Exact type definitions from signet-sdk/crates/types/src/signing/order.rs
Key Features
- Conditional Execution: Orders only execute if the exact specified conditions are met
- Cross-Chain Compatibility: Seamlessly move assets between Signet and Ethereum
- User Control: Users maintain full control over their assets until execution
- Atomic Execution: All parts of an order execute together or none at all
- No Required Escrow: Users don’t need to lock up assets before transactions
How orders work
- A user creates and signs an order specifying inputs (assets they provide) and outputs (assets they want)
- The order is submitted to the orders cache where it awaits fulfillment
- Market participants (searchers and fillers) find and fulfill orders by providing the requested outputs
- The order executes atomically, with all conditions verified before completion
Order lifecycle
Orders progress through several states during their lifetime:
- Creation: User specifies inputs/outputs and signs the order
- Submission: Order is submitted to the orders cache
- Matching: Order waits for a counterparty to fulfill it
- Execution: Order is executed when all conditions are met
- Completion: Assets are transferred to their respective recipients
Applications
The Orders system enables a wide range of applications, including:
- Cross-chain Swaps: Exchange assets between Signet and Ethereum
- Limit Orders: Set specific price points for asset trades
- Dollar-Cost Averaging: Schedule recurring purchases over time
- Conditional Transfers: Execute transfers only when specific conditions are met
SDK Integration
Working with Orders requires the following SDK packages:
- signet-zenith - Core bindings and SignedOrder utilities
- signet-types - Order type definitions and structures
- signet-tx-cache - Efficient order book caching for market makers
- signet-sim - Simulate order execution before submission
Best Practices
Orders are designed to be safe for users, but market participants should follow these best practices:
For Users
For Fillers
- Keep SignedFills Private: Never share SignedFills publicly. They authorize token transfers from your account and should remain confidential until mined.
- Use Private Transaction Relays: Submit bundles containing SignedFills through trusted, private channels to prevent front-running.
- Validate Before Signing: Always validate orders and fills before signing to ensure they meet your economic requirements.
- Atomic Submission: Only submit SignedFills atomically with their corresponding SignedOrders to ensure you receive the inputs.
For more detailed information about Orders, explore the following sections:
- Order Processing: Learn how orders are processed and executed
- Working with Orders: Practical guide to creating and managing orders
- Market Participants: Understand the roles involved in the order ecosystem
- Bundles and Orders: How orders are grouped for execution
- Application Use Cases: Real-world examples and patterns