Created
November 12, 2020 09:01
-
-
Save viraj124/7a4afc15ffd3c3217ad4a4eaef6512a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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