Skip to content

Instantly share code, notes, and snippets.

@mjtbkh
Created January 31, 2022 17:13
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/40ddfc7de9c82cd92f04e209c06a6f7f to your computer and use it in GitHub Desktop.
Save mjtbkh/40ddfc7de9c82cd92f04e209c06a6f7f to your computer and use it in GitHub Desktop.
A simple UUPS upgradeable smart-contract
// 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