ghConnectHub

Getting started with Flash Loans

analyticagh |
Technology & Gadgets

A Flash loan is a feature that enables anyone to gain access to uncollateralized money or borrow money on the blockchain. Flash loans are used in Defi for arbitrage opportunities, self liquidation and collateral swaps. With flash loans, money is borrowed and it has to be repaid within the same transaction in an atomic where there is profitability in the transaction, if there is no profit therein, the flash loan and the transaction within all fail.

Whenever there is a price discrepancy between decentralized Defi exchanges, there exists a price variance, the price variance is as a result of different cost of liquidity and amount of liquidity within a pool.

A Flash loan scenario: If ETH/DAI pair is trading on exchangeA at 1.25/1 and trading at 1.20/1 on exchangeB, there is a price discrepancy. An arbitrageur will then borrow 10DAI on Aave buy ETH on exchangeB to get 12ETH and sell the 12ETH for DAI on exchangeA to get 15DAI. He then repays the 10DAI borrowed from Aave and makes a profit of 5Dai (excluding gas price and 0.09% Aave fee). This is a profitable trade.

With Flash loan request, you need not have any collateral an account or give out any personal information. Moreover, a considerable amount of assets can be given out to users as long as the borrowed assets can be paid back within the current transaction.

Some Defi protocols offering Flash loans are listed below:

  1. Aave
  2. Uniswap
  3. Sushiswap
  4. Dydx
  5. Multiplier finance
The platforms listed above offer programmable flash loans using smart contracts on the blockchain.

So, what if you don't know how to programme smart contracts?

Smart contracts are coded in solidity, with specific business logic on transaction execution.
For users who are not tech savvy, there exists Furucombo, a platform that you can drag and drop to create where and how you want to execute your Defi smart contracts. The platform integrates your requests behind the hood to execute your request, thus for a flash loan. It should be a profitable transaction.

Costs for Executing a Flash loan

On the Ethereum blockchain and Binance Smart Chain, to execute smart contracts you need to pay gas. Gas is the amount of currency in wei needed to incentivize miners to validate your transactions. Sometimes, Gas fees may be very high that any arbitrage opportunity realized may not be worthwhile because flash loans interact with other smart contracts.

Most flash loans charge a percentage upto 0.3% of the amount being requested or swapped and others charge a small fee in wei for accessing the liquidity on the protocol.


Conclusion

Flash loan opportunities do not last for long, a delay in executing flash loans will lead to wasted gas cost as the flash loan will not be profitable and the opportunity will revert. Most Successful flash loan transactions make use of bots to monitor the decentralized exchange, this allow for speedy transactions.