Snippets

Mojtaba Khodami SimpleStorageV1

Updated by Mojtaba Khodami

File SimpleStorageV1.sol Modified

  • Ignore whitespace
  • Hide word diff
         override
     {}
 
-    uint64 storage private;
+    uint64 _storage private;
 
     function set(uint64 input) public onlyOwner {
-        storage = input;
+        _storage = input;
     }
 
     function get() public returns (uint64) {
-        return storage;
+        return _storage;
     }
 }
Created by Mojtaba Khodami

File SimpleStorageV1.sol Added

  • Ignore whitespace
  • Hide word diff
+// 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;
+    }
+}
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.