StorageSlotMockUpgradeable.sol 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/StorageSlotUpgradeable.sol";
  4. import "../proxy/utils/Initializable.sol";
  5. contract StorageSlotMockUpgradeable is Initializable {
  6. function __StorageSlotMock_init() internal onlyInitializing {
  7. __StorageSlotMock_init_unchained();
  8. }
  9. function __StorageSlotMock_init_unchained() internal onlyInitializing {
  10. }
  11. using StorageSlotUpgradeable for bytes32;
  12. function setBoolean(bytes32 slot, bool value) public {
  13. slot.getBooleanSlot().value = value;
  14. }
  15. function setAddress(bytes32 slot, address value) public {
  16. slot.getAddressSlot().value = value;
  17. }
  18. function setBytes32(bytes32 slot, bytes32 value) public {
  19. slot.getBytes32Slot().value = value;
  20. }
  21. function setUint256(bytes32 slot, uint256 value) public {
  22. slot.getUint256Slot().value = value;
  23. }
  24. function getBoolean(bytes32 slot) public view returns (bool) {
  25. return slot.getBooleanSlot().value;
  26. }
  27. function getAddress(bytes32 slot) public view returns (address) {
  28. return slot.getAddressSlot().value;
  29. }
  30. function getBytes32(bytes32 slot) public view returns (bytes32) {
  31. return slot.getBytes32Slot().value;
  32. }
  33. function getUint256(bytes32 slot) public view returns (uint256) {
  34. return slot.getUint256Slot().value;
  35. }
  36. uint256[50] private __gap;
  37. }