4 ms·
So the loan and the return is a single "transaction" (in db terms)? What sort of situation could this be used in? I'm having a hard time truly imagining use wi
by kgin 6y ago
So the loan and the return is a single "transaction" (in db terms)?
What sort of situation could this be used in? I'm having a hard time truly imagining use without any risk of transaction rollback.
- downandout 6y agoThey are primarily used for arbitrage transactions. Token swaps on decentralized exchanges are instant - there is no order book. So you can compose a single transaction that involves many exchanges, swaps involving different tokens, flash loans, etc. If the transaction ends with a profit after the loan is paid back, at the market prices that exist at the time the transaction is executed, the flash loan occurs, and profits are collected by the person that created the transaction. If it does not end with a profit, then the transaction is reverted as if it never existed.
- socialentity 6y agoHow would that work, though? It sounds like guaranteed arbitrage? But does arbitrage work as a trading strategy? I thought markets quickly become too efficient for that?
- downandout 6y agoIt is guaranteed arbitrage. There is no risk to the lender, and the only risk to the person that initiated the transaction is that slippage will occur that makes the trade unprofitable, which would cause the transaction to revert, which would cause them to lose the transaction fee for having attempted the transaction. The markets are not currently too efficient for that, and never will be. In fact Uniswap’s entire design depends heavily on arbitrageurs balancing out the markets between itself and other exchanges.
- SamBoogieNYC 6y agoWow this sent me down a rabbit hole. How are the transactions composed, with a smart contract/s, in combination with Dex API’s?
- downandout 6y agoFlash loans are composed using a smart contract. So basically you create a smart contract that will call all the DEX/loan platform/other contract functions necessary to obtain the loan, carry out swaps and pay it back. You then deploy that contract. Then you would have a separate program running on your client machine to scan for market opportunities, and when it spots one, have that program send a transaction to your deployed smart contract to initiate the loan and set into action whatever logic you programmed into the smart contract that will yield a profit. Yes, it’s quite a rabbit hole indeed. It is hard to believe that something like this is even possible, let alone profitable, but it really can be. I have seen single flash loan transactions yield up to $46k in profits. That profit is irrevocably delivered back to you in a couple of seconds.
- SamBoogieNYC 6y agoYea it’s really quite wild and an exciting application of the ‘programmable money’ concept. Did some more reading. Thanks for the rundown.
- capnorange 6y agoflash loans makes markets more efficient: https://blog.instadapp.io/six-percent-instant-return/ https://blog.instadapp.io/six-percent-instant-return/