The TestContract
is designed to interact with Caerus's storage slots. It allows users to set and get a storage variable (slot0
) and offers a method to fetch the storage value based on a historical block number.
- setSlot0(uint256 _slot0)
- Sets the value of
slot0
to the provided integer_slot0
.
- getSlot0()
- Returns the current value stored in
slot0
.
- getSlot0Caerus(uint256 blockNumber)
- Fetches the value of
slot0
at a specified block number. - Throws an error if the provided block number is greater than or equal to the current block number.
- Node.js v12+ LTS and npm (comes with Node)
- Hardhat
Clone the repository:
git clone https://github.com/Caerus-Chain/test-contract
Navigate to the project folder:
cd test-contract
Install dependencies:
npm install
- Review the
.example.env
file. - Create a
.env
file based on the example and adjust the values as needed.
For Linux or macOS:
cp .example.env .env
For Windows:
copy .example.env .env
Compile the smart contracts using Hardhat:
npx hardhat compile
Run the following command to execute the contract tests. Make sure you've written the tests in your Hardhat project's test
directory.
npx hardhat test
Run the following command to compile the contracts using the Solidity compiler and deploy the TestContract
to your Caerus network.
npx hardhat run scripts/deploy.js --network caerus
Before running the script, make sure to replace the placeholder contract address in test.js
with your deployed contract address.
npx hardhat run scripts/test.js --network caerus
- Use the
setSlot0
function to change the value ofslot0
. - Use the
getSlot0
andgetSlot0Caerus
functions to fetch the value stored inslot0
.
If you would like to contribute to the project, please fork the repository, make your changes, and then submit a pull request. We appreciate all contributions and feedback!