StorageSlotMock.sol 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // SPDX-License-Identifier: MIT
  2. pragma solidity ^0.8.0;
  3. import "../utils/StorageSlot.sol";
  4. contract StorageSlotMock {
  5. using StorageSlot for bytes32;
  6. function setBoolean(bytes32 slot, bool value) public {
  7. slot.getBooleanSlot().value = value;
  8. }
  9. function setAddress(bytes32 slot, address value) public {
  10. slot.getAddressSlot().value = value;
  11. }
  12. function setBytes32(bytes32 slot, bytes32 value) public {
  13. slot.getBytes32Slot().value = value;
  14. }
  15. function setUint256(bytes32 slot, uint256 value) public {
  16. slot.getUint256Slot().value = value;
  17. }
  18. function getBoolean(bytes32 slot) public view returns (bool) {
  19. return slot.getBooleanSlot().value;
  20. }
  21. function getAddress(bytes32 slot) public view returns (address) {
  22. return slot.getAddressSlot().value;
  23. }
  24. function getBytes32(bytes32 slot) public view returns (bytes32) {
  25. return slot.getBytes32Slot().value;
  26. }
  27. function getUint256(bytes32 slot) public view returns (uint256) {
  28. return slot.getUint256Slot().value;
  29. }
  30. }