Closed peartobear closed 1 year ago
Accidentally messed with your initial text, reverted it to your original. Here my version.
Problem Statement:
We differentiate between the following two independent re-balancing tasks
Number 2 will be solely handled by Hedgy via OpenDEX since markets move fast and hedging needs to be fast. This issue is about a solution for a problem we currently face with Number 1, where the rebalancing is handled by boltz natively:
For now, the only way to re-balance between on-chain & off-chain is opening/closing channels. For BTC/LTC there is no big problem, but for ETH/ERC20 the long Raiden settle-timeout
(~4 days) when closing a channel or withdrawing from a channel locks up capital and an exchange operator would need to put up significantly larger balances to have buffer for trades within this time frame. We want to find a long-term way to circumvent this need for a large capital buffer.
Short-term Solution
Equip boltz with a decently high balance which is rebalanced manually via external exchanges and increase balances and re-balancing threshold to a limit (outer and inner bound to be discussed) so that we don't run out of on-chain coins when capital is locked up in a channel closing/withdrawal procedure.
Long-term Solution
a) Add a Boltz-like on-chain to off-chain rebalancing feature to xud
Pro: xud
has the advantage of having an order book, which makes finding a counterparty for an atomic submarine swap to do the re-balancing is easier, rebalancing is "on-chain tx instant"
Con: Would require quite some implementation work, would probably need to be outside of the OpenDEX protocol, since it's unlikely a non-instant swap would be accepted in the protocol which promotes speed. Or it could be designed in a way that orders including minimum one on-chain leg are somewhat separate/distinct from the off-chain/off-chain orders.
b) Offer re-balancing as centralized service to other upcoming OpenDEX-enabled exchanges.
Pro: already possible, additional USP for boltz
Con: Doesn't bring liquidity to OpenDEX
c) ?
My proposal
I'd go for the short-term solution since this doesn't require us doing anything special apart from allocate balance and manual rebalancing and start hashing out details for a), which I agree with @peartobear, is the only viable long-term solution I can come up with.
Problem Statement: long settle-timeout deters us from using internal (on-chain to off-chain) rebalancing strategy we plan to use for BTC and LTC. We need to find a way to circumvent that.
Long-term Solution Add a Boltz-like on-chain to off-chain rebalancing feature to XUD, which has an added advantage of having an order book, which makes finding a counterparty for an atomic submarine swap relatively easy. In this case, Boltz will not have to worry about running out of funds in any specific token denomination as rebalancing can be done directly via XUD instantly.
Short-term Solution
Increasing the threshold to a limit (outer and inner bound to be discussed) so that we don't run out of on-chain coins when channel is closed.
My proposal
We work with XUD towards long term solutions. And in the meantime, for short term solution, we have a buffer of on-chain coins in the form of DAI so that we hedge ourselves against the price volatility. If we run out of any specific ERC20, we use Kyber reserve or Uniswap limit orders to swap as per our need.