-
Notifications
You must be signed in to change notification settings - Fork 125
Description
Brecht, lets have some discussion here regarding your L2-Vaults.
Regarding idea number 2, do you assume the join/exit prices are controlled by us during one Loopring block time. If so, the deficit/surplus idea make sense to me. In my option, I think we have two approaches to handle defict/surplus. The first approach is batching it on L1 with flash loans; the second one is automatically cancel all pending joins/exits requests on L2 (after 1 or 2 Loopring blocktime) to zero out the defict/furplus. This is helpful when we believe batched L1 join/exit with flash loan will fail.
By "controlled", I mean the relayer will use the realtime L1 price as an oracle, then adjust join and exit prices accordingly. This will have to be done case-by-case. Some pool's token/vtoken price depends on the join/exit amount, our relayer will have a mirror implementation to simulate the price calculation, the more precise the better.
Regarding flash loan, this is my understanding:
-
if we need 100 vETH on L2, we can take a flash loan of 100ETH on L1, join the pool to get 100vETH, deposit the vETH before submitting blocks; then we have a withdrawal of 100 ETH directly to the flash loan to pay back the loan.
-
if we need 100 ETH on L2, we take a flash loan of 100ETH on L2, deposit to L2; then we withdraw 100vETH and exist on L1 and pay the flash loan back after block submission.
I believe a loan of Token is much easier of a loan of vToken.
Btw, I don't really get the term "Flash deposits". My understading is still a layer-1 flash loan used by deposits, but "Flash deposits are basically flash loans on L2" confuses me. Could you please clarify.