-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2a529d
commit 358e88d
Showing
6 changed files
with
1,149 additions
and
143 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// SPDX-License-Identifier: GPL-3.0 | ||
|
||
pragma solidity >=0.7.0 <0.9.0; | ||
|
||
/** | ||
* @title Storage | ||
* @dev Store & retrieve value in a variable | ||
*/ | ||
|
||
contract Storage { | ||
uint256 number; | ||
|
||
|
||
event storedNumber( | ||
address indexed _from, | ||
uint256 indexed _oldNumber, | ||
uint256 indexed _number | ||
); | ||
|
||
/** | ||
* @dev Store value in variable | ||
* @param num value to store | ||
*/ | ||
function store(uint256 num) public { | ||
uint256 old = number; | ||
number = num; | ||
emit storedNumber(msg.sender, old, num); | ||
|
||
} | ||
|
||
/** | ||
* @dev Return value | ||
* @return value of 'number' | ||
*/ | ||
function retrieve() public view returns (uint256) { | ||
return number; | ||
|
||
} | ||
} |
Oops, something went wrong.