A flash loan protocol based on Aave and Compound.
You can learn more about how Aave works at a high level from this video.
The ⚡️ThunderLoan⚡️ protocol is meant to do the following:
Liquidity providers can deposit
assets into ThunderLoan
and be given AssetTokens
in return. These AssetTokens
gain interest over time depending on how often people take out flash loans!
What is a flash loan?
A flash loan is a loan that exists for exactly 1 transaction. A user can borrow any amount of assets from the protocol as long as they pay it back in the same transaction. If they don't pay it back, the transaction reverts and the loan is cancelled.
Users additionally have to pay a small fee to the protocol depending on how much money they borrow. To calculate the fee, we're using the famous on-chain TSwap price oracle.
We are planning to upgrade from the current ThunderLoan
contract to the ThunderLoanUpgraded
contract. Please include this upgrade in scope of a security review.
git --version
and you see a response like git version x.x.x
forge --version
and you see a response like forge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)
git clone https://github.com/Cyfrin/6-thunder-loan-audit
cd 6-thunder-loan-audit
make
forge test
forge coverage
and for coverage based testing:
forge coverage --report debug
#-- interfaces
| #-- IFlashLoanReceiver.sol
| #-- IPoolFactory.sol
| #-- ITSwapPool.sol
| #-- IThunderLoan.sol
#-- protocol
| #-- AssetToken.sol
| #-- OracleUpgradeable.sol
| #-- ThunderLoan.sol
#-- upgradedProtocol
#-- ThunderLoanUpgraded.sol
getCalculatedFee
can result in 0 fees for very small flash loans. We are OK with that. There is some small rounding errors when it comes to low fees