UUPSUpgradeableMockUpgradeable.sol 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../CountersImplUpgradeable.sol";
  4. import "../../proxy/utils/UUPSUpgradeable.sol";
  5. import "../../proxy/utils/Initializable.sol";
  6. contract UUPSUpgradeableMockUpgradeable is Initializable, CountersImplUpgradeable, UUPSUpgradeable {
  7. function __UUPSUpgradeableMock_init() internal onlyInitializing {
  8. }
  9. function __UUPSUpgradeableMock_init_unchained() internal onlyInitializing {
  10. }
  11. // Not having any checks in this function is dangerous! Do not do this outside tests!
  12. function _authorizeUpgrade(address) internal virtual override {}
  13. /**
  14. * This empty reserved space is put in place to allow future versions to add new
  15. * variables without shifting down storage in the inheritance chain.
  16. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  17. */
  18. uint256[50] private __gap;
  19. }
  20. contract UUPSUpgradeableUnsafeMockUpgradeable is Initializable, UUPSUpgradeableMockUpgradeable {
  21. function __UUPSUpgradeableUnsafeMock_init() internal onlyInitializing {
  22. }
  23. function __UUPSUpgradeableUnsafeMock_init_unchained() internal onlyInitializing {
  24. }
  25. function upgradeTo(address newImplementation) external virtual override {
  26. ERC1967UpgradeUpgradeable._upgradeToAndCall(newImplementation, bytes(""), false);
  27. }
  28. function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual override {
  29. ERC1967UpgradeUpgradeable._upgradeToAndCall(newImplementation, data, false);
  30. }
  31. /**
  32. * This empty reserved space is put in place to allow future versions to add new
  33. * variables without shifting down storage in the inheritance chain.
  34. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
  35. */
  36. uint256[50] private __gap;
  37. }