Developing Smart Contracts
npm install --save-dev hardhatnpx hardhatnpx hardhat
Welcome to Hardhat v2.2.1
✔ What do you want to do? · Create an empty hardhat.config.js
Config file created// contracts/Box.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Box {
uint256 private _value;
// Emitted when the stored value changes
event ValueChanged(uint256 value);
// Stores a new value in the contract
function store(uint256 value) public {
_value = value;
emit ValueChanged(value);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return _value;
}
}Last updated
Was this helpful?