Created
January 31, 2022 17:13
-
-
Save mjtbkh/40ddfc7de9c82cd92f04e209c06a6f7f to your computer and use it in GitHub Desktop.
A simple UUPS upgradeable smart-contract
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.2; | |
import "@openzeppelin/contracts-upgradeable@4.4.2/proxy/utils/Initializable.sol"; | |
import "@openzeppelin/contracts-upgradeable@4.4.2/access/OwnableUpgradeable.sol"; | |
import "@openzeppelin/contracts-upgradeable@4.4.2/proxy/utils/UUPSUpgradeable.sol"; | |
contract SimpleStorageV1 is Initializable, OwnableUpgradeable, UUPSUpgradeable { | |
function initialize() initializer public { | |
__Ownable_init(); | |
__UUPSUpgradeable_init(); | |
} | |
function _authorizeUpgrade(address newImplementation) | |
internal | |
onlyOwner | |
override | |
{} | |
uint64 _storage private; | |
function set(uint64 input) public onlyOwner { | |
_storage = input; | |
} | |
function get() public returns (uint64) { | |
return _storage; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment