Files
openzeppelin-contracts/contracts/mocks/StorageSlotMock.sol
Hadrien Croubois b0cf6fbb7a Add Prettier for linting and fix Solhint config (#2697)
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
2021-06-07 12:33:03 -03:00

42 lines
1.1 KiB
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/StorageSlot.sol";
contract StorageSlotMock {
using StorageSlot for bytes32;
function setBoolean(bytes32 slot, bool value) public {
slot.getBooleanSlot().value = value;
}
function setAddress(bytes32 slot, address value) public {
slot.getAddressSlot().value = value;
}
function setBytes32(bytes32 slot, bytes32 value) public {
slot.getBytes32Slot().value = value;
}
function setUint256(bytes32 slot, uint256 value) public {
slot.getUint256Slot().value = value;
}
function getBoolean(bytes32 slot) public view returns (bool) {
return slot.getBooleanSlot().value;
}
function getAddress(bytes32 slot) public view returns (address) {
return slot.getAddressSlot().value;
}
function getBytes32(bytes32 slot) public view returns (bytes32) {
return slot.getBytes32Slot().value;
}
function getUint256(bytes32 slot) public view returns (uint256) {
return slot.getUint256Slot().value;
}
}