-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
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
- Add a new storage called
old_bound_settings: Bounds - new
struct DCASettings:
a. liquidity_per_block => DCA must finish within these blocks - Add a new storage called
dca_settings: DCASettings - 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. updatesold_bound_settingsto currentbound_settings
c. writesnew_boundstobound_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. EmitsRebalanceWithDCAevent:
d.1. pool_key
d.2. old_bounds
d.3. new_bounds
d.4. dca_settings: DCASettings - add new
fn execute_dca_rebalance(swap_params: AvnuMultiRouteSwap)
a. Relayer only (may not be required, but good for safety)
b.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels