This Project is a comprehensive DeFi Lending & Borrowing decentralized application (DApp) operating on Ethereum's Sepolia Testnet. The platform facilitates lending and borrowing of various crypto assets, while offering opportunities to earn passive income as interest on deposited funds.
This fully on-chain DeFi app allows users to effortlessly deposit their coins (ETH) or tokens into the smart contract, and receive rewards based on the amount of tokens they supply. In addition, this enables users to borrow tokens, making it a versatile and user-friendly platform for all crypto enthusiasts.
- Built on Ethereum Blockchain
- Solidity
- Javascript
- Typescript
- Chainlink Price Oracles
- Openzeppelin (ERC20 Tokens, Ownable, Reentrancy Guards)
- Hardhat
- Etherjs
- Metamask
- Infura Web3API
- Next JS
- Tailwind CSS
- HTML
- Slither, Mythril, Echidna
- /components - contains the front-end application
- /context - contains the front-end application wrapper javascript
- /contracts - contains the solidity contract
- /scripts - deployment scripts
- /pages - Next Js Main rendering pages and components
- /tests - contains tests for the solidity contracts
- package.json - node modules to be installed, etc.
- hardhat.config.js - solidity version and run information, deployment network configuration
- addresses.js - addresses exported for use use with hardhat local installed contracts
- .env - To store Infura/Alchemy API keys and your private key
-
Metamask : Install Metamask wallet extension on your browser ( Chrome recommended ) - The App will prompt you to install one if it is not.
-
Add Sepolia Testnet to MetaMask
To add the Sepolia testnet to MetaMask, click the network button at the top of your wallet and click “Add Network”
Under the Networks, at the bottom of the page, click “Add a network manually”
Add network configuration details along with the following information
Network name : Sepolia test network New RPC URL : https://sepolia.infura.io/v3/ Chain ID : 11155111 Currency symbol : SepoliaETH Block explorer URL : https://sepolia.etherscan.io
See image below for reference
-
Get Some Sepolia ETH from the Faucets below for testing the App
-
Clone this repo :
-
Go to the root directory and install all node packages
cd main
npm install
-
Infura API key Follow this article to get Infura API key
Select Sepolia testnet and copy the url
-
Get Your Metamask wallet private key : https://support.metamask.io/hc/en-us/articles/360015289632
-
Create a new .env file in the root directory
Paste the Infura Sepolia API key and your metmask accounts private key into .env file
-
Deploy the Dapp on Sepolia Testnet
npx hardhat run scripts/deploy-sepolia.js --network sepolia
- Add the sepolia deploy addresses into address.js file
- Start NextJs Node Server
npm run dev
Following steps show to get this project on to your machine and bring it up:
-
Metamask : Install Metamask wallet extension on your browser ( Chrome recommended ) - The App will prompt you to install one if it is not.
-
Clone this repo :
-
Go to the root directory and install dependent node packages
cd main
npm install
- Compile, Test and Run the hardhat node
npx hardhat compile
npx hardhat test
npx hardhat node
- Deploy on the Hardhat localhost
npx hardhat run scripts/deploy.js --network localhost
- Add the localhost deploy addresses into address.js file
- Start the NextJs Node Server. Open http://localhost:3000 to view it in your browser.
npm run dev
- To run hardhat tests to verify the working of Dapp, run the script below
npx hardhat test