This repository contains a set of Solidity contracts along with corresponding test cases for each contract. Below is a brief description of each contract and its purpose:
-
Attacker.sol: This contract represents a potential attacker contract, which may interact with other contracts in unexpected ways. Test cases should ensure that other contracts are resilient against potential attacks.
-
Bank.sol: The Bank contract presumably implements banking functionalities such as deposit, withdrawal, and balance inquiry. Test cases should cover various scenarios to validate the correctness and security of the banking operations.
-
BankNonReentrant.sol: Similar to Bank.sol, but with additional protection against reentrancy attacks. Test cases should validate the effectiveness of the non-reentrant mechanism.
-
Counter.sol: A simple counter contract that allows incrementing and decrementing a counter value. Test cases should ensure that counter operations work as expected and handle edge cases properly.
-
Escrow.sol: An escrow contract facilitates secure transactions by holding funds until certain conditions are met. Test cases should cover different transaction scenarios and verify the escrow's functionality.
-
FlashLoan.sol: This contract implements a flash loan mechanism, allowing users to borrow funds temporarily without collateral. Test cases should validate the correctness and security of flash loan operations.
-
FlashLoanReceiver.sol: A contract designed to receive and handle flash loans. Test cases should ensure that the flash loan receiver contract behaves as expected when interacting with flash loan providers.
-
RealEstate.sol: This contract represents a real estate marketplace or property ownership system. Test cases should cover various real estate transactions, including buying, selling, and transferring ownership.
-
Token.sol: A basic ERC20 token contract that implements a standard token interface. Test cases should verify the functionality of token transfers, approvals, and other ERC20 standard operations.
-
Also, if you have any confusion about which contacts are linked to other check the
Diagram for Contacts
directory.
To run the test suite, ensure that you have Node installed (if you dont have node follow this link to download node and add it to the path i.e., system variables)
Also Hardhat is required
More things about hardhat can be found here if you are facing any issues
To set up Hardhat for your project, follow these steps:
-
Open Terminal: Launch your terminal application.
-
Change Directory: Navigate to your project directory using the
cd
command. For example:cd /path/to/your/project/directory
-
Install Hardhat: Run the following Script to install Hardhat
npm install hardhat
or
npm install --save-dev hardhat
or
npm install
this will insall the required dependencies and modules required
Then, execute the following command to run all tests:
npx hardhat test
This command will execute all test cases defined in the test/
directory and provide feedback on the contract behavior.
Feel free to read more about secure deploy at Open Zepplin
Feel free to extend the test suite or provide additional contracts as needed. Happy testing!
Project Inspiration from https://github.com/OpenZeppelin/damn-vulnerable-defi