Skip to content

Instantly share code, notes, and snippets.

@mjtbkh
Created January 28, 2022 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjtbkh/fc08563ca5233e43b50a98751e0b9029 to your computer and use it in GitHub Desktop.
Save mjtbkh/fc08563ca5233e43b50a98751e0b9029 to your computer and use it in GitHub Desktop.
A simple smart-contract with 2 methods to read and write a private variable.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts/access/Ownable.sol";
contract SimpleStorage is Ownable {
uint64 private _storage;
function set(uint64 input) public onlyOwner {
_storage = input;
}
function get() public view returns (uint64) {
return _storage;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment