This article is derived from a chapter in the free eBook explaining DeFi technologies:
DeFi Demystified | An Introduction To Decentralized Finance
DeFi borrowing and lending differs from traditional finance where institutions will lend funds based on credit ratings. In DeFi accounts are anonymous, there are no credit ratings to assess risk. Borrowing and lending is more often carried out using over-collateralised loans.
A user will deposit digital assets to a DeFi Lending smart contract and will receive a yield for lending those assets. Currently lending USD stablecoins on various DeFi protocols can get between 5-20% APY far exceeding the interest paid in traditional finance.
A second user will deposit ETH as collateral to the smart contract and can then borrow up to a specified percentage of around 80% of the value of the ETH in stablecoins. If the value of ETH goes down below a liquidation threshold the collateral is liquidated to pay back the lender.
So what is the point in borrowing funds less funds than you deposit as collateral. The key here is that you can deposit a range of different tokens as collateral and still receive any gains while they are being held. If the ETH used as collateral doubles in price then the borrower still gets back the same amount of ETH when they pay back the loan with interest.
One common use is for tax planning as borrowed funds aren’t applicable to capital gains tax in some jurisdictions. A user can deposit cryptocurrency they are holding and borrow on those funds for material purchases without exposing themselves to a large tax bill.
The Summer Of DeFi
16th June 2020
If there was one moment that kickstarted the DeFi movement this was it. Compound was already a very successful decentralized borrowing and lending platform. It was facing tough competition from similar platforms like Aave and MakerDAO. To differentiate themselves and incentivise the use of their platform they started distributing a governance token to borrowers and lenders.
For a time you could literally get paid to borrow funds because the governance tokens earnt were worth more than the interest due. The funds borrowed could then be recycled back into the lending platform or put into more aggressive yield farming strategies.
Flash Loans
Most borrowers will pay back their loan and release their collateral after a few months or years. However DeFi introduced a new type of borrowing where the loan only lasts a few seconds. A flash loan can be taken out to fund a smart contract with huge amounts of capital as long as the loan is repaid in the same block of transactions. If the loan isn’t paid back the entire transaction simply fails. This can be used to execute highly leveraged trades and manipulate prices on decentralised exchanges and liquidity pools.
Flash loans are possible because smart contract transactions can be batched to process in order. Time stands still while the transactions are processed and failed batches of transactions are reverted atomically. When transactions fail a gas fee is still charged.
Lending protocols like Aave and dYdX currently offers flash loans from a billion dollar asset pool giving everyone access to huge amounts of capital on demand. You too can be a billionaire for at least a few seconds.
This capital can be used for good and bad.
An arbitrage trader can take out a flash loan for a stablecoin and then use these funds to swap for token A, in the same block they will swap token A for token B and then token B back to stablecoins. If the triangular arbitrage trade resulted in more stablecoins being received they will pay back the loan in the same block and profit the remaining funds.
Most famously flash loan attacks have been used to manipulate price tracking on liquidity pools to drain assets from them and steal the funds. These types of attacks are hard to prevent however users can insure against them and oracles can provide external price feeds to keep liquidity pool mechanisms in check.
This article is derived from a chapter in the free eBook explaining DeFi technologies:
DeFi Demystified | An Introduction To Decentralized Finance