What are flash loans in DeFi?
Term loans, or flash loans, are a special type of loan available only to DeFi protocols. They allow users to borrow unlimited amounts of capital from DeFi without collateral, and there are no credit checks. The two main uses of flash loans are arbitrage and liquidation.
Arbitrage allows users to profit by using the price difference between two exchanges. For example, if the price of a Cake on PancakeSwap is $40 and OrionSwap is $35, a user can use flash credit to buy 100 Cakes from OrionSwap for $3,500. The user then resells the same assets to PancakeSwap for $4,000, repays the loan and makes a profit of $500.
Arbitrage allows users to profit by using the price difference between two exchanges. For example, if the price of a Cake on PancakeSwap is $40 and OrionSwap is $35, a user can use flash credit to buy 100 Cakes from OrionSwap for $3,500. The user then resells the same assets to PancakeSwap for $4,000, repays the loan and makes a profit of $500.
How do flash loans work on the Ethereum network?
Flash loans first appeared in 2018 at Marble, an open-source bank. The main product they offered was an instant loan with no collateral. It would give anyone access to borrow ETH or ERC-20 tokens to take advantage of arbitrage opportunities.
They didn't arrive on the Ethereum network until 2020 on the Aave platform. A transaction in Ethereum is a number of transactions that must be executed atomically. As a result, there can be only two options: in the first case, all necessary operations are successfully performed, while in the second case, the entire transaction goes into rollback. In the Ethereum network, key operations, such as sending ETH coins, ERC-20 tokens, or handling smart contracts, are performed within a transaction. Several steps may be required. The use of flash credits is also possible in the Binance Smart Chain blockchain.
What are flash loans in DeFi?
To process, the first step is to find a flash credit provider. DeFi projects such as Aave and DyDx have developed smart contracts that allow users to borrow various assets from a specific pool for a fee. The only condition is that they are redeemed within a single Ethereum transaction.
Aave, for example, requires the borrower to repay the borrowed amount with an additional 0.09% of the total amount borrowed as a commission. This commission is then split between the lenders and the platform facilitating the term loan by integrating Aave's term loan API. A portion of this commission is also exchanged for Aave tokens and burned. Since the loan must be repaid in a single transaction on Ethereum, this eliminates the risk that borrowers will not repay their borrowed amount.
Aave, for example, requires the borrower to repay the borrowed amount with an additional 0.09% of the total amount borrowed as a commission. This commission is then split between the lenders and the platform facilitating the term loan by integrating Aave's term loan API. A portion of this commission is also exchanged for Aave tokens and burned. Since the loan must be repaid in a single transaction on Ethereum, this eliminates the risk that borrowers will not repay their borrowed amount.
The security of using flash loans in DeFi
DeFi is currently on the cusp of astounding growth in the cryptocurrency space, but flash credit attacks are still a major obstacle. In the first half of 2021 alone, many DeFi systems were attacked for loans and lost millions of dollars.
Before users can access loans on DeFi platforms, liquidity providers invest tokens for which they are paid a fee. For example, for the PancakeSwap platform, liquidity providers recover a commission of 0.15% of trade fees. OrionSwap, on the other hand, pays liquidity providers a commission of 0.165%. At Binance Smart Chain, OrionSwap's commission of 0.18% is the lowest. Basically, these DeFi platforms are better suited for those who move large amounts because of the trading fees associated with these transactions.
The information gap in the DeFi space is one of the main reasons for the rise of instant loan attacks. The community needs to be constantly informed and guided as to how best to proceed in such cases. DeFi projects need to be compliant and look for long-term solutions to the growing number of instant loan attacks. While dedicated solutions are effective, the DeFi space is still young, and new vulnerabilities are likely to be discovered from time to time. Therefore, developers must do everything they can to harden their systems and make it harder for hackers to break in.
Report
My comments