News for hackers. Stuff that matters.
Re:Ethereum 2.0 launches by kgin on Tuesday December 01, 2020 @07:59PM (#25272106)
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.

Re:Ethereum 2.0 launches by downandout on Tuesday December 01, 2020 @08:04PM (#25272137)
They 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.
Re:Ethereum 2.0 launches by socialentity on Wednesday December 02, 2020 @02:23AM (#25274001)
How 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?
Re:Ethereum 2.0 launches by downandout on Wednesday December 02, 2020 @12:15PM (#25278620)
It 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.

Re:Ethereum 2.0 launches by SamBoogieNYC on Wednesday December 02, 2020 @03:31AM (#25274382)
Wow this sent me down a rabbit hole.

How are the transactions composed, with a smart contract/s, in combination with Dex API’s?

Re:Ethereum 2.0 launches by downandout on Wednesday December 02, 2020 @12:08PM (#25278532)
Flash 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.

Re:Ethereum 2.0 launches by SamBoogieNYC on Thursday December 03, 2020 @03:33PM (#25294374)
Yea it’s really quite wild and an exciting application of the ‘programmable money’ concept. Did some more reading. Thanks for the rundown.
Re:Ethereum 2.0 launches by capnorange on Wednesday December 02, 2020 @12:55AM (#25273644)
flash loans makes markets more efficient:

https://blog.instadapp.io/six-percent-instant-return/