News for hackers. Stuff that matters.
Re:Attacking the DeFi ecosystem with flash loans for fun and... by the_local_host on Saturday January 16, 2021 @06:29PM (#25806538)
Wouldn't a lender charge money for what is essentially an option to borrow contingent on the arbitrage transaction going through?
Re:Attacking the DeFi ecosystem with flash loans for fun and... by ryebit on Saturday January 16, 2021 @07:45PM (#25807010)
Per other responses, they frequently do charge a special fee (I think Aave charged around 0.09% at one point but can't find good ref right now).

One interesting thing I think is still under dev/consideration is adding the ability for MakerDAO to make "flash mint loans"(https://forum.makerdao.com/t/mip25-flash-mint-module/4400/9) -- essentially a flash loan where the caller can mint an arbitrary amount of DAI without having to back it with anything, so long as they pay it back + fee at the end.

There's a similiar idea being worked out for WETH10 (https://github.com/WETH10/WETH10#flash-loans), a project trying to make a feature update of the WETH (wrapped ether) token.

I'm honestly unsure WTH the impact of something like these would be, but would definitely prevent arbitrage from going too far out of bounds, since there would always be unlimited liquidity.

Multi-party atomic financial transactions are kinda insane.

Re:Attacking the DeFi ecosystem with flash loans for fun and... by AaronFriel on Saturday January 16, 2021 @06:34PM (#25806572)
So someone else starts a lender to charge slightly less. The race to the bottom happens very quickly.
Re:Attacking the DeFi ecosystem with flash loans for fun and... by the_local_host on Saturday January 16, 2021 @06:44PM (#25806637)
I don't think it makes sense to handwave the cost of an option to borrow to 0 in a scenario where arbitrage is assumed to still exist. If anything is going to become perfectly efficient first it's the arbitrage ("free money!").
Re:Attacking the DeFi ecosystem with flash loans for fun and... by qqii on Saturday January 16, 2021 @07:04PM (#25806752)
Feeless flash loans exist: https://money-legos.studydefi.com/#/dydx

Aave is 0.09%: https://aave.com/flash-loans/

It is also an important part of uniswap: https://uniswap.org/docs/v2/core-concepts/flash-swaps/

Any fees on a flash loan will disincentive closing arbitrage positions to that fee amount.

Re:Attacking the DeFi ecosystem with flash loans for fun and... by the_local_host on Saturday January 16, 2021 @08:05PM (#25807111)
This seems to good to be true. From https://money-legos.studydefi.com/#/dydx :

    Borrow x amount of tokens. (Withdraw)
    Call a function (i.e. Logic to handle flashloaned funds). (Call)
    Deposit back x (+2 wei) amount of tokens. (Deposit)
It looks like unlimited leverage for flat fee.
Re:Attacking the DeFi ecosystem with flash loans for fun and... by v64 on Saturday January 16, 2021 @08:15PM (#25807150)
This article [1] does a deep dive into how flash loan mechanics are structured using an actual Ethereum transaction as an example. This particular flash loan used dYdX, Uniswap, Aave, and Curve.fi.

Because of the atomicity of the transaction, there's no way to default on the loan. If you can't pay it back, you're never loaned the money in the first place.

[1] https://medium.com/@kentmakishima/the-43k-defi-magic-trick-f...

Re:Attacking the DeFi ecosystem with flash loans for fun and... by theptip on Saturday January 16, 2021 @09:41PM (#25807586)
In general the fee on a loan is based on two things: risk of default, and the time-value of money. It’s possible for the former to be zero, but lenders are losing money if they set the latter to zero.

Basically if you put $1000 of capital into the pot for making flash loans, then you are foregoing the X% / year that you could earn on interest, i.e. you are losing money.

It’s entirely possible that platforms are running these flash loans as a loss leader to drive adoption, but in a mature market and at scale, you’d expect there to be a small fee.

(Or just that the success-case fee covers the loss in the failure case, but that would break if the % of failed txns increased, so might not be a stable equilibrium. )

Re:Attacking the DeFi ecosystem with flash loans for fun and... by jonreem on Sunday January 17, 2021 @12:08AM (#25808322)
The time-value still comes into play in the form of eth transaction fee. If you're flash loaning to take advantage of an open arbitrage opportunity there will be other parties trying to take advantage of it, so you will pay more to get your transaction in before theirs.

For a lot of transactions like this its actually miners who can detect and rewrite these transactions to take advantage of the arbitrage opportunities first, for this reason this cost is called "miner extractable value" or MEV.

However, note this fee doesn't accrue to the lender!

Re:Attacking the DeFi ecosystem with flash loans for fun and... by xur17 on Saturday January 16, 2021 @10:36PM (#25807852)
> Basically if you put $1000 of capital into the pot for making flash loans, then you are foregoing the X% / year that you could earn on interest, i.e. you are losing money.

The funds aren't foregoing interest in all cases though. Ex: uniswap, curve, etc all require assets to be deposited, and pay depositors trading fees. These protocols could generate additional income by providing assets for flash loans without affecting the income received for acting as an amm.

Re:Attacking the DeFi ecosystem with flash loans for fun and... by theptip on Saturday January 16, 2021 @11:20PM (#25808081)
I see, good point. If the deposits are there already then it’s no loss to put them to work like this.
Re:Attacking the DeFi ecosystem with flash loans for fun and... by monokh on Saturday January 16, 2021 @08:37PM (#25807254)
What I struggle to understand is why the capital can be used with no fee (dydx - 2 wei). Why would someone contribute to such a pool that pays no interest as opposed to staking or lending somewhere else?