Deploy Smart Contract Template Limit Order Module
The LimitOrder template is one of the smart contract templates currently live on the SatoshiNet public testnet. It validates how order creation, filling, cancellation, and refund are represented by canonical Result TX and contract state root in the SatoshiNet smart contract framework.
Note: The limit order feature in PWA Market or DEX is an L2 market Channel Contract capability, not the smart contract template LimitOrder discussed here. The template LimitOrder in this page can only be accessed from PWA Tools -> Smart Contracts.
Current Status
Contract type
Template Contract
Template
LimitOrder
Environment
SatoshiNet public testnet
Mainnet status
Not open yet
Fee asset
Test GAS
Interaction entry
PWA Tools -> Smart Contracts
Basic Flow
The deployer enters PWA
Tools -> Smart Contracts.Select trading asset and base asset.
Deploy the limit order template contract.
Maker creates an order and transfers the sell asset to the contract address.
Taker fills the order and transfers payment asset to the contract address.
The contract matches according to price and order rules.
Result TX sends traded assets to both parties.
Unfilled or cancelled parts are returned through refund.
Invocation Actions
swap / create order
Place buy or sell order; direction is determined by input asset and order parameters
refund
Cancel order or withdraw refundable assets
Order types follow the template protocol definition:
1
Sell order
2
Buy order
3
refund
Matching Rules Summary
Buy orders are sorted from high price to low price.
Sell orders are sorted from low price to high price.
Same-price orders are sorted by block order, transaction order, and item id.
A trade happens only when buy price is greater than or equal to sell price.
Trade price uses the sell order price.
Each match generates buyer asset transfer and seller sats transfer, both in the same Result TX.
Unused sats from a buy order are returned to the buyer.
When remaining sell asset is insufficient for further matching, the remainder is returned to the seller.
Verification Checklist
Whether Deploy TX created the limit order contract address.
Whether order creation transaction transferred sell asset to the contract address.
Whether the order entered open state.
Whether fill transaction transferred the correct payment asset.
Whether Result TX distributed assets by matching rules.
Whether refund can only cancel the caller's own open order.
Whether order state, Result TX, and wallet balance are consistent.
Risk Boundary
The current limit order template contract is testnet-only.
Testnet orders, prices, and assets have no mainnet value.
Order state should be interpreted together with wallet, Explorer, and Indexer evidence.
When network errors or page delays occur, do not resubmit the same value movement. Check txid and contract state first.
Page Status: In Development
Last updated