Skip to content

Instantly share code, notes, and snippets.

@viraj124
Created November 12, 2020 09:01
Show Gist options
  • Save viraj124/7a4afc15ffd3c3217ad4a4eaef6512a2 to your computer and use it in GitHub Desktop.
Save viraj124/7a4afc15ffd3c3217ad4a4eaef6512a2 to your computer and use it in GitHub Desktop.
pragma solidity ^0.6.0;
contract Box {
uint256 private value;
// Emitted when the stored value changes
event ValueChanged(uint256 newValue);
// Stores a new value in the contract
function store(uint256 newValue) public {
value = newValue;
emit ValueChanged(newValue);
}
// Reads the last stored value
function retrieve() public view returns (uint256) {
return value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment