Skip to content

feat: support DCA during rebalance in Ekubo Vaults [WIP] #16

@akiraonstarknet

Description

@akiraonstarknet

Problem

if a vault holds significant liquidity in the network (i.e. 50%), instantly removing liquidity and doing swap can cause significant slippages. Slowly swapping will allow enough time in the market to absorb sale without much slippage.

Solution

  1. Add a new storage called old_bound_settings: Bounds
  2. new struct DCASettings:
    a. liquidity_per_block => DCA must finish within these blocks
  3. Add a new storage called dca_settings: DCASettings
  4. Add an additional rebalance function as fn rebalance_with_dca(ref self: ContractState, new_bounds: Bounds, liquidity_bps_per_block: u64) -> Only registers a rebalance intent, doesn't do rebalance. (Note: liquidity_bps_per_blocks is liquidity % per block, denoted in bps. so, 1bps is 0.01% liquidity)
    a. relayer only
    b. updates old_bound_settings to current bound_settings
    c. writes new_bounds to bound_settings
    d. writes to dca_settings storage with start_block as current block number. liquidity_bps_per_blocks = total_liquidity_in_old_bounds * liquidity_bps_per_blocks / 10000
    d. Emits RebalanceWithDCA event:
    d.1. pool_key
    d.2. old_bounds
    d.3. new_bounds
    d.4. dca_settings: DCASettings
  5. add new fn execute_dca_rebalance(swap_params: AvnuMultiRouteSwap)
    a. Relayer only (may not be required, but good for safety)
    b.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions