HydraDX-node icon indicating copy to clipboard operation
HydraDX-node copied to clipboard

Gradual Add/Remove Liquidity

Open green-jay opened this issue 1 year ago • 2 comments

Problem statement: The circuit breaker limits amount of added/removed liquidity in one block. This can be a limiting factor for entities wanting to Add/Remove higher $ values as it needs to be spread on the way in/out into many transactions and smaller chunks. This has to be currently a manual action, which is tedious and complicated in some setups like multisigs.

Goals: Ideally users would be able to send just 1 transaction to Add/Remove any amount and the chain will take care of successful execution.

Potential ways to address this problem:

  • using system scheduler
  • special extrinsic that would add/remove liquidity gradually
    • something like dca for LP positions
    • or intention with off chain worker
  • just introduce delay

green-jay avatar Apr 15 '24 14:04 green-jay

After discord discussion, my suggestions/requests are:

  1. Allow all accounts to use the scheduler pallet so that other chains can remotely use XCM calls to schedule operations on Hydra. Critical for treasuries to manage their large deposits without requiring Hydra governance involvement or multiple referenda.
  2. On the account liquidity page, if there are multiple LP positions for a single token then allow a user to visualize the aggregate value or drill down to see details for each individual NFT position.

I know that add/remove liquidity were a security concern, and allowing broad use of scheduler or @jgreen's suggestion to create a special extrinsic for gradually addition seems to be circumventing it. What if add/remove liquidity limits were applied on a longer timespan than one block, or a limit per every 4 hours? I think Treasuries would be ok with slowly depositing large batches of tokens over a period of days or a week, and it allows enough time for chain monitoring to alert the team to an attack.

spazcoin avatar Apr 17 '24 14:04 spazcoin

While we are at this. We should also solve the 1% slippage problem. Users currently need to wait if the price is volatile to exit the pool. We could include this in the gradual add / remove.

jak-pan avatar May 16 '24 06:05 jak-pan