Pad Digest #5: May Development Update

3 min readJun 15


When the decision was made to prioritize the release of a DEX aggregator as the next feature, we anticipated a complex development process. Prior to this, we had already developed a DEX and established a dual reward pool, which we thought would provide a reliable foundation for connecting with external liquidity pools. However, our experience has proven to be much more difficult than we anticipated.

When dealing with multiple transactions simultaneously, it is crucial to consider the factors of liquidity and slippage. In order to optimize the execution of orders, we are currently testing out an implementation of sub-transactions for part-fills, allowing for a more efficient and practical approach to executing orders based on the available liquidity and price impact. However, the design of the blockchain considers each transaction as a complete unit that is either recorded on the blockchain or not — All or nothing.

Understanding Your Limits

Trading any asset requires a thorough understanding of how it will be executed to achieve the desired result. A conditional order is a set of instructions that executes a trade when specific conditions are triggered. They are used to indicate the end user’s intent on getting the order filled in a particular way and at a specified price or better. However, there is no guarantee your order will be executed since preceding orders may have affected the amount of liquidity available at the specified price.

AON (All or None — an order type requiring the trade to be completely executed in a single transaction with no part fill but not immediately), IOC (Immediate or Cancel — an order type that attempts to execute the entire trade immediately and cancels any unfulfilled portions), FOK (Fill or Kill — an order combining AON and IOC meaning it needs to be filled immediately and completely or not at all) and GTC (Good till Cancelled — an order that remains valid until it’s completely filled through single or multiple sources, or the trader cancels it) are the most common limit order condition.

For DEXs, GTC is the most preferred form of limit order condition because once pushed on-chain, it can remain indefinitely at no additional cost until the price condition is met. However, DEX Aggregators are a different beast. Their order condition resembles a FOK — without the option to return empty-handed because nobody pays gas to come back home with nothing to show for their jaunt.

This is where Part-fills come into play.

This Fill Wouldn’t Fill Itself

A part-fill is just a limit order with no AON flag that executes on orders that are too large to be entirely filled at the desired price but must be filled completely within that same block of transaction.

To do this, sub-transactions are needed because it’s assumed that multiple part-fills will be attempted, and only a few of those will be successful. Smart routing is the reason a large order is likely to be split into multiple part-fill attempts. Since the blockchain tries very hard to preserve atomic (non-nuclear) transactionality and certain sub-transactions must be committed to the blockchain even if other sub-transactions failed, all within the same block, implementing this has been quite an exciting challenge for us. It has also yielded a handful of promising corner cases that we’ve been keenly exploring for improvements as we approach the launch quarter.

Stay tuned for our next update Links




DeFi Hub for NEAR Ecosystem.