UUPSUpgradeableMock.sol 946 B

1234567891011121314151617181920212223242526272829303132
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.19;
  3. import "../../proxy/utils/UUPSUpgradeable.sol";
  4. contract NonUpgradeableMock {
  5. uint256 internal _counter;
  6. function current() external view returns (uint256) {
  7. return _counter;
  8. }
  9. function increment() external {
  10. ++_counter;
  11. }
  12. }
  13. contract UUPSUpgradeableMock is NonUpgradeableMock, UUPSUpgradeable {
  14. // Not having any checks in this function is dangerous! Do not do this outside tests!
  15. function _authorizeUpgrade(address) internal override {}
  16. }
  17. contract UUPSUpgradeableUnsafeMock is UUPSUpgradeableMock {
  18. function upgradeTo(address newImplementation) public override {
  19. ERC1967Upgrade._upgradeToAndCall(newImplementation, bytes(""), false);
  20. }
  21. function upgradeToAndCall(address newImplementation, bytes memory data) public payable override {
  22. ERC1967Upgrade._upgradeToAndCall(newImplementation, data, false);
  23. }
  24. }