Skip to content

egolessengineer/thunder-smartcoin

Repository files navigation

Thunder Loans


thunder-loans


A flash loan protocol based on Aave and Compound.

About

The ⚡️ThunderLoan⚡️ protocol is meant to do the following:

  1. Give users a way to create flash loans
  2. Give liquidity providres a way to earn money off their capital

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.

Roles

  • Owner: The only one who can change the feeAddress, denominated by the _owner variable.
  • Fee User: The user who takes a cut of raffle entrance fees. Denominated by the feeAddress variable.
  • Raffle Entrant: Anyone who enters the raffle. Denominated by being in the players array.

Getting Started$$

Requirements

  • git
    • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
  • foundry
    • You'll know you did it right if you can run forge --version and you see a response like forge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)

Quickstart

git clone https://github.com/Cyfrin/6-thunder-loan-audit
cd 6-thunder-loan-audit
make 

Optional Gitpod

If you can't or don't want to run and install locally, you can work with this repo in Gitpod. If you do this, you can skip the clone this repo part.

Open in Gitpod

Usage

Testing

forge test

Test Coverage

forge coverage

and for coverage based testing:

forge coverage --report debug

Audit Scope Details

  • Commit Hash: 026da6e73fde0dd0a650d623d0411547e3188909
  • In Scope:
├── interfaces
│   ├── IFlashLoanReceiver.sol
│   ├── IPoolFactory.sol
│   ├── ITSwapPool.sol
│   #── IThunderLoan.sol
├── protocol
│   ├── AssetToken.sol
│   ├── OracleUpgradeable.sol
│   #── ThunderLoan.sol
#── upgradedProtocol
    #── ThunderLoanUpgraded.sol
  • Solc Version: 0.8.20
  • Chain(s) to deploy contract to: Ethereum