Created
October 1, 2022 12:28
-
-
Save dobestan/845aee2c0cba2737fde17814add0df6d to your computer and use it in GitHub Desktop.
Decipher Solidity #20221001
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
// SPDX-License-Identifier: MIT | |
pragma solidity >= 0.8.0; | |
contract Counter { | |
uint private _value; | |
address public owner; | |
constructor() { | |
owner = msg.sender; | |
} | |
function current() public view returns (uint) { | |
return _value; | |
} | |
function increment() public onlyOwner { | |
_value = _value + 1; | |
} | |
function decrement() public onlyOwner { | |
require(_value > 0, "Value should be positive"); | |
_value = _value - 1; | |
} | |
modifier onlyOwner() { | |
require(msg.sender == owner, "Only Owner"); | |
_; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment