Angular permits end-users to take advantage of flash loans as an added feature by leveraging the capabilities of Picasso’s primary pallets — Cubic, Apollo, Mosaic, and Centauri. Flash loans were initially introduced by the Marble Protocol in 2018 as an uncollateralized loan option but were popularized by Aave and dYdX at the beginning of 2020. Flash loans enable you to borrow lending assets without collateral instantly and easily, provided that the liquidity is returned to the isolated lending pool within one transaction block.
If the flash loan is not returned, the entire transaction is reversed. Furthermore, this liquidity mechanism protects traders from market uncertainty between transactions e.g., price slippage and liquidation. The use-cases of flash loans include arbitrage trades, collateral swapping, self-liquidation, self-hedging, etc.
The growth of the cumulative volume of flash loans lent on Aave, one of the major lending platforms offering flash loans as a loan option, has been significant from Oct. 2020 to Mar. 2022. The cumulative volume has increased from over $574 million on Oct. 4, 2020, to over $5 billion on Mar. 16, 2022. The most borrowed assets on Aave are DAI, ETH, and USDC, comprising nearly 97% of the loans taken out thus far.
How can Angular support flash loans?
Current lending protocols like Aave provide the infrastructure for developers to take advantage of flash loans by building a contract that requests one. The contract will then need to execute the set of instructions and pay back the loan along with fees, all within the same transaction. Angular is a market-defining lending platform that allows end-users to benefit from flash loans without coding skills and additional loan fees. Furthermore, as a cross-chain money market, Angular taps into Composable’s liquidity-rich ecosystem to provide access to mainstream, unique, and niche assets in isolated lending pools. Flash loan functionality is an important constituent of Angular’s mission to increase streams of yield in DeFi.
How to utilize flash loans on Angular?
By utilizing Picasso’s primary primitives, Angular will be able to provide end-users with all the necessary functionalities to enable collateral swapping, arbitrage trades, self-liquidation, and self-hedging through flash loans, all from a single platform:
- Arbitrage Trades: arbitrage is the strategy of making a profit from price differences for the same asset in different money markets. To make a substantial profit, end-users will need significant capital to get started — this is where flash loans come into the picture. For example, let’s say an end-user finds an arbitrage opportunity between DEX 1 and DEX 2 for Assets X and Y where 1 X = 0.9927 Y on DEX 2 and 0.8057 Y on DEX 1. Here is how the end-user should proceed:
- Borrow 100 X on Angular
- Swap 100 X for 122.83649 Y on DEX 1 via Angular
- Swap 122.83649 Y for 122.83429 X on DEX 2 via Angular
- Repay 100 X on Angular
- Keep 22.83429 X as profit
- Collateral Swapping: collateral swapping refers to the quick swapping of the collateral backing an end-user’s loan for another type of collateral. Collateral swapping on Angular enables you to simply swap collateral to keep a trading position and add a passive “long” by holding another asset as collateral. If the new collateral asset outperforms the original one it leads to a higher profit. Let’s say an end-user has taken a loan of Asset X with Asset Y as collateral on Angular. Here is an example of how collateral swapping will work:
- Take a flash loan in Asset Y on Angular
- Swap for Asset Z on a DEX via Angular
- Deposit Z as collateral on Angular
- Withdraw Y (original collateral) from the respective collateral pool on Angular
- Repay the flash loan
- Self-Liquidation: if an end-user has taken a loan on Angular and the price of the collateral asset drops quickly and nears the liquidation point, the end-user can take a flash loan and self-liquidate the loan. While the end-user will lose the collateral, he will avoid paying the penalty fee.
- Self-Hedging: self-hedging is ideal for end-users who are willing to take risks in leveraging long. An end-user can decide to use Angular to wind down a Collateralized Debt Position (CDP). Here is how:
- An end-user can take a flash loan in Asset X on Angular
- Cover his old CDP in Asset Y with borrowed X
- Get Y back and enter a new CDP
- Withdraw some Y and convert it to X via Angular
- Repay the flash loan
Mitigating price oracle manipulation attack vectors
There are several documented cases of flash loans being used to fund attacks on DeFi protocols. The real issue here is centralized price oracles that do not offer adequate market coverage — flash loans only provide the funding to execute such attacks. For example, as recently as Mar. 15, 2022, Deus Finance DAO suffered a price oracle manipulation attack. The attacker manipulated the price oracle for the USDC/DEI pair and made away with nearly $3 million DEI of profit. On Oct. 2, 2021, an attacker executed a similar price oracle manipulation attack on Twindex across two transactions to gain a profit of nearly $550,000.
Price oracle manipulation attacks are preventable by leveraging a decentralized oracle solution with proper market coverage — this is where Apollo comes into the frame. Apollo is the first MEV-resistant oracle pallet in the DotSama ecosystem and a vital cog in Angular’s flash loan functionality, as it is a tamper-proof oracle that not only queries, verifies, and authenticates payments, but also aggregates the prices of a lending asset to arrive at an aggregated price point that is a clear reflection of market-wide trading activity and untouchable by flash loans, thereby mitigating price oracle manipulation attack vectors.
Flash loans enable end-users to avail of loans without providing collateral upfront. Flash loans have several use cases and are powering access to capital for all DeFi end-users while protecting the interests of both lenders and traders. As a cross-chain money market hub, Angular is positioned as the first flash loan provider that offers flash loans for any assets compatible with Composable’s ecosystem, without the need for coding knowledge to create flash loan contracts and sans an additional loan fee. Flash loans are an important part of Angular’s quest to empower DeFi end-users with new streams of yield.