FlashLoanDApp
About: FlashLoanDApp is a decentralized application (DApp) that enables users to perform flash loans on the Ethereum blockchain. The DApp uses smart contracts written in Solidity and is deployed on the Sepolia testnet using Truffle and Alchemy.
Features Flash Loans: Borrow and repay tokens within the same transaction. Custom ERC20 Token: A sample token (MyToken) is provided for testing purposes. Smart Contract Interaction: Scripts to deploy and interact with smart contracts.
Installation Clone the repository: git clone https://github.com/llakterian/FlashLoanDApp.git cd FlashLoanDApp
Install dependencies npm install
Configure environment variables Create a .env file in the root directory with your Alchemy API key and other necessary configurations.
Usage Compile Contracts Compile the smart contracts using Truffle: truffle compile
Deploy Contracts Deploy the smart contracts to the Sepolia testnet: truffle migrate --network sepolia
Test Contracts Run the tests for the smart contracts: truffle test
Interact with Contracts Scripts for interacting with the deployed contracts are in the scripts/ directory. Run the interaction script: node scripts/interact.js
Project Structure The repository is organized as follows:
contracts/: Contains the Solidity smart contracts.
MyToken.sol: The custom ERC20 token contract. FlashLoan.sol: The flash loan contract. FlashLoanReceiver.sol: The receiver contract for flash loans. migrations/: Migration scripts to deploy the contracts.
1_initial_migration.js: Migration script for deploying MyToken. 2_deploy_contracts.js: Migration script for deploying FlashLoan and FlashLoanReceiver. test/: Contains the test scripts for the smart contracts.
myTokenTest.js: Test script for the MyToken contract. flashLoanTest.js: Test script for the FlashLoan and FlashLoanReceiver contracts. scripts/: Scripts for deploying and interacting with the smart contracts.
deploy.js: Script to deploy the contracts. interact.js: Script to interact with the deployed contracts.
Contributing Contributions are welcome! Please fork the repository and submit a pull request for any features, bug fixes, or enhancements.
License This project is licensed under the MIT License.