Skip to content

Instantly share code, notes, and snippets.

@dobestan
Created October 1, 2022 12:28
Show Gist options
  • Save dobestan/845aee2c0cba2737fde17814add0df6d to your computer and use it in GitHub Desktop.
Save dobestan/845aee2c0cba2737fde17814add0df6d to your computer and use it in GitHub Desktop.
Decipher Solidity #20221001
// 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