How does DCA work

DCA inherently requires multiple parties to have access to an account in order to execute trades at a specified interval, so that the user does not have to constantly perform those trades themselves. Due to the fundamental differences between Sui and other blockchains, this requires a unique approach in order to maximize both the performance and security of a DCA implementation.

On most blockchains, you can simply grant permission to a contract to access an account’s funds. Sui’s object-centric design offers many advantages, but requires some clever engineering in order to build DCA that is optimized for Sui. The main points of consideration are that Sui has two methods of finalizing transactions, consensus and what is called the fast path. Consensus requires validators to approve a transaction and is used for shared objects, such as a user interacting with an AMM pool. Fast path is for simple transactions such as sending tokens from one user to another, which does not require consensus. While consensus on Sui is still extremely fast, if it is possible to use fast path for something like DCA, it is desirable to do so.

Aftermath’s solution is to share the address which owns the object, rather than the object itself. This is achieved by using a Sui-native primitive, the k-of-n mulitsignature. When placing a DCA order, an order object is created specifying the amount and interval of each transaction. This object is owned by the multisig, which is derived on-chain, not passed from off-chain. The order object is soulbound to the multisig and can never be transferred elsewhere. The benefits to the user are cheaper gas costs and faster execution for trades, while providing a user experience identical to DCA on any other chain or CEX.

For a more in-depth explanation of possible ways to implement DCA on Sui, and why Aftermath chose the method we did, please refer to this article written by our CTO, Kevin.

In addition to being optimized specifically for Sui, DCA on Aftermath has additional features which are beneficial to the user. First, each order is executed up to 30 seconds before or after the specified interval, in order to prevent gamification of regularly-placed orders. As a protection against extreme volatility, it is also possible to set a maximum and minimum swap price for each trade. If the price does not fall within the user-specified range at the time of processing, it will not be executed. It is also possible to send the output of your trade to a different address of your choice, for example an investment or centralized exchange address. These features allow DCA on Aftermath to be a truly set-it-and-forget-it experience.

Last updated