StorageSlotMock.sol 988 B

1234567891011121314151617
  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 { slot.getBooleanSlot().value = value; }
  7. function setAddress(bytes32 slot, address value) public { slot.getAddressSlot().value = value; }
  8. function setBytes32(bytes32 slot, bytes32 value) public { slot.getBytes32Slot().value = value; }
  9. function setUint256(bytes32 slot, uint256 value) public { slot.getUint256Slot().value = value; }
  10. function getBoolean(bytes32 slot) public view returns (bool) { return slot.getBooleanSlot().value; }
  11. function getAddress(bytes32 slot) public view returns (address) { return slot.getAddressSlot().value; }
  12. function getBytes32(bytes32 slot) public view returns (bytes32) { return slot.getBytes32Slot().value; }
  13. function getUint256(bytes32 slot) public view returns (uint256) { return slot.getUint256Slot().value; }
  14. }