Open kitanovicd opened 3 days ago
After going through each proposed solution in ticket description I can say the following:
Out current implementation has a hardcoded path for swapping. Swapping is done sometimes when deposit/withdraw is done. This solution is good because user can deposit and withdraw very frequently without waiting for action to be proceeded (queue system). Also this is good because strategy strongly follows ERC-4626 standards and is in fact a real vault.
First proposed solution adds centralization to the protocol. Centralization comes from the fact that rebalancers need to be whitelisted and trusted. Also within this solution we still need to solve swapping while doing user actions (deposit, mint, withdraw, redeem). This can be solved in coupe ways:
Do the most optimal swap even on user actions. This means the following:
This solution adds a lot of centralization to the protocol and also breaks ERC-4626 standard. Breaking a standard is a big deal in my opinion. One of the reasons why we decided to pool people together is to follow the industry standards and be easy to integrate. Here we are losing this big feature.
Queue actions
Add extra functions for the most optimal route
Develop system where trusted parties can change hardcoded route
Liquidator network
Additionally to minimize cost for a liquidator type approach we can use a service like API3 or similar to force actors to provide latest signed price update with their action
I took a look at asynchronous vaults. I think this standards might work fine for users but will bring some problems for meta strategies. I think that meta strategies should be able to quickly go in and out because they have their own rebalancing logic. The only way we can make meta strategies quick is that we put liquidation logic inside meta strategy. This means that flash swap / liquidation logic is placed inside meta strategy. This approach may sound fine but this means that it will be more complex to build meta strategies. Good thing about initial idea is that anyone can come and create meta strategy. With this new approach it is a little bit harder to achieve since someone developing them needs to be liquidator also. Frequently going in and out of sub strategies is more likely to happen on meta strategies that are relying on volatile assets and for this reason I think queueing might not be a good choice.
Important thing to note is the following:
For delta neutral strategies rebalance on meta strategy level will be triggered only when price of collateral token changes. This means that long strategy will have more equity and will need to rebalance up and short strategy to rebalance down. This means that withdrawal can be done from long strategy without looping. Withdrawal can be done by just withdrawing that excess of funds. In those cases I think request should not be queued and should not go through liquidator network. It should be immediately served.
I think building swap/liquidator logic on meta strategy level is not good. I think all those things should lay in the core of the protocol and meta strategies should be builded on top of it.
Also one solution that can make sense is the following:
I think this approach can be fine and will be very effective.
We are currently always swapping by using predefined route. This leads to 2 very big inefficiencies:
In order to solve this we should develop better swapping module. This module should be developed in one of the two ways:
When developing this assignee should double check how will swapping work on deposit/withdraw/mint/redeem.
From Wes, some options for possible efficient/scalable swapping: