forked from OpenZeppelin/openzeppelin-contracts
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathUUPSUpgradeableMock.sol
More file actions
32 lines (24 loc) · 916 Bytes
/
UUPSUpgradeableMock.sol
File metadata and controls
32 lines (24 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "../../proxy/utils/UUPSUpgradeable.sol";
contract NonUpgradeableMock {
uint256 internal _counter;
function current() external view returns (uint256) {
return _counter;
}
function increment() external {
++_counter;
}
}
contract UUPSUpgradeableMock is NonUpgradeableMock, UUPSUpgradeable {
// Not having any checks in this function is dangerous! Do not do this outside tests!
function _authorizeUpgrade(address) internal override {}
}
contract UUPSUpgradeableUnsafeMock is UUPSUpgradeableMock {
function upgradeTo(address newImplementation) public override {
_upgradeToAndCall(newImplementation, bytes(""), false);
}
function upgradeToAndCall(address newImplementation, bytes memory data) public payable override {
_upgradeToAndCall(newImplementation, data, false);
}
}