We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 893e362 commit db8fba2Copy full SHA for db8fba2
1 file changed
src/LogicV2.sol
@@ -0,0 +1,29 @@
1
+// SPDX-License-Identifier: MIT
2
+pragma solidity ^0.8.0;
3
+
4
+// Upgraded Logic Contract (Version 2)
5
+contract LogicV2 {
6
+ uint256 public counter;
7
8
+ // Initializes the counter, compatible with V1
9
+ function initialize(uint256 _initialValue) external {
10
+ require(counter == 0, "Already initialized");
11
+ counter = _initialValue;
12
+ }
13
14
+ // Increments the counter
15
+ function increment() external {
16
+ counter += 1;
17
18
19
+ // Decrements the counter (new feature)
20
+ function decrement() external {
21
+ require(counter > 0, "Counter underflow");
22
+ counter -= 1;
23
24
25
+ // Returns the counter value
26
+ function getCounter() external view returns (uint256) {
27
+ return counter;
28
29
+}
0 commit comments