Signed Orders
In TX Swap, the smart contract architecture is designed to enable gas-free trades by working with off-chain orders submitted through signed messages. The protocol consists of an allowance manager and a settlement smart contract. Users first need to approve the allowance manager contract to execute the signed orders on their behalf. This approval transaction is the only transaction where users have to pay a gas fee.
Once approved, users can submit orders using signed messages that contain trade details such as limit price, amount, and timestamp. TX Swap leverages batch auctions to process these signed orders. Solvers review the order submissions and include them in the most suitable batch auction for the trade.
When a trade order (signed message) is included in a batch, solvers send the transaction to the settlement contract. The settlement contract verifies with the allowance manager if the signed order has the necessary approval to spend the funds. This combination of smart contracts allows TX Swap to work with off-chain order submissions, ensuring that funds can only be transferred if the trader has approved the allowance manager contract.
TX Swap also provides guarantees to users:
Funds can only be transferred if the trader has approved the necessary contracts and signed an order for the trade.
Limit prices and amounts specified in the signed order will always be satisfied.
Signed orders have expiry dates and can be canceled on-chain, preventing replay attacks.
Only solvers subject to slashing can execute the batch auction settlement.
Smooth transaction management, including multi-signature wallets, where the minimum price shown is guaranteed once the first signature is done. If the protocol can fulfill the promised price regardless of when the remaining signatures are completed, the trade will be executed. Otherwise, the order will simply expire without any cost to the trading participants.
These features ensure secure and efficient trading on the TX Swap platform while minimizing gas costs for users.
Last updated