This repository contains the StorageVictimResolved
smart contract, designed for storing and retrieving user data. The contract is written in Solidity and is intended for deployment on the Ethereum blockchain, specifically on the Sepolia test network. This project is set up using Hardhat, a development environment to compile, deploy, test, and debug Ethereum software.
Before you begin, ensure you have the following installed:
To set up the project on your local machine:
- Clone the repository:
git clone https://github.com/Lukman-01/Contract-Auditing.git
- Navigate to the project directory:
cd Contract-Auditing
- Install the dependencies:
npm install
-
Create a
.env
file in the root directory of the project. -
Add the following environment variables to the
.env
file:ALCHEMY_HTTP_URL=YourAlchemyHTTPURLForSepolia PRIVATE_KEY=YourEthereumAccountPrivateKey
Replace
YourAlchemyHTTPURLForSepolia
with your Alchemy HTTP URL for the Sepolia network andYourEthereumAccountPrivateKey
with your private key.⚠️ Important: Never commit your.env
file or expose your private keys publicly.
The StorageVictimResolved
contract includes functions for storing and retrieving user-associated data. It's structured with the following key components:
- Owner: The deployer of the contract becomes the owner.
- Store Function: Allows users to store a uint256 amount.
- Retrieve Function: Allows users to retrieve their stored amount.
To compile the contract, run:
npx hardhat compile
To deploy the contract to the Sepolia network:
- Make sure your
.env
file is correctly set up with Alchemy URL and private key. - Run the deployment script:
npx hardhat run --network sepolia scripts/deploy.js
To run the tests for the contract:
npx hardhat test
- Deploy.js: Script to deploy the contract on the Sepolia network.
- Test Files: Located in the
test
directory, used for testing the contract's functionalities.