The SimpleStorage project is a basic Ethereum smart contract built using Solidity. It allows users to store and retrieve a single uint256
value on the blockchain. This project uses the Hardhat framework for development, testing, and deployment.
-
contracts/: Contains the Solidity smart contracts.
SimpleStorage.sol
: The main contract that allows storing and retrieving a value.
-
scripts/: Contains scripts for deployment.
deploy.js
: Script to deploy theSimpleStorage
contract to the local network.
-
test/: Contains the test files.
simpleStorage-test.js
: Unit tests for theSimpleStorage
contract using Hardhat and Chai.
- Node.js and npm installed.
- Hardhat framework set up in your project.
-
Clone the repository:
git clone https://github.com/isommie-web3-projects/simplestorage.git cd simplestorage
-
Install dependencies:
npm install
-
Compile the smart contract:
npx hardhat compile
-
Start the Hardhat node:
npm run node
-
Deploy the contract:
npm run deploy:local
After deployment, you should see the address of the deployed contract in the console output.
You can run the tests to ensure the contract works as expected:
-
Run the tests:
npm run test
-
Run tests with gas report:
npm run test:gas
- Compile the contract:
npx hardhat compile
- Run tests:
npm run test
- Deploy to local network:
npm run deploy:local
- Start local Hardhat node:
npm run node
- Get Hardhat help:
npm run hardhat:help
This project is licensed under the MIT License.
Edwin Anajemba
Blockchain Engineer & Smart Contract Auditor