🙋Order Delegation

For DAOs, whales, and other investors who want to take a sizable position in an asset, long-term TWAMM trades offer a convenient solution. However, unlike OTC desks that offer white glove services to ensure proper fill, V1: TWAMM requires a more hands-on approach.

Some long-term traders might not have time to monitor a long-term trade and take action if needed. The solution to this problem is order delegation, where a third party is able to cancel orders or withdraw proceeds to your account on your behalf.


Order delegation permits the owner account of a long-term trade to designate a delegate account for each long-term trade when it is placed. It is impossible to change a delegate once a long-term trade is placed; the only way to remove a delegate account from an order is to cancel the order.

The delegated account is able to perform the following operations on the long-term trade on behalf of the owner account:

  • Cancel the long-term trade, refund unsold tokens, and proceed tokens to the owner account.

  • Withdraw proceeds to the order account from the long-term trade, during the trade, and until the order expiry and all funds are withdrawn.

All funds canceled or withdrawn by the delegate account can only be sent to the long-term order owner account.

Any attempt to set the long-term order withdrawal or cancel the recipient address to anything but the owner account by delegate results in the transaction reverting.


Reducing Governance Effort

For a DAO placing a long-term order, re-assembling the DAO to vote on whether to cancel the order for a current market condition or to withdraw funds for an expense is a costly proposition in both time and effort. If at the outset of the order, the DAO sets conditions under which the order is to be canceled or funds are withdrawn, a delegate account (treasury managers) may be specified to meet these responsibilities, saving the DAO from having to meet and vote on taking an action and the responsible party.

Automation: Limit Order, Streaming

Another application might be assigning a delegate account to automation that watches for certain market conditions under which to cancel the order -- a limit order. Alternatively, the automation can be used to stream withdrawals of proceeds periodically, enabling other users of capital, rather than parking it in the TWAMM pool.

How to use

Consider a DAO, with an account 0xDAO, placing a long-term swap selling 1M Token A to a TWAMM pool over 1000 intervals. The DAO wishes to specify a delegate account, 0xDelegate. The code below shows how to perform this swap by calling the TWAMM periphery relayer:

(, uint256 orderId) = ICronV1Relayer(0xRelayerAddress).longTermSwap(
  0xTokenA,                             // Token In:  Token A address
  0xTokenB,                             // Token Out: Token B address
  ICronV1PoolEnums.PoolType.Stable,     // Pool type
  1_000_000_000_000_000_000_000_000,    // 1M Token In (18 decimals)
  1_000,                                // 1k Intervals

// Now if the delegate account wishes to cancel the order, 
// they might issue code like this:

  0xTokenA,                             // Token In Token A address
  0xTokenB,                             // Token Out: Token B address
  ICronV1PoolEnums.PoolType.Stable,     // Pool type
  orderId,                              // Long-term swap order id from the above code snippet
  0xDAO                                 // Recipient of proceeds and refund. Can only be
	                                // the original owner account.

Last updated