diff --git a/.changeset/honest-planets-sell.md b/.changeset/honest-planets-sell.md new file mode 100644 index 00000000000..232c166c9af --- /dev/null +++ b/.changeset/honest-planets-sell.md @@ -0,0 +1,5 @@ +--- +'openzeppelin-solidity': minor +--- + +`Slots`: Added a library to help derive, read and write to storage slots (both "normal" and transient). diff --git a/.changeset/hungry-oranges-travel.md b/.changeset/hungry-oranges-travel.md new file mode 100644 index 00000000000..6fae3e744ad --- /dev/null +++ b/.changeset/hungry-oranges-travel.md @@ -0,0 +1,5 @@ +--- +'openzeppelin-solidity': minor +--- + +`ReentrancyGuardTransient`: Added a variant of `ReentrancyGuard` that uses transient storage. diff --git a/contracts/mocks/ReentrancyTransientMock.sol b/contracts/mocks/ReentrancyTransientMock.sol new file mode 100644 index 00000000000..f0e61ea8caa --- /dev/null +++ b/contracts/mocks/ReentrancyTransientMock.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.24; + +import {ReentrancyGuardTransient} from "../utils/ReentrancyGuardTransient.sol"; +import {ReentrancyAttack} from "./ReentrancyAttack.sol"; + +contract ReentrancyTransientMock is ReentrancyGuardTransient { + uint256 public counter; + + constructor() { + counter = 0; + } + + function callback() external nonReentrant { + _count(); + } + + function countLocalRecursive(uint256 n) public nonReentrant { + if (n > 0) { + _count(); + countLocalRecursive(n - 1); + } + } + + function countThisRecursive(uint256 n) public nonReentrant { + if (n > 0) { + _count(); + (bool success, ) = address(this).call(abi.encodeCall(this.countThisRecursive, (n - 1))); + require(success, "ReentrancyTransientMock: failed call"); + } + } + + function countAndCall(ReentrancyAttack attacker) public nonReentrant { + _count(); + attacker.callSender(abi.encodeCall(this.callback, ())); + } + + function _count() private { + counter += 1; + } + + function guardedCheckEntered() public nonReentrant { + require(_reentrancyGuardEntered()); + } + + function unguardedCheckNotEntered() public view { + require(!_reentrancyGuardEntered()); + } +} diff --git a/contracts/mocks/SlotsMock.sol b/contracts/mocks/SlotsMock.sol new file mode 100644 index 00000000000..678587025f7 --- /dev/null +++ b/contracts/mocks/SlotsMock.sol @@ -0,0 +1,999 @@ +// SPDX-License-Identifier: MIT +// This file was procedurally generated from scripts/generate/templates/SlotsMock.js. + +pragma solidity ^0.8.24; + +import {Multicall} from "../utils/Multicall.sol"; +import {Slots} from "../utils/Slots.sol"; + +contract SlotsMock is Multicall { + using Slots for *; + + function erc1967slot(string memory path) public pure returns (bytes32 slot) { + return path.erc1967slot(); + } + + function erc7201slot(string memory path) public pure returns (bytes32 slot) { + return path.erc7201slot(); + } + + event BoolSlotValue(bytes32 slot, bool value); + + function tloadBoolSlot(bytes32 slot) public { + emit BoolSlotValue(slot, slot.asBoolSlot().tload()); + } + + function tstore(bytes32 slot, bool value) public { + slot.asBoolSlot().tstore(value); + } + + event AddressSlotValue(bytes32 slot, address value); + + function tloadAddressSlot(bytes32 slot) public { + emit AddressSlotValue(slot, slot.asAddressSlot().tload()); + } + + function tstore(bytes32 slot, address value) public { + slot.asAddressSlot().tstore(value); + } + + event Bytes1SlotValue(bytes32 slot, bytes1 value); + + function tloadBytes1Slot(bytes32 slot) public { + emit Bytes1SlotValue(slot, slot.asBytes1Slot().tload()); + } + + function tstore(bytes32 slot, bytes1 value) public { + slot.asBytes1Slot().tstore(value); + } + + event Bytes2SlotValue(bytes32 slot, bytes2 value); + + function tloadBytes2Slot(bytes32 slot) public { + emit Bytes2SlotValue(slot, slot.asBytes2Slot().tload()); + } + + function tstore(bytes32 slot, bytes2 value) public { + slot.asBytes2Slot().tstore(value); + } + + event Bytes3SlotValue(bytes32 slot, bytes3 value); + + function tloadBytes3Slot(bytes32 slot) public { + emit Bytes3SlotValue(slot, slot.asBytes3Slot().tload()); + } + + function tstore(bytes32 slot, bytes3 value) public { + slot.asBytes3Slot().tstore(value); + } + + event Bytes4SlotValue(bytes32 slot, bytes4 value); + + function tloadBytes4Slot(bytes32 slot) public { + emit Bytes4SlotValue(slot, slot.asBytes4Slot().tload()); + } + + function tstore(bytes32 slot, bytes4 value) public { + slot.asBytes4Slot().tstore(value); + } + + event Bytes5SlotValue(bytes32 slot, bytes5 value); + + function tloadBytes5Slot(bytes32 slot) public { + emit Bytes5SlotValue(slot, slot.asBytes5Slot().tload()); + } + + function tstore(bytes32 slot, bytes5 value) public { + slot.asBytes5Slot().tstore(value); + } + + event Bytes6SlotValue(bytes32 slot, bytes6 value); + + function tloadBytes6Slot(bytes32 slot) public { + emit Bytes6SlotValue(slot, slot.asBytes6Slot().tload()); + } + + function tstore(bytes32 slot, bytes6 value) public { + slot.asBytes6Slot().tstore(value); + } + + event Bytes7SlotValue(bytes32 slot, bytes7 value); + + function tloadBytes7Slot(bytes32 slot) public { + emit Bytes7SlotValue(slot, slot.asBytes7Slot().tload()); + } + + function tstore(bytes32 slot, bytes7 value) public { + slot.asBytes7Slot().tstore(value); + } + + event Bytes8SlotValue(bytes32 slot, bytes8 value); + + function tloadBytes8Slot(bytes32 slot) public { + emit Bytes8SlotValue(slot, slot.asBytes8Slot().tload()); + } + + function tstore(bytes32 slot, bytes8 value) public { + slot.asBytes8Slot().tstore(value); + } + + event Bytes9SlotValue(bytes32 slot, bytes9 value); + + function tloadBytes9Slot(bytes32 slot) public { + emit Bytes9SlotValue(slot, slot.asBytes9Slot().tload()); + } + + function tstore(bytes32 slot, bytes9 value) public { + slot.asBytes9Slot().tstore(value); + } + + event Bytes10SlotValue(bytes32 slot, bytes10 value); + + function tloadBytes10Slot(bytes32 slot) public { + emit Bytes10SlotValue(slot, slot.asBytes10Slot().tload()); + } + + function tstore(bytes32 slot, bytes10 value) public { + slot.asBytes10Slot().tstore(value); + } + + event Bytes11SlotValue(bytes32 slot, bytes11 value); + + function tloadBytes11Slot(bytes32 slot) public { + emit Bytes11SlotValue(slot, slot.asBytes11Slot().tload()); + } + + function tstore(bytes32 slot, bytes11 value) public { + slot.asBytes11Slot().tstore(value); + } + + event Bytes12SlotValue(bytes32 slot, bytes12 value); + + function tloadBytes12Slot(bytes32 slot) public { + emit Bytes12SlotValue(slot, slot.asBytes12Slot().tload()); + } + + function tstore(bytes32 slot, bytes12 value) public { + slot.asBytes12Slot().tstore(value); + } + + event Bytes13SlotValue(bytes32 slot, bytes13 value); + + function tloadBytes13Slot(bytes32 slot) public { + emit Bytes13SlotValue(slot, slot.asBytes13Slot().tload()); + } + + function tstore(bytes32 slot, bytes13 value) public { + slot.asBytes13Slot().tstore(value); + } + + event Bytes14SlotValue(bytes32 slot, bytes14 value); + + function tloadBytes14Slot(bytes32 slot) public { + emit Bytes14SlotValue(slot, slot.asBytes14Slot().tload()); + } + + function tstore(bytes32 slot, bytes14 value) public { + slot.asBytes14Slot().tstore(value); + } + + event Bytes15SlotValue(bytes32 slot, bytes15 value); + + function tloadBytes15Slot(bytes32 slot) public { + emit Bytes15SlotValue(slot, slot.asBytes15Slot().tload()); + } + + function tstore(bytes32 slot, bytes15 value) public { + slot.asBytes15Slot().tstore(value); + } + + event Bytes16SlotValue(bytes32 slot, bytes16 value); + + function tloadBytes16Slot(bytes32 slot) public { + emit Bytes16SlotValue(slot, slot.asBytes16Slot().tload()); + } + + function tstore(bytes32 slot, bytes16 value) public { + slot.asBytes16Slot().tstore(value); + } + + event Bytes17SlotValue(bytes32 slot, bytes17 value); + + function tloadBytes17Slot(bytes32 slot) public { + emit Bytes17SlotValue(slot, slot.asBytes17Slot().tload()); + } + + function tstore(bytes32 slot, bytes17 value) public { + slot.asBytes17Slot().tstore(value); + } + + event Bytes18SlotValue(bytes32 slot, bytes18 value); + + function tloadBytes18Slot(bytes32 slot) public { + emit Bytes18SlotValue(slot, slot.asBytes18Slot().tload()); + } + + function tstore(bytes32 slot, bytes18 value) public { + slot.asBytes18Slot().tstore(value); + } + + event Bytes19SlotValue(bytes32 slot, bytes19 value); + + function tloadBytes19Slot(bytes32 slot) public { + emit Bytes19SlotValue(slot, slot.asBytes19Slot().tload()); + } + + function tstore(bytes32 slot, bytes19 value) public { + slot.asBytes19Slot().tstore(value); + } + + event Bytes20SlotValue(bytes32 slot, bytes20 value); + + function tloadBytes20Slot(bytes32 slot) public { + emit Bytes20SlotValue(slot, slot.asBytes20Slot().tload()); + } + + function tstore(bytes32 slot, bytes20 value) public { + slot.asBytes20Slot().tstore(value); + } + + event Bytes21SlotValue(bytes32 slot, bytes21 value); + + function tloadBytes21Slot(bytes32 slot) public { + emit Bytes21SlotValue(slot, slot.asBytes21Slot().tload()); + } + + function tstore(bytes32 slot, bytes21 value) public { + slot.asBytes21Slot().tstore(value); + } + + event Bytes22SlotValue(bytes32 slot, bytes22 value); + + function tloadBytes22Slot(bytes32 slot) public { + emit Bytes22SlotValue(slot, slot.asBytes22Slot().tload()); + } + + function tstore(bytes32 slot, bytes22 value) public { + slot.asBytes22Slot().tstore(value); + } + + event Bytes23SlotValue(bytes32 slot, bytes23 value); + + function tloadBytes23Slot(bytes32 slot) public { + emit Bytes23SlotValue(slot, slot.asBytes23Slot().tload()); + } + + function tstore(bytes32 slot, bytes23 value) public { + slot.asBytes23Slot().tstore(value); + } + + event Bytes24SlotValue(bytes32 slot, bytes24 value); + + function tloadBytes24Slot(bytes32 slot) public { + emit Bytes24SlotValue(slot, slot.asBytes24Slot().tload()); + } + + function tstore(bytes32 slot, bytes24 value) public { + slot.asBytes24Slot().tstore(value); + } + + event Bytes25SlotValue(bytes32 slot, bytes25 value); + + function tloadBytes25Slot(bytes32 slot) public { + emit Bytes25SlotValue(slot, slot.asBytes25Slot().tload()); + } + + function tstore(bytes32 slot, bytes25 value) public { + slot.asBytes25Slot().tstore(value); + } + + event Bytes26SlotValue(bytes32 slot, bytes26 value); + + function tloadBytes26Slot(bytes32 slot) public { + emit Bytes26SlotValue(slot, slot.asBytes26Slot().tload()); + } + + function tstore(bytes32 slot, bytes26 value) public { + slot.asBytes26Slot().tstore(value); + } + + event Bytes27SlotValue(bytes32 slot, bytes27 value); + + function tloadBytes27Slot(bytes32 slot) public { + emit Bytes27SlotValue(slot, slot.asBytes27Slot().tload()); + } + + function tstore(bytes32 slot, bytes27 value) public { + slot.asBytes27Slot().tstore(value); + } + + event Bytes28SlotValue(bytes32 slot, bytes28 value); + + function tloadBytes28Slot(bytes32 slot) public { + emit Bytes28SlotValue(slot, slot.asBytes28Slot().tload()); + } + + function tstore(bytes32 slot, bytes28 value) public { + slot.asBytes28Slot().tstore(value); + } + + event Bytes29SlotValue(bytes32 slot, bytes29 value); + + function tloadBytes29Slot(bytes32 slot) public { + emit Bytes29SlotValue(slot, slot.asBytes29Slot().tload()); + } + + function tstore(bytes32 slot, bytes29 value) public { + slot.asBytes29Slot().tstore(value); + } + + event Bytes30SlotValue(bytes32 slot, bytes30 value); + + function tloadBytes30Slot(bytes32 slot) public { + emit Bytes30SlotValue(slot, slot.asBytes30Slot().tload()); + } + + function tstore(bytes32 slot, bytes30 value) public { + slot.asBytes30Slot().tstore(value); + } + + event Bytes31SlotValue(bytes32 slot, bytes31 value); + + function tloadBytes31Slot(bytes32 slot) public { + emit Bytes31SlotValue(slot, slot.asBytes31Slot().tload()); + } + + function tstore(bytes32 slot, bytes31 value) public { + slot.asBytes31Slot().tstore(value); + } + + event Bytes32SlotValue(bytes32 slot, bytes32 value); + + function tloadBytes32Slot(bytes32 slot) public { + emit Bytes32SlotValue(slot, slot.asBytes32Slot().tload()); + } + + function tstore(bytes32 slot, bytes32 value) public { + slot.asBytes32Slot().tstore(value); + } + + event Uint8SlotValue(bytes32 slot, uint8 value); + + function tloadUint8Slot(bytes32 slot) public { + emit Uint8SlotValue(slot, slot.asUint8Slot().tload()); + } + + function tstore(bytes32 slot, uint8 value) public { + slot.asUint8Slot().tstore(value); + } + + event Uint16SlotValue(bytes32 slot, uint16 value); + + function tloadUint16Slot(bytes32 slot) public { + emit Uint16SlotValue(slot, slot.asUint16Slot().tload()); + } + + function tstore(bytes32 slot, uint16 value) public { + slot.asUint16Slot().tstore(value); + } + + event Uint24SlotValue(bytes32 slot, uint24 value); + + function tloadUint24Slot(bytes32 slot) public { + emit Uint24SlotValue(slot, slot.asUint24Slot().tload()); + } + + function tstore(bytes32 slot, uint24 value) public { + slot.asUint24Slot().tstore(value); + } + + event Uint32SlotValue(bytes32 slot, uint32 value); + + function tloadUint32Slot(bytes32 slot) public { + emit Uint32SlotValue(slot, slot.asUint32Slot().tload()); + } + + function tstore(bytes32 slot, uint32 value) public { + slot.asUint32Slot().tstore(value); + } + + event Uint40SlotValue(bytes32 slot, uint40 value); + + function tloadUint40Slot(bytes32 slot) public { + emit Uint40SlotValue(slot, slot.asUint40Slot().tload()); + } + + function tstore(bytes32 slot, uint40 value) public { + slot.asUint40Slot().tstore(value); + } + + event Uint48SlotValue(bytes32 slot, uint48 value); + + function tloadUint48Slot(bytes32 slot) public { + emit Uint48SlotValue(slot, slot.asUint48Slot().tload()); + } + + function tstore(bytes32 slot, uint48 value) public { + slot.asUint48Slot().tstore(value); + } + + event Uint56SlotValue(bytes32 slot, uint56 value); + + function tloadUint56Slot(bytes32 slot) public { + emit Uint56SlotValue(slot, slot.asUint56Slot().tload()); + } + + function tstore(bytes32 slot, uint56 value) public { + slot.asUint56Slot().tstore(value); + } + + event Uint64SlotValue(bytes32 slot, uint64 value); + + function tloadUint64Slot(bytes32 slot) public { + emit Uint64SlotValue(slot, slot.asUint64Slot().tload()); + } + + function tstore(bytes32 slot, uint64 value) public { + slot.asUint64Slot().tstore(value); + } + + event Uint72SlotValue(bytes32 slot, uint72 value); + + function tloadUint72Slot(bytes32 slot) public { + emit Uint72SlotValue(slot, slot.asUint72Slot().tload()); + } + + function tstore(bytes32 slot, uint72 value) public { + slot.asUint72Slot().tstore(value); + } + + event Uint80SlotValue(bytes32 slot, uint80 value); + + function tloadUint80Slot(bytes32 slot) public { + emit Uint80SlotValue(slot, slot.asUint80Slot().tload()); + } + + function tstore(bytes32 slot, uint80 value) public { + slot.asUint80Slot().tstore(value); + } + + event Uint88SlotValue(bytes32 slot, uint88 value); + + function tloadUint88Slot(bytes32 slot) public { + emit Uint88SlotValue(slot, slot.asUint88Slot().tload()); + } + + function tstore(bytes32 slot, uint88 value) public { + slot.asUint88Slot().tstore(value); + } + + event Uint96SlotValue(bytes32 slot, uint96 value); + + function tloadUint96Slot(bytes32 slot) public { + emit Uint96SlotValue(slot, slot.asUint96Slot().tload()); + } + + function tstore(bytes32 slot, uint96 value) public { + slot.asUint96Slot().tstore(value); + } + + event Uint104SlotValue(bytes32 slot, uint104 value); + + function tloadUint104Slot(bytes32 slot) public { + emit Uint104SlotValue(slot, slot.asUint104Slot().tload()); + } + + function tstore(bytes32 slot, uint104 value) public { + slot.asUint104Slot().tstore(value); + } + + event Uint112SlotValue(bytes32 slot, uint112 value); + + function tloadUint112Slot(bytes32 slot) public { + emit Uint112SlotValue(slot, slot.asUint112Slot().tload()); + } + + function tstore(bytes32 slot, uint112 value) public { + slot.asUint112Slot().tstore(value); + } + + event Uint120SlotValue(bytes32 slot, uint120 value); + + function tloadUint120Slot(bytes32 slot) public { + emit Uint120SlotValue(slot, slot.asUint120Slot().tload()); + } + + function tstore(bytes32 slot, uint120 value) public { + slot.asUint120Slot().tstore(value); + } + + event Uint128SlotValue(bytes32 slot, uint128 value); + + function tloadUint128Slot(bytes32 slot) public { + emit Uint128SlotValue(slot, slot.asUint128Slot().tload()); + } + + function tstore(bytes32 slot, uint128 value) public { + slot.asUint128Slot().tstore(value); + } + + event Uint136SlotValue(bytes32 slot, uint136 value); + + function tloadUint136Slot(bytes32 slot) public { + emit Uint136SlotValue(slot, slot.asUint136Slot().tload()); + } + + function tstore(bytes32 slot, uint136 value) public { + slot.asUint136Slot().tstore(value); + } + + event Uint144SlotValue(bytes32 slot, uint144 value); + + function tloadUint144Slot(bytes32 slot) public { + emit Uint144SlotValue(slot, slot.asUint144Slot().tload()); + } + + function tstore(bytes32 slot, uint144 value) public { + slot.asUint144Slot().tstore(value); + } + + event Uint152SlotValue(bytes32 slot, uint152 value); + + function tloadUint152Slot(bytes32 slot) public { + emit Uint152SlotValue(slot, slot.asUint152Slot().tload()); + } + + function tstore(bytes32 slot, uint152 value) public { + slot.asUint152Slot().tstore(value); + } + + event Uint160SlotValue(bytes32 slot, uint160 value); + + function tloadUint160Slot(bytes32 slot) public { + emit Uint160SlotValue(slot, slot.asUint160Slot().tload()); + } + + function tstore(bytes32 slot, uint160 value) public { + slot.asUint160Slot().tstore(value); + } + + event Uint168SlotValue(bytes32 slot, uint168 value); + + function tloadUint168Slot(bytes32 slot) public { + emit Uint168SlotValue(slot, slot.asUint168Slot().tload()); + } + + function tstore(bytes32 slot, uint168 value) public { + slot.asUint168Slot().tstore(value); + } + + event Uint176SlotValue(bytes32 slot, uint176 value); + + function tloadUint176Slot(bytes32 slot) public { + emit Uint176SlotValue(slot, slot.asUint176Slot().tload()); + } + + function tstore(bytes32 slot, uint176 value) public { + slot.asUint176Slot().tstore(value); + } + + event Uint184SlotValue(bytes32 slot, uint184 value); + + function tloadUint184Slot(bytes32 slot) public { + emit Uint184SlotValue(slot, slot.asUint184Slot().tload()); + } + + function tstore(bytes32 slot, uint184 value) public { + slot.asUint184Slot().tstore(value); + } + + event Uint192SlotValue(bytes32 slot, uint192 value); + + function tloadUint192Slot(bytes32 slot) public { + emit Uint192SlotValue(slot, slot.asUint192Slot().tload()); + } + + function tstore(bytes32 slot, uint192 value) public { + slot.asUint192Slot().tstore(value); + } + + event Uint200SlotValue(bytes32 slot, uint200 value); + + function tloadUint200Slot(bytes32 slot) public { + emit Uint200SlotValue(slot, slot.asUint200Slot().tload()); + } + + function tstore(bytes32 slot, uint200 value) public { + slot.asUint200Slot().tstore(value); + } + + event Uint208SlotValue(bytes32 slot, uint208 value); + + function tloadUint208Slot(bytes32 slot) public { + emit Uint208SlotValue(slot, slot.asUint208Slot().tload()); + } + + function tstore(bytes32 slot, uint208 value) public { + slot.asUint208Slot().tstore(value); + } + + event Uint216SlotValue(bytes32 slot, uint216 value); + + function tloadUint216Slot(bytes32 slot) public { + emit Uint216SlotValue(slot, slot.asUint216Slot().tload()); + } + + function tstore(bytes32 slot, uint216 value) public { + slot.asUint216Slot().tstore(value); + } + + event Uint224SlotValue(bytes32 slot, uint224 value); + + function tloadUint224Slot(bytes32 slot) public { + emit Uint224SlotValue(slot, slot.asUint224Slot().tload()); + } + + function tstore(bytes32 slot, uint224 value) public { + slot.asUint224Slot().tstore(value); + } + + event Uint232SlotValue(bytes32 slot, uint232 value); + + function tloadUint232Slot(bytes32 slot) public { + emit Uint232SlotValue(slot, slot.asUint232Slot().tload()); + } + + function tstore(bytes32 slot, uint232 value) public { + slot.asUint232Slot().tstore(value); + } + + event Uint240SlotValue(bytes32 slot, uint240 value); + + function tloadUint240Slot(bytes32 slot) public { + emit Uint240SlotValue(slot, slot.asUint240Slot().tload()); + } + + function tstore(bytes32 slot, uint240 value) public { + slot.asUint240Slot().tstore(value); + } + + event Uint248SlotValue(bytes32 slot, uint248 value); + + function tloadUint248Slot(bytes32 slot) public { + emit Uint248SlotValue(slot, slot.asUint248Slot().tload()); + } + + function tstore(bytes32 slot, uint248 value) public { + slot.asUint248Slot().tstore(value); + } + + event Uint256SlotValue(bytes32 slot, uint256 value); + + function tloadUint256Slot(bytes32 slot) public { + emit Uint256SlotValue(slot, slot.asUint256Slot().tload()); + } + + function tstore(bytes32 slot, uint256 value) public { + slot.asUint256Slot().tstore(value); + } + + event Int8SlotValue(bytes32 slot, int8 value); + + function tloadInt8Slot(bytes32 slot) public { + emit Int8SlotValue(slot, slot.asInt8Slot().tload()); + } + + function tstore(bytes32 slot, int8 value) public { + slot.asInt8Slot().tstore(value); + } + + event Int16SlotValue(bytes32 slot, int16 value); + + function tloadInt16Slot(bytes32 slot) public { + emit Int16SlotValue(slot, slot.asInt16Slot().tload()); + } + + function tstore(bytes32 slot, int16 value) public { + slot.asInt16Slot().tstore(value); + } + + event Int24SlotValue(bytes32 slot, int24 value); + + function tloadInt24Slot(bytes32 slot) public { + emit Int24SlotValue(slot, slot.asInt24Slot().tload()); + } + + function tstore(bytes32 slot, int24 value) public { + slot.asInt24Slot().tstore(value); + } + + event Int32SlotValue(bytes32 slot, int32 value); + + function tloadInt32Slot(bytes32 slot) public { + emit Int32SlotValue(slot, slot.asInt32Slot().tload()); + } + + function tstore(bytes32 slot, int32 value) public { + slot.asInt32Slot().tstore(value); + } + + event Int40SlotValue(bytes32 slot, int40 value); + + function tloadInt40Slot(bytes32 slot) public { + emit Int40SlotValue(slot, slot.asInt40Slot().tload()); + } + + function tstore(bytes32 slot, int40 value) public { + slot.asInt40Slot().tstore(value); + } + + event Int48SlotValue(bytes32 slot, int48 value); + + function tloadInt48Slot(bytes32 slot) public { + emit Int48SlotValue(slot, slot.asInt48Slot().tload()); + } + + function tstore(bytes32 slot, int48 value) public { + slot.asInt48Slot().tstore(value); + } + + event Int56SlotValue(bytes32 slot, int56 value); + + function tloadInt56Slot(bytes32 slot) public { + emit Int56SlotValue(slot, slot.asInt56Slot().tload()); + } + + function tstore(bytes32 slot, int56 value) public { + slot.asInt56Slot().tstore(value); + } + + event Int64SlotValue(bytes32 slot, int64 value); + + function tloadInt64Slot(bytes32 slot) public { + emit Int64SlotValue(slot, slot.asInt64Slot().tload()); + } + + function tstore(bytes32 slot, int64 value) public { + slot.asInt64Slot().tstore(value); + } + + event Int72SlotValue(bytes32 slot, int72 value); + + function tloadInt72Slot(bytes32 slot) public { + emit Int72SlotValue(slot, slot.asInt72Slot().tload()); + } + + function tstore(bytes32 slot, int72 value) public { + slot.asInt72Slot().tstore(value); + } + + event Int80SlotValue(bytes32 slot, int80 value); + + function tloadInt80Slot(bytes32 slot) public { + emit Int80SlotValue(slot, slot.asInt80Slot().tload()); + } + + function tstore(bytes32 slot, int80 value) public { + slot.asInt80Slot().tstore(value); + } + + event Int88SlotValue(bytes32 slot, int88 value); + + function tloadInt88Slot(bytes32 slot) public { + emit Int88SlotValue(slot, slot.asInt88Slot().tload()); + } + + function tstore(bytes32 slot, int88 value) public { + slot.asInt88Slot().tstore(value); + } + + event Int96SlotValue(bytes32 slot, int96 value); + + function tloadInt96Slot(bytes32 slot) public { + emit Int96SlotValue(slot, slot.asInt96Slot().tload()); + } + + function tstore(bytes32 slot, int96 value) public { + slot.asInt96Slot().tstore(value); + } + + event Int104SlotValue(bytes32 slot, int104 value); + + function tloadInt104Slot(bytes32 slot) public { + emit Int104SlotValue(slot, slot.asInt104Slot().tload()); + } + + function tstore(bytes32 slot, int104 value) public { + slot.asInt104Slot().tstore(value); + } + + event Int112SlotValue(bytes32 slot, int112 value); + + function tloadInt112Slot(bytes32 slot) public { + emit Int112SlotValue(slot, slot.asInt112Slot().tload()); + } + + function tstore(bytes32 slot, int112 value) public { + slot.asInt112Slot().tstore(value); + } + + event Int120SlotValue(bytes32 slot, int120 value); + + function tloadInt120Slot(bytes32 slot) public { + emit Int120SlotValue(slot, slot.asInt120Slot().tload()); + } + + function tstore(bytes32 slot, int120 value) public { + slot.asInt120Slot().tstore(value); + } + + event Int128SlotValue(bytes32 slot, int128 value); + + function tloadInt128Slot(bytes32 slot) public { + emit Int128SlotValue(slot, slot.asInt128Slot().tload()); + } + + function tstore(bytes32 slot, int128 value) public { + slot.asInt128Slot().tstore(value); + } + + event Int136SlotValue(bytes32 slot, int136 value); + + function tloadInt136Slot(bytes32 slot) public { + emit Int136SlotValue(slot, slot.asInt136Slot().tload()); + } + + function tstore(bytes32 slot, int136 value) public { + slot.asInt136Slot().tstore(value); + } + + event Int144SlotValue(bytes32 slot, int144 value); + + function tloadInt144Slot(bytes32 slot) public { + emit Int144SlotValue(slot, slot.asInt144Slot().tload()); + } + + function tstore(bytes32 slot, int144 value) public { + slot.asInt144Slot().tstore(value); + } + + event Int152SlotValue(bytes32 slot, int152 value); + + function tloadInt152Slot(bytes32 slot) public { + emit Int152SlotValue(slot, slot.asInt152Slot().tload()); + } + + function tstore(bytes32 slot, int152 value) public { + slot.asInt152Slot().tstore(value); + } + + event Int160SlotValue(bytes32 slot, int160 value); + + function tloadInt160Slot(bytes32 slot) public { + emit Int160SlotValue(slot, slot.asInt160Slot().tload()); + } + + function tstore(bytes32 slot, int160 value) public { + slot.asInt160Slot().tstore(value); + } + + event Int168SlotValue(bytes32 slot, int168 value); + + function tloadInt168Slot(bytes32 slot) public { + emit Int168SlotValue(slot, slot.asInt168Slot().tload()); + } + + function tstore(bytes32 slot, int168 value) public { + slot.asInt168Slot().tstore(value); + } + + event Int176SlotValue(bytes32 slot, int176 value); + + function tloadInt176Slot(bytes32 slot) public { + emit Int176SlotValue(slot, slot.asInt176Slot().tload()); + } + + function tstore(bytes32 slot, int176 value) public { + slot.asInt176Slot().tstore(value); + } + + event Int184SlotValue(bytes32 slot, int184 value); + + function tloadInt184Slot(bytes32 slot) public { + emit Int184SlotValue(slot, slot.asInt184Slot().tload()); + } + + function tstore(bytes32 slot, int184 value) public { + slot.asInt184Slot().tstore(value); + } + + event Int192SlotValue(bytes32 slot, int192 value); + + function tloadInt192Slot(bytes32 slot) public { + emit Int192SlotValue(slot, slot.asInt192Slot().tload()); + } + + function tstore(bytes32 slot, int192 value) public { + slot.asInt192Slot().tstore(value); + } + + event Int200SlotValue(bytes32 slot, int200 value); + + function tloadInt200Slot(bytes32 slot) public { + emit Int200SlotValue(slot, slot.asInt200Slot().tload()); + } + + function tstore(bytes32 slot, int200 value) public { + slot.asInt200Slot().tstore(value); + } + + event Int208SlotValue(bytes32 slot, int208 value); + + function tloadInt208Slot(bytes32 slot) public { + emit Int208SlotValue(slot, slot.asInt208Slot().tload()); + } + + function tstore(bytes32 slot, int208 value) public { + slot.asInt208Slot().tstore(value); + } + + event Int216SlotValue(bytes32 slot, int216 value); + + function tloadInt216Slot(bytes32 slot) public { + emit Int216SlotValue(slot, slot.asInt216Slot().tload()); + } + + function tstore(bytes32 slot, int216 value) public { + slot.asInt216Slot().tstore(value); + } + + event Int224SlotValue(bytes32 slot, int224 value); + + function tloadInt224Slot(bytes32 slot) public { + emit Int224SlotValue(slot, slot.asInt224Slot().tload()); + } + + function tstore(bytes32 slot, int224 value) public { + slot.asInt224Slot().tstore(value); + } + + event Int232SlotValue(bytes32 slot, int232 value); + + function tloadInt232Slot(bytes32 slot) public { + emit Int232SlotValue(slot, slot.asInt232Slot().tload()); + } + + function tstore(bytes32 slot, int232 value) public { + slot.asInt232Slot().tstore(value); + } + + event Int240SlotValue(bytes32 slot, int240 value); + + function tloadInt240Slot(bytes32 slot) public { + emit Int240SlotValue(slot, slot.asInt240Slot().tload()); + } + + function tstore(bytes32 slot, int240 value) public { + slot.asInt240Slot().tstore(value); + } + + event Int248SlotValue(bytes32 slot, int248 value); + + function tloadInt248Slot(bytes32 slot) public { + emit Int248SlotValue(slot, slot.asInt248Slot().tload()); + } + + function tstore(bytes32 slot, int248 value) public { + slot.asInt248Slot().tstore(value); + } + + event Int256SlotValue(bytes32 slot, int256 value); + + function tloadInt256Slot(bytes32 slot) public { + emit Int256SlotValue(slot, slot.asInt256Slot().tload()); + } + + function tstore(bytes32 slot, int256 value) public { + slot.asInt256Slot().tstore(value); + } +} diff --git a/contracts/utils/Arrays.sol b/contracts/utils/Arrays.sol index 02252059898..1ccd9f32e79 100644 --- a/contracts/utils/Arrays.sol +++ b/contracts/utils/Arrays.sol @@ -3,6 +3,7 @@ pragma solidity ^0.8.20; +import {Slots} from "./Slots.sol"; import {StorageSlot} from "./StorageSlot.sol"; import {Math} from "./math/Math.sol"; @@ -10,6 +11,7 @@ import {Math} from "./math/Math.sol"; * @dev Collection of functions related to array types. */ library Arrays { + using Slots for bytes32; using StorageSlot for bytes32; /** @@ -361,15 +363,11 @@ library Arrays { */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { bytes32 slot; - // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` - // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. - /// @solidity memory-safe-assembly assembly { - mstore(0, arr.slot) - slot := add(keccak256(0, 0x20), pos) + slot := arr.slot } - return slot.getAddressSlot(); + return slot.deriveArray().offset(pos).getAddressSlot(); } /** @@ -379,15 +377,11 @@ library Arrays { */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { bytes32 slot; - // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` - // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. - /// @solidity memory-safe-assembly assembly { - mstore(0, arr.slot) - slot := add(keccak256(0, 0x20), pos) + slot := arr.slot } - return slot.getBytes32Slot(); + return slot.deriveArray().offset(pos).getBytes32Slot(); } /** @@ -397,15 +391,11 @@ library Arrays { */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { bytes32 slot; - // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` - // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. - /// @solidity memory-safe-assembly assembly { - mstore(0, arr.slot) - slot := add(keccak256(0, 0x20), pos) + slot := arr.slot } - return slot.getUint256Slot(); + return slot.deriveArray().offset(pos).getUint256Slot(); } /** diff --git a/contracts/utils/README.adoc b/contracts/utils/README.adoc index b7c1baf8db6..c1789af1e0b 100644 --- a/contracts/utils/README.adoc +++ b/contracts/utils/README.adoc @@ -13,6 +13,7 @@ Miscellaneous contracts and libraries containing utility functions you can use t * {MerkleProof}: Functions for verifying https://en.wikipedia.org/wiki/Merkle_tree[Merkle Tree] proofs. * {EIP712}: Contract with functions to allow processing signed typed structure data according to https://eips.ethereum.org/EIPS/eip-712[EIP-712]. * {ReentrancyGuard}: A modifier that can prevent reentrancy during certain functions. + * {ReentrancyGuardTransient}: Variant of {ReentrancyGuard} that uses transient storage (EIP-1153). * {Pausable}: A common emergency response mechanism that can pause functionality while a remediation is pending. * {Nonces}: Utility for tracking and verifying address nonces that only increment. * {ERC165, ERC165Checker}: Utilities for inspecting interfaces supported by contracts. @@ -29,6 +30,7 @@ Miscellaneous contracts and libraries containing utility functions you can use t * {Strings}: Common operations for strings formatting. * {ShortString}: Library to encode (and decode) short strings into (or from) a single bytes32 slot for optimizing costs. Short strings are limited to 31 characters. * {StorageSlot}: Methods for accessing specific storage slots formatted as common primitive types. + * {Slots}: Methods for derivating, reading and writing to storage slots. This supports both "normal" and transient storage. * {Multicall}: Abstract contract with an utility to allow batching together multiple calls in a single transaction. Useful for allowing EOAs to perform multiple operations at once. * {Context}: An utility for abstracting the sender and calldata in the current execution context. * {Panic}: A library to revert with https://docs.soliditylang.org/en/v0.8.20/control-structures.html#panic-via-assert-and-error-via-require[Solidity panic codes]. @@ -64,6 +66,8 @@ Because Solidity does not support generic types, {EnumerableMap} and {Enumerable {{ReentrancyGuard}} +{{ReentrancyGuardTransient}} + {{Pausable}} {{Nonces}} @@ -110,6 +114,8 @@ Ethereum contracts have no native concept of an interface, so applications must {{StorageSlot}} +{{Slots}} + {{Multicall}} {{Context}} diff --git a/contracts/utils/ReentrancyGuard.sol b/contracts/utils/ReentrancyGuard.sol index 291d92fd597..47eeab21e7d 100644 --- a/contracts/utils/ReentrancyGuard.sol +++ b/contracts/utils/ReentrancyGuard.sol @@ -15,6 +15,9 @@ pragma solidity ^0.8.20; * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * + * NOTE: If EIP-1153 (transient storage) is available on the targeted network, you + * should consider using {TransientReentrancyGuard} instead. + * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. diff --git a/contracts/utils/ReentrancyGuardTransient.sol b/contracts/utils/ReentrancyGuardTransient.sol new file mode 100644 index 00000000000..b1ad9c9df2c --- /dev/null +++ b/contracts/utils/ReentrancyGuardTransient.sol @@ -0,0 +1,58 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.24; + +import {Slots} from "./Slots.sol"; + +/** + * @dev Variant of {ReentrancyGuard} that uses transient storage. + * + * NOTE: This variant only works on networks where EIP-1153 is available. + */ +abstract contract ReentrancyGuardTransient { + using Slots for *; + + // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff)) + bytes32 private constant REENTRANCY_GUARD_STORAGE = + 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00; + + /** + * @dev Unauthorized reentrant call. + */ + error ReentrancyGuardReentrantCall(); + + /** + * @dev Prevents a contract from calling itself, directly or indirectly. + * Calling a `nonReentrant` function from another `nonReentrant` + * function is not supported. It is possible to prevent this from happening + * by making the `nonReentrant` function external, and making it call a + * `private` function that does the actual work. + */ + modifier nonReentrant() { + _nonReentrantBefore(); + _; + _nonReentrantAfter(); + } + + function _nonReentrantBefore() private { + // On the first call to nonReentrant, _status will be NOT_ENTERED + if (_reentrancyGuardEntered()) { + revert ReentrancyGuardReentrantCall(); + } + + // Any calls to nonReentrant after this point will fail + REENTRANCY_GUARD_STORAGE.asBoolSlot().tstore(true); + } + + function _nonReentrantAfter() private { + REENTRANCY_GUARD_STORAGE.asBoolSlot().tstore(false); + } + + /** + * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a + * `nonReentrant` function in the call stack. + */ + function _reentrancyGuardEntered() internal view returns (bool) { + return REENTRANCY_GUARD_STORAGE.asBoolSlot().tload(); + } +} diff --git a/contracts/utils/Slots.sol b/contracts/utils/Slots.sol new file mode 100644 index 00000000000..53fe6a59b0b --- /dev/null +++ b/contracts/utils/Slots.sol @@ -0,0 +1,6522 @@ +// SPDX-License-Identifier: MIT +// This file was procedurally generated from scripts/generate/templates/Slots.js. + +pragma solidity ^0.8.24; + +/** + * @dev Library for derivating, reading and writing to storage slots. This supports both "normal" and transient storage. + * + * Note: Transient storage operations (`tload` and `tstore`) only works on networks where EIP-1153[https://eips.ethereum.org/EIPS/eip-1153] is available. + */ +library Slots { + /** + * @dev Derive an ERC-1967 slot from a string (path). + */ + function erc1967slot(string memory path) internal pure returns (bytes32 slot) { + /// @solidity memory-safe-assembly + assembly { + slot := sub(keccak256(add(path, 0x20), mload(path)), 1) + } + } + + /** + * @dev Derive an ERC-7201 slot from a string (path). + */ + function erc7201slot(string memory path) internal pure returns (bytes32 slot) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, sub(keccak256(add(path, 0x20), mload(path)), 1)) + slot := and(keccak256(0x00, 0x20), not(0xff)) + } + } + + /** + * @dev Add an offset to a slot to get the n-th element of a structure or an array. + */ + function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) { + unchecked { + return bytes32(uint256(slot) + pos); + } + } + + /** + * @dev Derive the location of the first element in an array from the slot where the length is stored. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveArray(bytes32 slot) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, slot) + result := keccak256(0x00, 0x20) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bool key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, address key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes1 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes2 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes3 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes4 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes5 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes6 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes7 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes8 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes9 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes10 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes11 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes12 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes13 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes14 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes15 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes16 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes17 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes18 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes19 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes20 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes21 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes22 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes23 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes24 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes25 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes26 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes27 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes28 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes29 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes30 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes31 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, bytes32 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint8 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint16 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint24 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint32 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint40 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint48 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint56 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint64 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint72 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint80 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint88 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint96 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint104 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint112 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint120 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint128 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint136 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint144 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint152 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint160 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint168 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint176 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint184 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint192 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint200 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint208 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint216 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint224 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint232 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint240 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint248 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, uint256 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int8 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int16 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int24 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int32 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int40 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int48 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int56 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int64 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int72 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int80 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int88 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int96 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int104 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int112 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int120 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int128 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int136 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int144 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int152 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int160 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int168 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int176 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int184 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int192 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int200 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int208 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int216 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int224 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int232 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int240 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int248 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ + function deriveMapping(bytes32 slot, int256 key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } + } + + /** + * @dev UDVT that represent a slot holding a bool. + */ + type BoolSlot is bytes32; + + /** + * @dev Cast an arbitrary slot to a BoolSlot. + */ + function asBoolSlot(bytes32 slot) internal pure returns (BoolSlot) { + return BoolSlot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(BoolSlot slot) internal view returns (bool value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(BoolSlot slot, bool value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(BoolSlot slot) internal view returns (bool value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(BoolSlot slot, bool value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a address. + */ + type AddressSlot is bytes32; + + /** + * @dev Cast an arbitrary slot to a AddressSlot. + */ + function asAddressSlot(bytes32 slot) internal pure returns (AddressSlot) { + return AddressSlot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(AddressSlot slot) internal view returns (address value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(AddressSlot slot, address value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(AddressSlot slot) internal view returns (address value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(AddressSlot slot, address value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes1. + */ + type Bytes1Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes1Slot. + */ + function asBytes1Slot(bytes32 slot) internal pure returns (Bytes1Slot) { + return Bytes1Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes1Slot slot) internal view returns (bytes1 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes1Slot slot, bytes1 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes1Slot slot) internal view returns (bytes1 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes1Slot slot, bytes1 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes2. + */ + type Bytes2Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes2Slot. + */ + function asBytes2Slot(bytes32 slot) internal pure returns (Bytes2Slot) { + return Bytes2Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes2Slot slot) internal view returns (bytes2 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes2Slot slot, bytes2 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes2Slot slot) internal view returns (bytes2 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes2Slot slot, bytes2 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes3. + */ + type Bytes3Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes3Slot. + */ + function asBytes3Slot(bytes32 slot) internal pure returns (Bytes3Slot) { + return Bytes3Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes3Slot slot) internal view returns (bytes3 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes3Slot slot, bytes3 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes3Slot slot) internal view returns (bytes3 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes3Slot slot, bytes3 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes4. + */ + type Bytes4Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes4Slot. + */ + function asBytes4Slot(bytes32 slot) internal pure returns (Bytes4Slot) { + return Bytes4Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes4Slot slot) internal view returns (bytes4 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes4Slot slot, bytes4 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes4Slot slot) internal view returns (bytes4 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes4Slot slot, bytes4 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes5. + */ + type Bytes5Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes5Slot. + */ + function asBytes5Slot(bytes32 slot) internal pure returns (Bytes5Slot) { + return Bytes5Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes5Slot slot) internal view returns (bytes5 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes5Slot slot, bytes5 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes5Slot slot) internal view returns (bytes5 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes5Slot slot, bytes5 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes6. + */ + type Bytes6Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes6Slot. + */ + function asBytes6Slot(bytes32 slot) internal pure returns (Bytes6Slot) { + return Bytes6Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes6Slot slot) internal view returns (bytes6 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes6Slot slot, bytes6 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes6Slot slot) internal view returns (bytes6 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes6Slot slot, bytes6 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes7. + */ + type Bytes7Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes7Slot. + */ + function asBytes7Slot(bytes32 slot) internal pure returns (Bytes7Slot) { + return Bytes7Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes7Slot slot) internal view returns (bytes7 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes7Slot slot, bytes7 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes7Slot slot) internal view returns (bytes7 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes7Slot slot, bytes7 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes8. + */ + type Bytes8Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes8Slot. + */ + function asBytes8Slot(bytes32 slot) internal pure returns (Bytes8Slot) { + return Bytes8Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes8Slot slot) internal view returns (bytes8 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes8Slot slot, bytes8 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes8Slot slot) internal view returns (bytes8 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes8Slot slot, bytes8 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes9. + */ + type Bytes9Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes9Slot. + */ + function asBytes9Slot(bytes32 slot) internal pure returns (Bytes9Slot) { + return Bytes9Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes9Slot slot) internal view returns (bytes9 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes9Slot slot, bytes9 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes9Slot slot) internal view returns (bytes9 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes9Slot slot, bytes9 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes10. + */ + type Bytes10Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes10Slot. + */ + function asBytes10Slot(bytes32 slot) internal pure returns (Bytes10Slot) { + return Bytes10Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes10Slot slot) internal view returns (bytes10 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes10Slot slot, bytes10 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes10Slot slot) internal view returns (bytes10 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes10Slot slot, bytes10 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes11. + */ + type Bytes11Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes11Slot. + */ + function asBytes11Slot(bytes32 slot) internal pure returns (Bytes11Slot) { + return Bytes11Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes11Slot slot) internal view returns (bytes11 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes11Slot slot, bytes11 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes11Slot slot) internal view returns (bytes11 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes11Slot slot, bytes11 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes12. + */ + type Bytes12Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes12Slot. + */ + function asBytes12Slot(bytes32 slot) internal pure returns (Bytes12Slot) { + return Bytes12Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes12Slot slot) internal view returns (bytes12 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes12Slot slot, bytes12 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes12Slot slot) internal view returns (bytes12 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes12Slot slot, bytes12 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes13. + */ + type Bytes13Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes13Slot. + */ + function asBytes13Slot(bytes32 slot) internal pure returns (Bytes13Slot) { + return Bytes13Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes13Slot slot) internal view returns (bytes13 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes13Slot slot, bytes13 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes13Slot slot) internal view returns (bytes13 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes13Slot slot, bytes13 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes14. + */ + type Bytes14Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes14Slot. + */ + function asBytes14Slot(bytes32 slot) internal pure returns (Bytes14Slot) { + return Bytes14Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes14Slot slot) internal view returns (bytes14 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes14Slot slot, bytes14 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes14Slot slot) internal view returns (bytes14 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes14Slot slot, bytes14 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes15. + */ + type Bytes15Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes15Slot. + */ + function asBytes15Slot(bytes32 slot) internal pure returns (Bytes15Slot) { + return Bytes15Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes15Slot slot) internal view returns (bytes15 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes15Slot slot, bytes15 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes15Slot slot) internal view returns (bytes15 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes15Slot slot, bytes15 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes16. + */ + type Bytes16Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes16Slot. + */ + function asBytes16Slot(bytes32 slot) internal pure returns (Bytes16Slot) { + return Bytes16Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes16Slot slot) internal view returns (bytes16 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes16Slot slot, bytes16 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes16Slot slot) internal view returns (bytes16 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes16Slot slot, bytes16 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes17. + */ + type Bytes17Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes17Slot. + */ + function asBytes17Slot(bytes32 slot) internal pure returns (Bytes17Slot) { + return Bytes17Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes17Slot slot) internal view returns (bytes17 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes17Slot slot, bytes17 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes17Slot slot) internal view returns (bytes17 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes17Slot slot, bytes17 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes18. + */ + type Bytes18Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes18Slot. + */ + function asBytes18Slot(bytes32 slot) internal pure returns (Bytes18Slot) { + return Bytes18Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes18Slot slot) internal view returns (bytes18 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes18Slot slot, bytes18 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes18Slot slot) internal view returns (bytes18 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes18Slot slot, bytes18 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes19. + */ + type Bytes19Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes19Slot. + */ + function asBytes19Slot(bytes32 slot) internal pure returns (Bytes19Slot) { + return Bytes19Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes19Slot slot) internal view returns (bytes19 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes19Slot slot, bytes19 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes19Slot slot) internal view returns (bytes19 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes19Slot slot, bytes19 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes20. + */ + type Bytes20Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes20Slot. + */ + function asBytes20Slot(bytes32 slot) internal pure returns (Bytes20Slot) { + return Bytes20Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes20Slot slot) internal view returns (bytes20 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes20Slot slot, bytes20 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes20Slot slot) internal view returns (bytes20 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes20Slot slot, bytes20 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes21. + */ + type Bytes21Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes21Slot. + */ + function asBytes21Slot(bytes32 slot) internal pure returns (Bytes21Slot) { + return Bytes21Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes21Slot slot) internal view returns (bytes21 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes21Slot slot, bytes21 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes21Slot slot) internal view returns (bytes21 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes21Slot slot, bytes21 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes22. + */ + type Bytes22Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes22Slot. + */ + function asBytes22Slot(bytes32 slot) internal pure returns (Bytes22Slot) { + return Bytes22Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes22Slot slot) internal view returns (bytes22 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes22Slot slot, bytes22 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes22Slot slot) internal view returns (bytes22 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes22Slot slot, bytes22 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes23. + */ + type Bytes23Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes23Slot. + */ + function asBytes23Slot(bytes32 slot) internal pure returns (Bytes23Slot) { + return Bytes23Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes23Slot slot) internal view returns (bytes23 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes23Slot slot, bytes23 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes23Slot slot) internal view returns (bytes23 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes23Slot slot, bytes23 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes24. + */ + type Bytes24Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes24Slot. + */ + function asBytes24Slot(bytes32 slot) internal pure returns (Bytes24Slot) { + return Bytes24Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes24Slot slot) internal view returns (bytes24 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes24Slot slot, bytes24 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes24Slot slot) internal view returns (bytes24 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes24Slot slot, bytes24 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes25. + */ + type Bytes25Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes25Slot. + */ + function asBytes25Slot(bytes32 slot) internal pure returns (Bytes25Slot) { + return Bytes25Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes25Slot slot) internal view returns (bytes25 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes25Slot slot, bytes25 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes25Slot slot) internal view returns (bytes25 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes25Slot slot, bytes25 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes26. + */ + type Bytes26Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes26Slot. + */ + function asBytes26Slot(bytes32 slot) internal pure returns (Bytes26Slot) { + return Bytes26Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes26Slot slot) internal view returns (bytes26 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes26Slot slot, bytes26 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes26Slot slot) internal view returns (bytes26 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes26Slot slot, bytes26 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes27. + */ + type Bytes27Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes27Slot. + */ + function asBytes27Slot(bytes32 slot) internal pure returns (Bytes27Slot) { + return Bytes27Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes27Slot slot) internal view returns (bytes27 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes27Slot slot, bytes27 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes27Slot slot) internal view returns (bytes27 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes27Slot slot, bytes27 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes28. + */ + type Bytes28Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes28Slot. + */ + function asBytes28Slot(bytes32 slot) internal pure returns (Bytes28Slot) { + return Bytes28Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes28Slot slot) internal view returns (bytes28 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes28Slot slot, bytes28 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes28Slot slot) internal view returns (bytes28 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes28Slot slot, bytes28 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes29. + */ + type Bytes29Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes29Slot. + */ + function asBytes29Slot(bytes32 slot) internal pure returns (Bytes29Slot) { + return Bytes29Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes29Slot slot) internal view returns (bytes29 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes29Slot slot, bytes29 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes29Slot slot) internal view returns (bytes29 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes29Slot slot, bytes29 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes30. + */ + type Bytes30Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes30Slot. + */ + function asBytes30Slot(bytes32 slot) internal pure returns (Bytes30Slot) { + return Bytes30Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes30Slot slot) internal view returns (bytes30 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes30Slot slot, bytes30 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes30Slot slot) internal view returns (bytes30 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes30Slot slot, bytes30 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes31. + */ + type Bytes31Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes31Slot. + */ + function asBytes31Slot(bytes32 slot) internal pure returns (Bytes31Slot) { + return Bytes31Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes31Slot slot) internal view returns (bytes31 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes31Slot slot, bytes31 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes31Slot slot) internal view returns (bytes31 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes31Slot slot, bytes31 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a bytes32. + */ + type Bytes32Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Bytes32Slot. + */ + function asBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot) { + return Bytes32Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Bytes32Slot slot) internal view returns (bytes32 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Bytes32Slot slot, bytes32 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Bytes32Slot slot) internal view returns (bytes32 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Bytes32Slot slot, bytes32 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint8. + */ + type Uint8Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint8Slot. + */ + function asUint8Slot(bytes32 slot) internal pure returns (Uint8Slot) { + return Uint8Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint8Slot slot) internal view returns (uint8 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint8Slot slot, uint8 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint8Slot slot) internal view returns (uint8 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint8Slot slot, uint8 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint16. + */ + type Uint16Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint16Slot. + */ + function asUint16Slot(bytes32 slot) internal pure returns (Uint16Slot) { + return Uint16Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint16Slot slot) internal view returns (uint16 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint16Slot slot, uint16 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint16Slot slot) internal view returns (uint16 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint16Slot slot, uint16 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint24. + */ + type Uint24Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint24Slot. + */ + function asUint24Slot(bytes32 slot) internal pure returns (Uint24Slot) { + return Uint24Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint24Slot slot) internal view returns (uint24 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint24Slot slot, uint24 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint24Slot slot) internal view returns (uint24 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint24Slot slot, uint24 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint32. + */ + type Uint32Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint32Slot. + */ + function asUint32Slot(bytes32 slot) internal pure returns (Uint32Slot) { + return Uint32Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint32Slot slot) internal view returns (uint32 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint32Slot slot, uint32 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint32Slot slot) internal view returns (uint32 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint32Slot slot, uint32 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint40. + */ + type Uint40Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint40Slot. + */ + function asUint40Slot(bytes32 slot) internal pure returns (Uint40Slot) { + return Uint40Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint40Slot slot) internal view returns (uint40 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint40Slot slot, uint40 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint40Slot slot) internal view returns (uint40 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint40Slot slot, uint40 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint48. + */ + type Uint48Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint48Slot. + */ + function asUint48Slot(bytes32 slot) internal pure returns (Uint48Slot) { + return Uint48Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint48Slot slot) internal view returns (uint48 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint48Slot slot, uint48 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint48Slot slot) internal view returns (uint48 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint48Slot slot, uint48 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint56. + */ + type Uint56Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint56Slot. + */ + function asUint56Slot(bytes32 slot) internal pure returns (Uint56Slot) { + return Uint56Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint56Slot slot) internal view returns (uint56 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint56Slot slot, uint56 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint56Slot slot) internal view returns (uint56 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint56Slot slot, uint56 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint64. + */ + type Uint64Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint64Slot. + */ + function asUint64Slot(bytes32 slot) internal pure returns (Uint64Slot) { + return Uint64Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint64Slot slot) internal view returns (uint64 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint64Slot slot, uint64 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint64Slot slot) internal view returns (uint64 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint64Slot slot, uint64 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint72. + */ + type Uint72Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint72Slot. + */ + function asUint72Slot(bytes32 slot) internal pure returns (Uint72Slot) { + return Uint72Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint72Slot slot) internal view returns (uint72 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint72Slot slot, uint72 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint72Slot slot) internal view returns (uint72 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint72Slot slot, uint72 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint80. + */ + type Uint80Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint80Slot. + */ + function asUint80Slot(bytes32 slot) internal pure returns (Uint80Slot) { + return Uint80Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint80Slot slot) internal view returns (uint80 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint80Slot slot, uint80 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint80Slot slot) internal view returns (uint80 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint80Slot slot, uint80 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint88. + */ + type Uint88Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint88Slot. + */ + function asUint88Slot(bytes32 slot) internal pure returns (Uint88Slot) { + return Uint88Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint88Slot slot) internal view returns (uint88 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint88Slot slot, uint88 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint88Slot slot) internal view returns (uint88 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint88Slot slot, uint88 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint96. + */ + type Uint96Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint96Slot. + */ + function asUint96Slot(bytes32 slot) internal pure returns (Uint96Slot) { + return Uint96Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint96Slot slot) internal view returns (uint96 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint96Slot slot, uint96 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint96Slot slot) internal view returns (uint96 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint96Slot slot, uint96 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint104. + */ + type Uint104Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint104Slot. + */ + function asUint104Slot(bytes32 slot) internal pure returns (Uint104Slot) { + return Uint104Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint104Slot slot) internal view returns (uint104 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint104Slot slot, uint104 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint104Slot slot) internal view returns (uint104 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint104Slot slot, uint104 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint112. + */ + type Uint112Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint112Slot. + */ + function asUint112Slot(bytes32 slot) internal pure returns (Uint112Slot) { + return Uint112Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint112Slot slot) internal view returns (uint112 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint112Slot slot, uint112 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint112Slot slot) internal view returns (uint112 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint112Slot slot, uint112 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint120. + */ + type Uint120Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint120Slot. + */ + function asUint120Slot(bytes32 slot) internal pure returns (Uint120Slot) { + return Uint120Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint120Slot slot) internal view returns (uint120 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint120Slot slot, uint120 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint120Slot slot) internal view returns (uint120 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint120Slot slot, uint120 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint128. + */ + type Uint128Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint128Slot. + */ + function asUint128Slot(bytes32 slot) internal pure returns (Uint128Slot) { + return Uint128Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint128Slot slot) internal view returns (uint128 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint128Slot slot, uint128 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint128Slot slot) internal view returns (uint128 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint128Slot slot, uint128 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint136. + */ + type Uint136Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint136Slot. + */ + function asUint136Slot(bytes32 slot) internal pure returns (Uint136Slot) { + return Uint136Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint136Slot slot) internal view returns (uint136 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint136Slot slot, uint136 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint136Slot slot) internal view returns (uint136 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint136Slot slot, uint136 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint144. + */ + type Uint144Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint144Slot. + */ + function asUint144Slot(bytes32 slot) internal pure returns (Uint144Slot) { + return Uint144Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint144Slot slot) internal view returns (uint144 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint144Slot slot, uint144 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint144Slot slot) internal view returns (uint144 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint144Slot slot, uint144 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint152. + */ + type Uint152Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint152Slot. + */ + function asUint152Slot(bytes32 slot) internal pure returns (Uint152Slot) { + return Uint152Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint152Slot slot) internal view returns (uint152 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint152Slot slot, uint152 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint152Slot slot) internal view returns (uint152 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint152Slot slot, uint152 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint160. + */ + type Uint160Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint160Slot. + */ + function asUint160Slot(bytes32 slot) internal pure returns (Uint160Slot) { + return Uint160Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint160Slot slot) internal view returns (uint160 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint160Slot slot, uint160 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint160Slot slot) internal view returns (uint160 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint160Slot slot, uint160 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint168. + */ + type Uint168Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint168Slot. + */ + function asUint168Slot(bytes32 slot) internal pure returns (Uint168Slot) { + return Uint168Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint168Slot slot) internal view returns (uint168 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint168Slot slot, uint168 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint168Slot slot) internal view returns (uint168 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint168Slot slot, uint168 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint176. + */ + type Uint176Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint176Slot. + */ + function asUint176Slot(bytes32 slot) internal pure returns (Uint176Slot) { + return Uint176Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint176Slot slot) internal view returns (uint176 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint176Slot slot, uint176 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint176Slot slot) internal view returns (uint176 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint176Slot slot, uint176 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint184. + */ + type Uint184Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint184Slot. + */ + function asUint184Slot(bytes32 slot) internal pure returns (Uint184Slot) { + return Uint184Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint184Slot slot) internal view returns (uint184 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint184Slot slot, uint184 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint184Slot slot) internal view returns (uint184 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint184Slot slot, uint184 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint192. + */ + type Uint192Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint192Slot. + */ + function asUint192Slot(bytes32 slot) internal pure returns (Uint192Slot) { + return Uint192Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint192Slot slot) internal view returns (uint192 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint192Slot slot, uint192 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint192Slot slot) internal view returns (uint192 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint192Slot slot, uint192 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint200. + */ + type Uint200Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint200Slot. + */ + function asUint200Slot(bytes32 slot) internal pure returns (Uint200Slot) { + return Uint200Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint200Slot slot) internal view returns (uint200 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint200Slot slot, uint200 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint200Slot slot) internal view returns (uint200 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint200Slot slot, uint200 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint208. + */ + type Uint208Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint208Slot. + */ + function asUint208Slot(bytes32 slot) internal pure returns (Uint208Slot) { + return Uint208Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint208Slot slot) internal view returns (uint208 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint208Slot slot, uint208 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint208Slot slot) internal view returns (uint208 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint208Slot slot, uint208 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint216. + */ + type Uint216Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint216Slot. + */ + function asUint216Slot(bytes32 slot) internal pure returns (Uint216Slot) { + return Uint216Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint216Slot slot) internal view returns (uint216 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint216Slot slot, uint216 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint216Slot slot) internal view returns (uint216 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint216Slot slot, uint216 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint224. + */ + type Uint224Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint224Slot. + */ + function asUint224Slot(bytes32 slot) internal pure returns (Uint224Slot) { + return Uint224Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint224Slot slot) internal view returns (uint224 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint224Slot slot, uint224 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint224Slot slot) internal view returns (uint224 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint224Slot slot, uint224 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint232. + */ + type Uint232Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint232Slot. + */ + function asUint232Slot(bytes32 slot) internal pure returns (Uint232Slot) { + return Uint232Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint232Slot slot) internal view returns (uint232 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint232Slot slot, uint232 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint232Slot slot) internal view returns (uint232 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint232Slot slot, uint232 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint240. + */ + type Uint240Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint240Slot. + */ + function asUint240Slot(bytes32 slot) internal pure returns (Uint240Slot) { + return Uint240Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint240Slot slot) internal view returns (uint240 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint240Slot slot, uint240 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint240Slot slot) internal view returns (uint240 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint240Slot slot, uint240 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint248. + */ + type Uint248Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint248Slot. + */ + function asUint248Slot(bytes32 slot) internal pure returns (Uint248Slot) { + return Uint248Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint248Slot slot) internal view returns (uint248 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint248Slot slot, uint248 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint248Slot slot) internal view returns (uint248 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint248Slot slot, uint248 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a uint256. + */ + type Uint256Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Uint256Slot. + */ + function asUint256Slot(bytes32 slot) internal pure returns (Uint256Slot) { + return Uint256Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Uint256Slot slot) internal view returns (uint256 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Uint256Slot slot, uint256 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Uint256Slot slot) internal view returns (uint256 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Uint256Slot slot, uint256 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int8. + */ + type Int8Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int8Slot. + */ + function asInt8Slot(bytes32 slot) internal pure returns (Int8Slot) { + return Int8Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int8Slot slot) internal view returns (int8 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int8Slot slot, int8 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int8Slot slot) internal view returns (int8 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int8Slot slot, int8 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int16. + */ + type Int16Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int16Slot. + */ + function asInt16Slot(bytes32 slot) internal pure returns (Int16Slot) { + return Int16Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int16Slot slot) internal view returns (int16 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int16Slot slot, int16 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int16Slot slot) internal view returns (int16 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int16Slot slot, int16 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int24. + */ + type Int24Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int24Slot. + */ + function asInt24Slot(bytes32 slot) internal pure returns (Int24Slot) { + return Int24Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int24Slot slot) internal view returns (int24 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int24Slot slot, int24 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int24Slot slot) internal view returns (int24 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int24Slot slot, int24 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int32. + */ + type Int32Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int32Slot. + */ + function asInt32Slot(bytes32 slot) internal pure returns (Int32Slot) { + return Int32Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int32Slot slot) internal view returns (int32 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int32Slot slot, int32 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int32Slot slot) internal view returns (int32 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int32Slot slot, int32 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int40. + */ + type Int40Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int40Slot. + */ + function asInt40Slot(bytes32 slot) internal pure returns (Int40Slot) { + return Int40Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int40Slot slot) internal view returns (int40 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int40Slot slot, int40 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int40Slot slot) internal view returns (int40 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int40Slot slot, int40 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int48. + */ + type Int48Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int48Slot. + */ + function asInt48Slot(bytes32 slot) internal pure returns (Int48Slot) { + return Int48Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int48Slot slot) internal view returns (int48 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int48Slot slot, int48 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int48Slot slot) internal view returns (int48 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int48Slot slot, int48 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int56. + */ + type Int56Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int56Slot. + */ + function asInt56Slot(bytes32 slot) internal pure returns (Int56Slot) { + return Int56Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int56Slot slot) internal view returns (int56 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int56Slot slot, int56 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int56Slot slot) internal view returns (int56 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int56Slot slot, int56 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int64. + */ + type Int64Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int64Slot. + */ + function asInt64Slot(bytes32 slot) internal pure returns (Int64Slot) { + return Int64Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int64Slot slot) internal view returns (int64 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int64Slot slot, int64 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int64Slot slot) internal view returns (int64 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int64Slot slot, int64 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int72. + */ + type Int72Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int72Slot. + */ + function asInt72Slot(bytes32 slot) internal pure returns (Int72Slot) { + return Int72Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int72Slot slot) internal view returns (int72 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int72Slot slot, int72 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int72Slot slot) internal view returns (int72 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int72Slot slot, int72 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int80. + */ + type Int80Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int80Slot. + */ + function asInt80Slot(bytes32 slot) internal pure returns (Int80Slot) { + return Int80Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int80Slot slot) internal view returns (int80 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int80Slot slot, int80 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int80Slot slot) internal view returns (int80 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int80Slot slot, int80 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int88. + */ + type Int88Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int88Slot. + */ + function asInt88Slot(bytes32 slot) internal pure returns (Int88Slot) { + return Int88Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int88Slot slot) internal view returns (int88 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int88Slot slot, int88 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int88Slot slot) internal view returns (int88 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int88Slot slot, int88 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int96. + */ + type Int96Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int96Slot. + */ + function asInt96Slot(bytes32 slot) internal pure returns (Int96Slot) { + return Int96Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int96Slot slot) internal view returns (int96 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int96Slot slot, int96 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int96Slot slot) internal view returns (int96 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int96Slot slot, int96 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int104. + */ + type Int104Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int104Slot. + */ + function asInt104Slot(bytes32 slot) internal pure returns (Int104Slot) { + return Int104Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int104Slot slot) internal view returns (int104 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int104Slot slot, int104 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int104Slot slot) internal view returns (int104 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int104Slot slot, int104 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int112. + */ + type Int112Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int112Slot. + */ + function asInt112Slot(bytes32 slot) internal pure returns (Int112Slot) { + return Int112Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int112Slot slot) internal view returns (int112 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int112Slot slot, int112 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int112Slot slot) internal view returns (int112 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int112Slot slot, int112 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int120. + */ + type Int120Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int120Slot. + */ + function asInt120Slot(bytes32 slot) internal pure returns (Int120Slot) { + return Int120Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int120Slot slot) internal view returns (int120 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int120Slot slot, int120 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int120Slot slot) internal view returns (int120 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int120Slot slot, int120 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int128. + */ + type Int128Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int128Slot. + */ + function asInt128Slot(bytes32 slot) internal pure returns (Int128Slot) { + return Int128Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int128Slot slot) internal view returns (int128 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int128Slot slot, int128 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int128Slot slot) internal view returns (int128 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int128Slot slot, int128 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int136. + */ + type Int136Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int136Slot. + */ + function asInt136Slot(bytes32 slot) internal pure returns (Int136Slot) { + return Int136Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int136Slot slot) internal view returns (int136 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int136Slot slot, int136 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int136Slot slot) internal view returns (int136 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int136Slot slot, int136 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int144. + */ + type Int144Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int144Slot. + */ + function asInt144Slot(bytes32 slot) internal pure returns (Int144Slot) { + return Int144Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int144Slot slot) internal view returns (int144 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int144Slot slot, int144 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int144Slot slot) internal view returns (int144 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int144Slot slot, int144 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int152. + */ + type Int152Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int152Slot. + */ + function asInt152Slot(bytes32 slot) internal pure returns (Int152Slot) { + return Int152Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int152Slot slot) internal view returns (int152 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int152Slot slot, int152 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int152Slot slot) internal view returns (int152 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int152Slot slot, int152 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int160. + */ + type Int160Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int160Slot. + */ + function asInt160Slot(bytes32 slot) internal pure returns (Int160Slot) { + return Int160Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int160Slot slot) internal view returns (int160 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int160Slot slot, int160 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int160Slot slot) internal view returns (int160 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int160Slot slot, int160 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int168. + */ + type Int168Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int168Slot. + */ + function asInt168Slot(bytes32 slot) internal pure returns (Int168Slot) { + return Int168Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int168Slot slot) internal view returns (int168 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int168Slot slot, int168 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int168Slot slot) internal view returns (int168 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int168Slot slot, int168 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int176. + */ + type Int176Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int176Slot. + */ + function asInt176Slot(bytes32 slot) internal pure returns (Int176Slot) { + return Int176Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int176Slot slot) internal view returns (int176 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int176Slot slot, int176 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int176Slot slot) internal view returns (int176 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int176Slot slot, int176 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int184. + */ + type Int184Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int184Slot. + */ + function asInt184Slot(bytes32 slot) internal pure returns (Int184Slot) { + return Int184Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int184Slot slot) internal view returns (int184 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int184Slot slot, int184 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int184Slot slot) internal view returns (int184 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int184Slot slot, int184 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int192. + */ + type Int192Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int192Slot. + */ + function asInt192Slot(bytes32 slot) internal pure returns (Int192Slot) { + return Int192Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int192Slot slot) internal view returns (int192 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int192Slot slot, int192 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int192Slot slot) internal view returns (int192 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int192Slot slot, int192 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int200. + */ + type Int200Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int200Slot. + */ + function asInt200Slot(bytes32 slot) internal pure returns (Int200Slot) { + return Int200Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int200Slot slot) internal view returns (int200 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int200Slot slot, int200 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int200Slot slot) internal view returns (int200 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int200Slot slot, int200 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int208. + */ + type Int208Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int208Slot. + */ + function asInt208Slot(bytes32 slot) internal pure returns (Int208Slot) { + return Int208Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int208Slot slot) internal view returns (int208 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int208Slot slot, int208 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int208Slot slot) internal view returns (int208 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int208Slot slot, int208 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int216. + */ + type Int216Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int216Slot. + */ + function asInt216Slot(bytes32 slot) internal pure returns (Int216Slot) { + return Int216Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int216Slot slot) internal view returns (int216 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int216Slot slot, int216 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int216Slot slot) internal view returns (int216 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int216Slot slot, int216 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int224. + */ + type Int224Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int224Slot. + */ + function asInt224Slot(bytes32 slot) internal pure returns (Int224Slot) { + return Int224Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int224Slot slot) internal view returns (int224 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int224Slot slot, int224 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int224Slot slot) internal view returns (int224 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int224Slot slot, int224 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int232. + */ + type Int232Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int232Slot. + */ + function asInt232Slot(bytes32 slot) internal pure returns (Int232Slot) { + return Int232Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int232Slot slot) internal view returns (int232 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int232Slot slot, int232 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int232Slot slot) internal view returns (int232 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int232Slot slot, int232 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int240. + */ + type Int240Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int240Slot. + */ + function asInt240Slot(bytes32 slot) internal pure returns (Int240Slot) { + return Int240Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int240Slot slot) internal view returns (int240 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int240Slot slot, int240 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int240Slot slot) internal view returns (int240 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int240Slot slot, int240 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int248. + */ + type Int248Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int248Slot. + */ + function asInt248Slot(bytes32 slot) internal pure returns (Int248Slot) { + return Int248Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int248Slot slot) internal view returns (int248 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int248Slot slot, int248 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int248Slot slot) internal view returns (int248 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int248Slot slot, int248 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } + + /** + * @dev UDVT that represent a slot holding a int256. + */ + type Int256Slot is bytes32; + + /** + * @dev Cast an arbitrary slot to a Int256Slot. + */ + function asInt256Slot(bytes32 slot) internal pure returns (Int256Slot) { + return Int256Slot.wrap(slot); + } + + /** + * @dev Load the value held at location `slot` in (normal) storage. + */ + function sload(Int256Slot slot) internal view returns (int256 value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in (normal) storage. + */ + function sstore(Int256Slot slot, int256 value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } + } + + /** + * @dev Load the value held at location `slot` in transient storage. + */ + function tload(Int256Slot slot) internal view returns (int256 value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } + } + + /** + * @dev Store `value` at location `slot` in transient storage. + */ + function tstore(Int256Slot slot, int256 value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } + } +} diff --git a/foundry.toml b/foundry.toml index cf207ffe984..391c40e6f11 100644 --- a/foundry.toml +++ b/foundry.toml @@ -1,4 +1,6 @@ [profile.default] +solc_version = '0.8.24' +evm_version = 'cancun' src = 'contracts' out = 'out' libs = ['node_modules', 'lib'] diff --git a/hardhat.config.js b/hardhat.config.js index b91a8865836..0716ca57823 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -18,7 +18,7 @@ const { argv } = require('yargs/yargs')() compiler: { alias: 'compileVersion', type: 'string', - default: '0.8.20', + default: '0.8.24', }, src: { alias: 'source', @@ -36,6 +36,11 @@ const { argv } = require('yargs/yargs')() type: 'boolean', default: false, }, + evm: { + alias: 'evmVersion', + type: 'string', + default: 'cancun', + }, // Extra modules coverage: { type: 'boolean', @@ -78,6 +83,7 @@ module.exports = { enabled: withOptimizations, runs: 200, }, + evmVersion: argv.evm, viaIR: withOptimizations && argv.ir, outputSelection: { '*': { '*': ['storageLayout'] } }, }, @@ -90,11 +96,13 @@ module.exports = { '*': { 'code-size': withOptimizations, 'unused-param': !argv.coverage, // coverage causes unused-param warnings + 'transient-storage': false, default: 'error', }, }, networks: { hardhat: { + hardfork: argv.evm, allowUnlimitedContractSize, initialBaseFeePerGas: argv.coverage ? 0 : undefined, }, @@ -102,7 +110,7 @@ module.exports = { exposed: { imports: true, initializers: true, - exclude: ['vendor/**/*', '**/*WithInit.sol'], + exclude: ['vendor/**/*', '**/*WithInit.sol', 'utils/Slots.sol'], }, gasReporter: { enabled: argv.gas, diff --git a/package-lock.json b/package-lock.json index 773e1028dd7..3ab391bf2b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "openzeppelin-solidity", - "version": "5.0.1", + "version": "5.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openzeppelin-solidity", - "version": "5.0.1", + "version": "5.0.2", "license": "MIT", "devDependencies": { "@changesets/changelog-github": "^0.5.0", @@ -26,10 +26,10 @@ "ethers": "^6.7.1", "glob": "^10.3.5", "graphlib": "^2.1.8", - "hardhat": "^2.17.4", + "hardhat": "^2.21.0", "hardhat-exposed": "^0.3.14-0", "hardhat-gas-reporter": "^1.0.9", - "hardhat-ignore-warnings": "^0.2.0", + "hardhat-ignore-warnings": "^0.2.11", "lodash.startcase": "^4.4.0", "micromatch": "^4.0.2", "p-limit": "^3.1.0", @@ -109,32 +109,6 @@ "node": ">=6.9.0" } }, - "node_modules/@chainsafe/as-sha256": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz", - "integrity": "sha512-hldFFYuf49ed7DAakWVXSJODuq3pzJEguD8tQ7h+sGkM18vja+OFoJI9krnGmgzyuZC2ETX0NOIcCTy31v2Mtg==", - "dev": true - }, - "node_modules/@chainsafe/persistent-merkle-tree": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.4.2.tgz", - "integrity": "sha512-lLO3ihKPngXLTus/L7WHKaw9PnNJWizlOF1H9NNzHP6Xvh82vzg9F2bzkXhYIFshMZ2gTCEz8tq6STe7r5NDfQ==", - "dev": true, - "dependencies": { - "@chainsafe/as-sha256": "^0.3.1" - } - }, - "node_modules/@chainsafe/ssz": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/@chainsafe/ssz/-/ssz-0.9.4.tgz", - "integrity": "sha512-77Qtg2N1ayqs4Bg/wvnWfg5Bta7iy7IRh8XqXh7oNMeP2HBbBwx8m6yTpA8p0EHItWPEBkgZd5S5/LSlp3GXuQ==", - "dev": true, - "dependencies": { - "@chainsafe/as-sha256": "^0.3.1", - "@chainsafe/persistent-merkle-tree": "^0.4.2", - "case": "^1.6.3" - } - }, "node_modules/@changesets/apply-release-plan": { "version": "6.1.4", "resolved": "https://registry.npmjs.org/@changesets/apply-release-plan/-/apply-release-plan-6.1.4.tgz", @@ -1779,304 +1753,233 @@ "node": ">= 8" } }, - "node_modules/@nomicfoundation/ethereumjs-block": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.2.tgz", - "integrity": "sha512-hSe6CuHI4SsSiWWjHDIzWhSiAVpzMUcDRpWYzN0T9l8/Rz7xNn3elwVOJ/tAyS0LqL6vitUD78Uk7lQDXZun7Q==", + "node_modules/@nomicfoundation/edr": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr/-/edr-0.2.1.tgz", + "integrity": "sha512-Dleau3ItHJh2n85G2J6AIPBoLgu/mOWkmrh26z3VsJE2tp/e00hUk/dqz85ncsVcBYEc6/YOn/DomWu0wSF9tQ==", "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-common": "4.0.2", - "@nomicfoundation/ethereumjs-rlp": "5.0.2", - "@nomicfoundation/ethereumjs-trie": "6.0.2", - "@nomicfoundation/ethereumjs-tx": "5.0.2", - "@nomicfoundation/ethereumjs-util": "9.0.2", - "ethereum-cryptography": "0.1.3", - "ethers": "^5.7.1" + "engines": { + "node": ">= 18" }, + "optionalDependencies": { + "@nomicfoundation/edr-darwin-arm64": "0.2.1", + "@nomicfoundation/edr-darwin-x64": "0.2.1", + "@nomicfoundation/edr-linux-arm64-gnu": "0.2.1", + "@nomicfoundation/edr-linux-arm64-musl": "0.2.1", + "@nomicfoundation/edr-linux-x64-gnu": "0.2.1", + "@nomicfoundation/edr-linux-x64-musl": "0.2.1", + "@nomicfoundation/edr-win32-arm64-msvc": "0.2.1", + "@nomicfoundation/edr-win32-ia32-msvc": "0.2.1", + "@nomicfoundation/edr-win32-x64-msvc": "0.2.1" + } + }, + "node_modules/@nomicfoundation/edr-darwin-arm64": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.2.1.tgz", + "integrity": "sha512-aMYaRaZVQ/TmyNJIoXf1bU4k0zfinaL9Sy1day4yGlL6eiQPFfRGj9W6TZaZIoYG0XTx/mQWD7dkXJ7LdrleJA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=14" + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-block/node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "node_modules/@nomicfoundation/edr-darwin-x64": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.2.1.tgz", + "integrity": "sha512-ma0SLcjHm5L3nPHcKFJB0jv/gKGSKaxr5Z65rurX/eaYUQJ7YGMsb8er9bSCo9rjzOtxf4FoPj3grL3zGpOj8A==", + "cpu": [ + "x64" + ], "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } + "optional": true, + "os": [ + "darwin" ], - "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" + "engines": { + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-blockchain": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.2.tgz", - "integrity": "sha512-8UUsSXJs+MFfIIAKdh3cG16iNmWzWC/91P40sazNvrqhhdR/RtGDlFk2iFTGbBAZPs2+klZVzhRX8m2wvuvz3w==", + "node_modules/@nomicfoundation/edr-linux-arm64-gnu": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.2.1.tgz", + "integrity": "sha512-NX3G4pBhRitWrjSGY3HTyCq3wKSm5YqrKVOCNQGl9/jcjSovqxlgzFMiTx4YZCzGntfJ/1om9AI84OWxYJjoDw==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.2", - "@nomicfoundation/ethereumjs-common": "4.0.2", - "@nomicfoundation/ethereumjs-ethash": "3.0.2", - "@nomicfoundation/ethereumjs-rlp": "5.0.2", - "@nomicfoundation/ethereumjs-trie": "6.0.2", - "@nomicfoundation/ethereumjs-tx": "5.0.2", - "@nomicfoundation/ethereumjs-util": "9.0.2", - "abstract-level": "^1.0.3", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "level": "^8.0.0", - "lru-cache": "^5.1.1", - "memory-level": "^1.0.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=14" + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-common": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.2.tgz", - "integrity": "sha512-I2WGP3HMGsOoycSdOTSqIaES0ughQTueOsddJ36aYVpI3SN8YSusgRFLwzDJwRFVIYDKx/iJz0sQ5kBHVgdDwg==", + "node_modules/@nomicfoundation/edr-linux-arm64-musl": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.2.1.tgz", + "integrity": "sha512-gdQ3QHkt9XRkdtOGQ8fMwS11MXdjLeZgLrqoial4V4qtMaamIMMhVczK+VEvUhD8p7G4BVmp6kmkvcsthmndmw==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-util": "9.0.2", - "crc-32": "^1.2.0" + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-ethash": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.2.tgz", - "integrity": "sha512-8PfoOQCcIcO9Pylq0Buijuq/O73tmMVURK0OqdjhwqcGHYC2PwhbajDh7GZ55ekB0Px197ajK3PQhpKoiI/UPg==", + "node_modules/@nomicfoundation/edr-linux-x64-gnu": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.2.1.tgz", + "integrity": "sha512-OqabFY37vji6mYbLD9CvG28lja68czeVw58oWByIhFV3BpBu/cyP1oAbhzk3LieylujabS3Ekpvjw2Tkf0A9RQ==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.2", - "@nomicfoundation/ethereumjs-rlp": "5.0.2", - "@nomicfoundation/ethereumjs-util": "9.0.2", - "abstract-level": "^1.0.3", - "bigint-crypto-utils": "^3.0.23", - "ethereum-cryptography": "0.1.3" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=14" + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-evm": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.2.tgz", - "integrity": "sha512-rBLcUaUfANJxyOx9HIdMX6uXGin6lANCulIm/pjMgRqfiCRMZie3WKYxTSd8ZE/d+qT+zTedBF4+VHTdTSePmQ==", + "node_modules/@nomicfoundation/edr-linux-x64-musl": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.2.1.tgz", + "integrity": "sha512-vHfFFK2EPISuQUQge+bdjXamb0EUjfl8srYSog1qfiwyLwLeuSbpyyFzDeITAgPpkkFuedTfJW553K0Hipspyg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "@ethersproject/providers": "^5.7.1", - "@nomicfoundation/ethereumjs-common": "4.0.2", - "@nomicfoundation/ethereumjs-tx": "5.0.2", - "@nomicfoundation/ethereumjs-util": "9.0.2", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "mcl-wasm": "^0.7.1", - "rustbn.js": "~0.2.0" - }, + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=14" + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-rlp": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.2.tgz", - "integrity": "sha512-QwmemBc+MMsHJ1P1QvPl8R8p2aPvvVcKBbvHnQOKBpBztEo0omN0eaob6FeZS/e3y9NSe+mfu3nNFBHszqkjTA==", + "node_modules/@nomicfoundation/edr-win32-arm64-msvc": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-arm64-msvc/-/edr-win32-arm64-msvc-0.2.1.tgz", + "integrity": "sha512-K/mui67RCKxghbSyvhvW3rvyVN1pa9M1Q9APUx1PtWjSSdXDFpqEY1NYsv2syb47Ca8ObJwVMF+LvnB6GvhUOQ==", + "cpu": [ + "arm64" + ], "dev": true, - "bin": { - "rlp": "bin/rlp" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=14" + "node": ">= 10" } }, - "node_modules/@nomicfoundation/ethereumjs-statemanager": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.2.tgz", - "integrity": "sha512-dlKy5dIXLuDubx8Z74sipciZnJTRSV/uHG48RSijhgm1V7eXYFC567xgKtsKiVZB1ViTP9iFL4B6Je0xD6X2OA==", + "node_modules/@nomicfoundation/edr-win32-ia32-msvc": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-ia32-msvc/-/edr-win32-ia32-msvc-0.2.1.tgz", + "integrity": "sha512-HHK0mXEtjvfjJrJlqcYgQCy3lZIXS1KNl2GaP8bwEIuEwx++XxXs/ThLjPepM1nhCGICij8IGy7p3KrkzRelsw==", + "cpu": [ + "ia32" + ], "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-common": "4.0.2", - "@nomicfoundation/ethereumjs-rlp": "5.0.2", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "ethers": "^5.7.1", - "js-sdsl": "^4.1.4" + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-statemanager/node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "node_modules/@nomicfoundation/edr-win32-x64-msvc": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.2.1.tgz", + "integrity": "sha512-FY4eQJdj1/y8ST0RyQycx63yr+lvdYNnUkzgWf4X+vPH1lOhXae+L2NDcNCQlTDAfQcD6yz0bkBUkLrlJ8pTww==", + "cpu": [ + "x64" + ], "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } + "optional": true, + "os": [ + "win32" ], - "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" + "engines": { + "node": ">= 18" } }, - "node_modules/@nomicfoundation/ethereumjs-trie": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.2.tgz", - "integrity": "sha512-yw8vg9hBeLYk4YNg5MrSJ5H55TLOv2FSWUTROtDtTMMmDGROsAu+0tBjiNGTnKRi400M6cEzoFfa89Fc5k8NTQ==", + "node_modules/@nomicfoundation/ethereumjs-common": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz", + "integrity": "sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg==", "dev": true, "dependencies": { - "@nomicfoundation/ethereumjs-rlp": "5.0.2", - "@nomicfoundation/ethereumjs-util": "9.0.2", - "@types/readable-stream": "^2.3.13", - "ethereum-cryptography": "0.1.3", - "readable-stream": "^3.6.0" + "@nomicfoundation/ethereumjs-util": "9.0.4" + } + }, + "node_modules/@nomicfoundation/ethereumjs-rlp": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.4.tgz", + "integrity": "sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw==", + "dev": true, + "bin": { + "rlp": "bin/rlp.cjs" }, "engines": { - "node": ">=14" + "node": ">=18" } }, "node_modules/@nomicfoundation/ethereumjs-tx": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.2.tgz", - "integrity": "sha512-T+l4/MmTp7VhJeNloMkM+lPU3YMUaXdcXgTGCf8+ZFvV9NYZTRLFekRwlG6/JMmVfIfbrW+dRRJ9A6H5Q/Z64g==", + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.4.tgz", + "integrity": "sha512-Xjv8wAKJGMrP1f0n2PeyfFCCojHd7iS3s/Ab7qzF1S64kxZ8Z22LCMynArYsVqiFx6rzYy548HNVEyI+AYN/kw==", "dev": true, "dependencies": { - "@chainsafe/ssz": "^0.9.2", - "@ethersproject/providers": "^5.7.2", - "@nomicfoundation/ethereumjs-common": "4.0.2", - "@nomicfoundation/ethereumjs-rlp": "5.0.2", - "@nomicfoundation/ethereumjs-util": "9.0.2", + "@nomicfoundation/ethereumjs-common": "4.0.4", + "@nomicfoundation/ethereumjs-rlp": "5.0.4", + "@nomicfoundation/ethereumjs-util": "9.0.4", "ethereum-cryptography": "0.1.3" }, "engines": { - "node": ">=14" + "node": ">=18" + }, + "peerDependencies": { + "c-kzg": "^2.1.2" + }, + "peerDependenciesMeta": { + "c-kzg": { + "optional": true + } } }, "node_modules/@nomicfoundation/ethereumjs-util": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.2.tgz", - "integrity": "sha512-4Wu9D3LykbSBWZo8nJCnzVIYGvGCuyiYLIJa9XXNVt1q1jUzHdB+sJvx95VGCpPkCT+IbLecW6yfzy3E1bQrwQ==", + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.4.tgz", + "integrity": "sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q==", "dev": true, "dependencies": { - "@chainsafe/ssz": "^0.10.0", - "@nomicfoundation/ethereumjs-rlp": "5.0.2", + "@nomicfoundation/ethereumjs-rlp": "5.0.4", "ethereum-cryptography": "0.1.3" }, "engines": { - "node": ">=14" - } - }, - "node_modules/@nomicfoundation/ethereumjs-util/node_modules/@chainsafe/persistent-merkle-tree": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.5.0.tgz", - "integrity": "sha512-l0V1b5clxA3iwQLXP40zYjyZYospQLZXzBVIhhr9kDg/1qHZfzzHw0jj4VPBijfYCArZDlPkRi1wZaV2POKeuw==", - "dev": true, - "dependencies": { - "@chainsafe/as-sha256": "^0.3.1" - } - }, - "node_modules/@nomicfoundation/ethereumjs-util/node_modules/@chainsafe/ssz": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/@chainsafe/ssz/-/ssz-0.10.2.tgz", - "integrity": "sha512-/NL3Lh8K+0q7A3LsiFq09YXS9fPE+ead2rr7vM2QK8PLzrNsw3uqrif9bpRX5UxgeRjM+vYi+boCM3+GM4ovXg==", - "dev": true, - "dependencies": { - "@chainsafe/as-sha256": "^0.3.1", - "@chainsafe/persistent-merkle-tree": "^0.5.0" - } - }, - "node_modules/@nomicfoundation/ethereumjs-vm": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.2.tgz", - "integrity": "sha512-Bj3KZT64j54Tcwr7Qm/0jkeZXJMfdcAtRBedou+Hx0dPOSIgqaIr0vvLwP65TpHbak2DmAq+KJbW2KNtIoFwvA==", - "dev": true, - "dependencies": { - "@nomicfoundation/ethereumjs-block": "5.0.2", - "@nomicfoundation/ethereumjs-blockchain": "7.0.2", - "@nomicfoundation/ethereumjs-common": "4.0.2", - "@nomicfoundation/ethereumjs-evm": "2.0.2", - "@nomicfoundation/ethereumjs-rlp": "5.0.2", - "@nomicfoundation/ethereumjs-statemanager": "2.0.2", - "@nomicfoundation/ethereumjs-trie": "6.0.2", - "@nomicfoundation/ethereumjs-tx": "5.0.2", - "@nomicfoundation/ethereumjs-util": "9.0.2", - "debug": "^4.3.3", - "ethereum-cryptography": "0.1.3", - "mcl-wasm": "^0.7.1", - "rustbn.js": "~0.2.0" + "node": ">=18" }, - "engines": { - "node": ">=14" + "peerDependencies": { + "c-kzg": "^2.1.2" + }, + "peerDependenciesMeta": { + "c-kzg": { + "optional": true + } } }, "node_modules/@nomicfoundation/hardhat-chai-matchers": { @@ -2930,22 +2833,6 @@ "integrity": "sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg==", "dev": true }, - "node_modules/@types/readable-stream": { - "version": "2.3.15", - "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-2.3.15.tgz", - "integrity": "sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ==", - "dev": true, - "dependencies": { - "@types/node": "*", - "safe-buffer": "~5.1.1" - } - }, - "node_modules/@types/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, "node_modules/@types/secp256k1": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", @@ -2967,48 +2854,6 @@ "integrity": "sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q==", "dev": true }, - "node_modules/abstract-level": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/abstract-level/-/abstract-level-1.0.3.tgz", - "integrity": "sha512-t6jv+xHy+VYwc4xqZMn2Pa9DjcdzvzZmQGRjTFc8spIbRGHgBrEKbPq+rYXc7CCo0lxgYvSgKVg9qZAhpVQSjA==", - "dev": true, - "dependencies": { - "buffer": "^6.0.3", - "catering": "^2.1.0", - "is-buffer": "^2.0.5", - "level-supports": "^4.0.0", - "level-transcoder": "^1.0.1", - "module-error": "^1.0.1", - "queue-microtask": "^1.2.3" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/abstract-level/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", @@ -3110,6 +2955,59 @@ "node": ">=0.4.2" } }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-align/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/ansi-colors": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", @@ -3404,26 +3302,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/bech32": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", @@ -3442,15 +3320,6 @@ "node": ">=4" } }, - "node_modules/bigint-crypto-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/bigint-crypto-utils/-/bigint-crypto-utils-3.3.0.tgz", - "integrity": "sha512-jOTSb+drvEDxEq6OuUybOAv/xxoh3cuYRUIPyu8sSHQNKM303UQ2R1DAo45o1AkcIXw6fzbaFI1+xGGdaXs2lg==", - "dev": true, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -3472,6 +3341,142 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "dev": true }, + "node_modules/boxen": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.1.2.tgz", + "integrity": "sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ==", + "dev": true, + "dependencies": { + "ansi-align": "^3.0.0", + "camelcase": "^6.2.0", + "chalk": "^4.1.0", + "cli-boxes": "^2.2.1", + "string-width": "^4.2.2", + "type-fest": "^0.20.2", + "widest-line": "^3.1.0", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/boxen/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/boxen/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/boxen/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/boxen/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/boxen/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -3509,18 +3514,6 @@ "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==", "dev": true }, - "node_modules/browser-level": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browser-level/-/browser-level-1.0.1.tgz", - "integrity": "sha512-XECYKJ+Dbzw0lbydyQuJzwNXtOpbMSq737qxJN11sIRTErOMShvDpbzTlgju7orJKvx4epULolZAuJGLzCmWRQ==", - "dev": true, - "dependencies": { - "abstract-level": "^1.0.2", - "catering": "^2.1.1", - "module-error": "^1.0.2", - "run-parallel-limit": "^1.1.0" - } - }, "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", @@ -3619,6 +3612,18 @@ "node": ">=6" } }, + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/camelcase-keys": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-6.2.2.tgz", @@ -3645,30 +3650,12 @@ "node": ">=6" } }, - "node_modules/case": { - "version": "1.6.3", - "resolved": "https://registry.npmjs.org/case/-/case-1.6.3.tgz", - "integrity": "sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ==", - "dev": true, - "engines": { - "node": ">= 0.8.0" - } - }, "node_modules/caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==", "dev": true }, - "node_modules/catering": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.1.tgz", - "integrity": "sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/cbor": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/cbor/-/cbor-9.0.1.tgz", @@ -3801,23 +3788,6 @@ "safe-buffer": "^5.0.1" } }, - "node_modules/classic-level": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/classic-level/-/classic-level-1.3.0.tgz", - "integrity": "sha512-iwFAJQYtqRTRM0F6L8h4JCt00ZSGdOyqh7yVrhhjrOpFhmBjNlRUey64MCiyo6UmQHMJ+No3c81nujPv+n9yrg==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "abstract-level": "^1.0.2", - "catering": "^2.1.0", - "module-error": "^1.0.1", - "napi-macros": "^2.2.2", - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", @@ -3827,6 +3797,18 @@ "node": ">=6" } }, + "node_modules/cli-boxes": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cli-table3": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.5.1.tgz", @@ -4083,18 +4065,6 @@ "js-yaml": "bin/js-yaml.js" } }, - "node_modules/crc-32": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", - "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", - "dev": true, - "bin": { - "crc32": "bin/crc32.njs" - }, - "engines": { - "node": ">=0.8" - } - }, "node_modules/create-hash": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", @@ -5701,12 +5671,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "node_modules/functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", @@ -6021,23 +5985,17 @@ } }, "node_modules/hardhat": { - "version": "2.17.4", - "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.17.4.tgz", - "integrity": "sha512-YTyHjVc9s14CY/O7Dbtzcr/92fcz6AzhrMaj6lYsZpYPIPLzOrFCZHHPxfGQB6FiE6IPNE0uJaAbr7zGF79goA==", + "version": "2.21.0", + "resolved": "https://registry.npmjs.org/hardhat/-/hardhat-2.21.0.tgz", + "integrity": "sha512-8DlJAVJDEVHaV1sh9FLuKLLgCFv9EAJ+M+8IbjSIPgoeNo3ss5L1HgGBMfnI88c7OzMEZkdcuyGoobFeK3Orqw==", "dev": true, "dependencies": { "@ethersproject/abi": "^5.1.2", "@metamask/eth-sig-util": "^4.0.0", - "@nomicfoundation/ethereumjs-block": "5.0.2", - "@nomicfoundation/ethereumjs-blockchain": "7.0.2", - "@nomicfoundation/ethereumjs-common": "4.0.2", - "@nomicfoundation/ethereumjs-evm": "2.0.2", - "@nomicfoundation/ethereumjs-rlp": "5.0.2", - "@nomicfoundation/ethereumjs-statemanager": "2.0.2", - "@nomicfoundation/ethereumjs-trie": "6.0.2", - "@nomicfoundation/ethereumjs-tx": "5.0.2", - "@nomicfoundation/ethereumjs-util": "9.0.2", - "@nomicfoundation/ethereumjs-vm": "7.0.2", + "@nomicfoundation/edr": "^0.2.0", + "@nomicfoundation/ethereumjs-common": "4.0.4", + "@nomicfoundation/ethereumjs-tx": "5.0.4", + "@nomicfoundation/ethereumjs-util": "9.0.4", "@nomicfoundation/solidity-analyzer": "^0.1.0", "@sentry/node": "^5.18.1", "@types/bn.js": "^5.1.0", @@ -6045,6 +6003,7 @@ "adm-zip": "^0.4.16", "aggregate-error": "^3.0.0", "ansi-escapes": "^4.3.0", + "boxen": "^5.1.2", "chalk": "^2.4.2", "chokidar": "^3.4.0", "ci-info": "^2.0.0", @@ -6119,9 +6078,9 @@ } }, "node_modules/hardhat-ignore-warnings": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/hardhat-ignore-warnings/-/hardhat-ignore-warnings-0.2.9.tgz", - "integrity": "sha512-q1oj6/ixiAx+lgIyGLBajVCSC7qUtAoK7LS9Nr8UVHYo8Iuh5naBiVGo4RDJ6wxbDGYBkeSukUGZrMqzC2DWwA==", + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/hardhat-ignore-warnings/-/hardhat-ignore-warnings-0.2.11.tgz", + "integrity": "sha512-+nHnRbP6COFZaXE7HAY7TZNE3au5vHe5dkcnyq0XaP07ikT2fJ3NhFY0vn7Deh4Qbz0Z/9Xpnj2ki6Ktgk61pg==", "dev": true, "dependencies": { "minimatch": "^5.1.0", @@ -6604,26 +6563,6 @@ "node": ">=0.10.0" } }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, "node_modules/ignore": { "version": "5.2.4", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", @@ -6796,29 +6735,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "engines": { - "node": ">=4" - } - }, "node_modules/is-callable": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", @@ -7109,16 +7025,6 @@ "@pkgjs/parseargs": "^0.11.0" } }, - "node_modules/js-sdsl": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.4.2.tgz", - "integrity": "sha512-dwXFwByc/ajSV6m5bcKAPwe4yDDF6D614pxmIi5odytzxRlwqF6nwoiCek80Ixc7Cvma5awClxrzFtxCQvcM8w==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/js-sdsl" - } - }, "node_modules/js-sha3": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", @@ -7237,69 +7143,6 @@ "node": ">=6" } }, - "node_modules/level": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/level/-/level-8.0.0.tgz", - "integrity": "sha512-ypf0jjAk2BWI33yzEaaotpq7fkOPALKAgDBxggO6Q9HGX2MRXn0wbP1Jn/tJv1gtL867+YOjOB49WaUF3UoJNQ==", - "dev": true, - "dependencies": { - "browser-level": "^1.0.1", - "classic-level": "^1.2.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/level" - } - }, - "node_modules/level-supports": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-4.0.1.tgz", - "integrity": "sha512-PbXpve8rKeNcZ9C1mUicC9auIYFyGpkV9/i6g76tLgANwWhtG2v7I4xNBUlkn3lE2/dZF3Pi0ygYGtLc4RXXdA==", - "dev": true, - "engines": { - "node": ">=12" - } - }, - "node_modules/level-transcoder": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-transcoder/-/level-transcoder-1.0.1.tgz", - "integrity": "sha512-t7bFwFtsQeD8cl8NIoQ2iwxA0CL/9IFw7/9gAjOonH0PWTTiRfY7Hq+Ejbsxh86tXobDQ6IOiddjNYIfOBs06w==", - "dev": true, - "dependencies": { - "buffer": "^6.0.3", - "module-error": "^1.0.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/level-transcoder/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -7477,15 +7320,6 @@ "integrity": "sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==", "dev": true }, - "node_modules/lru-cache": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", - "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", - "dev": true, - "dependencies": { - "yallist": "^3.0.2" - } - }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -7512,15 +7346,6 @@ "integrity": "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q==", "dev": true }, - "node_modules/mcl-wasm": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/mcl-wasm/-/mcl-wasm-0.7.9.tgz", - "integrity": "sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ==", - "dev": true, - "engines": { - "node": ">=8.9.0" - } - }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -7532,20 +7357,6 @@ "safe-buffer": "^5.1.2" } }, - "node_modules/memory-level": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/memory-level/-/memory-level-1.0.0.tgz", - "integrity": "sha512-UXzwewuWeHBz5krr7EvehKcmLFNoXxGcvuYhC41tRnkrTbJohtS7kVn9akmgirtRygg+f7Yjsfi8Uu5SGSQ4Og==", - "dev": true, - "dependencies": { - "abstract-level": "^1.0.0", - "functional-red-black-tree": "^1.0.1", - "module-error": "^1.0.1" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", @@ -8017,15 +7828,6 @@ "node": ">=10" } }, - "node_modules/module-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz", - "integrity": "sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -8044,12 +7846,6 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, - "node_modules/napi-macros": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.2.2.tgz", - "integrity": "sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g==", - "dev": true - }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -9095,35 +8891,6 @@ "queue-microtask": "^1.2.2" } }, - "node_modules/run-parallel-limit": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz", - "integrity": "sha512-jJA7irRNM91jaKc3Hcl1npHsFLOXOoTkPCUL1JEa1R82O2miplXXRaGdjW/KM/98YQWDhJLiSs793CnXfblJUw==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "queue-microtask": "^1.2.2" - } - }, - "node_modules/rustbn.js": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/rustbn.js/-/rustbn.js-0.2.0.tgz", - "integrity": "sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA==", - "dev": true - }, "node_modules/safe-array-concat": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.1.tgz", @@ -11360,6 +11127,62 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/widest-line": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", + "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", + "dev": true, + "dependencies": { + "string-width": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/widest-line/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/word-wrap": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", @@ -11606,12 +11429,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", - "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", - "dev": true - }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", @@ -11667,18 +11484,6 @@ "node": ">=10" } }, - "node_modules/yargs-unparser/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/yargs-unparser/node_modules/decamelize": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", diff --git a/package.json b/package.json index 80c41b49c7d..b9d78ae4cb3 100644 --- a/package.json +++ b/package.json @@ -66,10 +66,10 @@ "ethers": "^6.7.1", "glob": "^10.3.5", "graphlib": "^2.1.8", - "hardhat": "^2.17.4", + "hardhat": "^2.21.0", "hardhat-exposed": "^0.3.14-0", "hardhat-gas-reporter": "^1.0.9", - "hardhat-ignore-warnings": "^0.2.0", + "hardhat-ignore-warnings": "^0.2.11", "lodash.startcase": "^4.4.0", "micromatch": "^4.0.2", "p-limit": "^3.1.0", diff --git a/scripts/checks/compareGasReports.js b/scripts/checks/compareGasReports.js index 1afe1d3686e..fd94dc266dc 100755 --- a/scripts/checks/compareGasReports.js +++ b/scripts/checks/compareGasReports.js @@ -50,7 +50,7 @@ class Report { // Compare two reports static compare(update, ref, opts = { hideEqual: true, strictTesting: false }) { if (JSON.stringify(update.config.metadata) !== JSON.stringify(ref.config.metadata)) { - throw new Error('Reports produced with non matching metadata'); + console.warn('WARNING: Reports produced with non matching metadata'); } const deployments = update.info.deployments diff --git a/scripts/generate/run.js b/scripts/generate/run.js index 53589455ab5..d15dd7f282f 100755 --- a/scripts/generate/run.js +++ b/scripts/generate/run.js @@ -37,6 +37,8 @@ for (const [file, template] of Object.entries({ 'utils/structs/EnumerableMap.sol': './templates/EnumerableMap.js', 'utils/structs/Checkpoints.sol': './templates/Checkpoints.js', 'utils/StorageSlot.sol': './templates/StorageSlot.js', + 'utils/Slots.sol': './templates/Slots.js', + 'mocks/SlotsMock.sol': './templates/SlotsMock.js', })) { generateFromTemplate(file, template, './contracts/'); } diff --git a/scripts/generate/templates/SafeCast.js b/scripts/generate/templates/SafeCast.js index a10ee75c975..fdac73ebb20 100644 --- a/scripts/generate/templates/SafeCast.js +++ b/scripts/generate/templates/SafeCast.js @@ -21,25 +21,25 @@ pragma solidity ^0.8.20; `; const errors = `\ - /** - * @dev Value doesn't fit in an uint of \`bits\` size. - */ - error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); - - /** - * @dev An int value doesn't fit in an uint of \`bits\` size. - */ - error SafeCastOverflowedIntToUint(int256 value); - - /** - * @dev Value doesn't fit in an int of \`bits\` size. - */ - error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); - - /** - * @dev An uint value doesn't fit in an int of \`bits\` size. - */ - error SafeCastOverflowedUintToInt(uint256 value); +/** + * @dev Value doesn't fit in an uint of \`bits\` size. + */ +error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value); + +/** + * @dev An int value doesn't fit in an uint of \`bits\` size. + */ +error SafeCastOverflowedIntToUint(int256 value); + +/** + * @dev Value doesn't fit in an int of \`bits\` size. + */ +error SafeCastOverflowedIntDowncast(uint8 bits, int256 value); + +/** + * @dev An uint value doesn't fit in an int of \`bits\` size. + */ +error SafeCastOverflowedUintToInt(uint256 value); `; const toUintDownCast = length => `\ diff --git a/scripts/generate/templates/Slots.js b/scripts/generate/templates/Slots.js new file mode 100644 index 00000000000..b17d037a288 --- /dev/null +++ b/scripts/generate/templates/Slots.js @@ -0,0 +1,137 @@ +const format = require('../format-lines'); +const { TYPES } = require('./Slots.opts'); + +const header = `\ +pragma solidity ^0.8.24; + +/** + * @dev Library for derivating, reading and writing to storage slots. This supports both "normal" and transient storage. + * + * Note: Transient storage operations (\`tload\` and \`tstore\`) only works on networks where EIP-1153[https://eips.ethereum.org/EIPS/eip-1153] is available. + */ +`; + +const tooling = () => `\ +/** + * @dev Derive an ERC-1967 slot from a string (path). + */ +function erc1967slot(string memory path) internal pure returns (bytes32 slot) { + /// @solidity memory-safe-assembly + assembly { + slot := sub(keccak256(add(path, 0x20), mload(path)), 1) + } +} + +/** + * @dev Derive an ERC-7201 slot from a string (path). + */ +function erc7201slot(string memory path) internal pure returns (bytes32 slot) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, sub(keccak256(add(path, 0x20), mload(path)), 1)) + slot := and(keccak256(0x00, 0x20), not(0xff)) + } +} + +/** + * @dev Add an offset to a slot to get the n-th element of a structure or an array. + */ +function offset(bytes32 slot, uint256 pos) internal pure returns (bytes32 result) { + unchecked { + return bytes32(uint256(slot) + pos); + } +} + +/** + * @dev Derive the location of the first element in an array from the slot where the length is stored. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ +function deriveArray(bytes32 slot) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, slot) + result := keccak256(0x00, 0x20) + } +} +`; + +const derive = ({ type }) => `\ +/** + * @dev Derive the location of a mapping element from the key. + * + * See: https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. + */ +function deriveMapping(bytes32 slot, ${type} key) internal pure returns (bytes32 result) { + /// @solidity memory-safe-assembly + assembly { + mstore(0x00, key) + mstore(0x20, slot) + result := keccak256(0x00, 0x40) + } +} +`; + +const generate = ({ udvt, type }) => `\ +/** + * @dev UDVT that represent a slot holding a ${type}. + */ +type ${udvt} is bytes32; + +/** + * @dev Cast an arbitrary slot to a ${udvt}. + */ +function as${udvt}(bytes32 slot) internal pure returns (${udvt}) { + return ${udvt}.wrap(slot); +} + +/** + * @dev Load the value held at location \`slot\` in (normal) storage. + */ +function sload(${udvt} slot) internal view returns (${type} value) { + /// @solidity memory-safe-assembly + assembly { + value := sload(slot) + } +} + +/** + * @dev Store \`value\` at location \`slot\` in (normal) storage. + */ +function sstore(${udvt} slot, ${type} value) internal { + /// @solidity memory-safe-assembly + assembly { + sstore(slot, value) + } +} + +/** + * @dev Load the value held at location \`slot\` in transient storage. + */ +function tload(${udvt} slot) internal view returns (${type} value) { + /// @solidity memory-safe-assembly + assembly { + value := tload(slot) + } +} + +/** + * @dev Store \`value\` at location \`slot\` in transient storage. + */ +function tstore(${udvt} slot, ${type} value) internal { + /// @solidity memory-safe-assembly + assembly { + tstore(slot, value) + } +} +`; + +// GENERATE +module.exports = format( + header.trimEnd(), + 'library Slots {', + tooling(), + TYPES.flatMap(t => derive(t)), + TYPES.flatMap(t => generate(t)), + '}', +); diff --git a/scripts/generate/templates/Slots.opts.js b/scripts/generate/templates/Slots.opts.js new file mode 100644 index 00000000000..b22d40c5425 --- /dev/null +++ b/scripts/generate/templates/Slots.opts.js @@ -0,0 +1,18 @@ +const { capitalize, range } = require('../../helpers'); + +const TYPES = [] + .concat( + 'bool', + 'address', + range(1, 33).map(i => `bytes${i}`), + range(8, 264, 8).map(i => `uint${i}`), + range(8, 264, 8).map(i => `int${i}`), + ) + .map(type => ({ + udvt: `${capitalize(type)}Slot`, + type, + })); + +module.exports = { + TYPES, +}; diff --git a/scripts/generate/templates/SlotsMock.js b/scripts/generate/templates/SlotsMock.js new file mode 100644 index 00000000000..e58cd45b89d --- /dev/null +++ b/scripts/generate/templates/SlotsMock.js @@ -0,0 +1,42 @@ +const format = require('../format-lines'); +const { TYPES } = require('./Slots.opts'); + +const header = `\ +pragma solidity ^0.8.24; + +import {Multicall} from "../utils/Multicall.sol"; +import {Slots} from "../utils/Slots.sol"; +`; + +const common = () => `\ +using Slots for *; + +function erc1967slot(string memory path) public pure returns (bytes32 slot) { + return path.erc1967slot(); +} + +function erc7201slot(string memory path) public pure returns (bytes32 slot) { + return path.erc7201slot(); +} +`; + +const generate = ({ udvt, type }) => `\ +event ${udvt}Value(bytes32 slot, ${type} value); + +function tload${udvt}(bytes32 slot) public { + emit ${udvt}Value(slot, slot.as${udvt}().tload()); +} + +function tstore(bytes32 slot, ${type} value) public { + slot.as${udvt}().tstore(value); +} +`; + +// GENERATE +module.exports = format( + header.trimEnd(), + 'contract SlotsMock is Multicall {', + common(), + TYPES.flatMap(t => generate(t)), + '}', +); diff --git a/scripts/helpers.js b/scripts/helpers.js index 52102bdaf1b..d28c0866d1c 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -1,10 +1,7 @@ const iterate = require('../test/helpers/iterate'); +const strings = require('../test/helpers/strings'); module.exports = { - // Capitalize the first char of a string - // Example: capitalize('uint256') → 'Uint256' - capitalize: str => str.charAt(0).toUpperCase() + str.slice(1), - - // Iterate tools for the test helpers ...iterate, + ...strings, }; diff --git a/test/helpers/strings.js b/test/helpers/strings.js new file mode 100644 index 00000000000..4f34099d7df --- /dev/null +++ b/test/helpers/strings.js @@ -0,0 +1,5 @@ +module.exports = { + // Capitalize the first char of a string + // Example: capitalize('uint256') → 'Uint256' + capitalize: str => str.charAt(0).toUpperCase() + str.slice(1), +}; diff --git a/test/utils/ReentrancyGuard.test.js b/test/utils/ReentrancyGuard.test.js index 871967e2fae..c4418563eb5 100644 --- a/test/utils/ReentrancyGuard.test.js +++ b/test/utils/ReentrancyGuard.test.js @@ -2,46 +2,49 @@ const { ethers } = require('hardhat'); const { expect } = require('chai'); const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers'); -async function fixture() { - const mock = await ethers.deployContract('ReentrancyMock'); - return { mock }; -} - -describe('ReentrancyGuard', function () { - beforeEach(async function () { - Object.assign(this, await loadFixture(fixture)); - }); - - it('nonReentrant function can be called', async function () { - expect(await this.mock.counter()).to.equal(0n); - await this.mock.callback(); - expect(await this.mock.counter()).to.equal(1n); - }); - - it('does not allow remote callback', async function () { - const attacker = await ethers.deployContract('ReentrancyAttack'); - await expect(this.mock.countAndCall(attacker)).to.be.revertedWith('ReentrancyAttack: failed call'); - }); - - it('_reentrancyGuardEntered should be true when guarded', async function () { - await this.mock.guardedCheckEntered(); +for (const variant of ['', 'Transient']) { + describe(`Reentrancy${variant}Guard`, function () { + async function fixture() { + const name = `Reentrancy${variant}Mock`; + const mock = await ethers.deployContract(name); + return { name, mock }; + } + + beforeEach(async function () { + Object.assign(this, await loadFixture(fixture)); + }); + + it('nonReentrant function can be called', async function () { + expect(await this.mock.counter()).to.equal(0n); + await this.mock.callback(); + expect(await this.mock.counter()).to.equal(1n); + }); + + it('does not allow remote callback', async function () { + const attacker = await ethers.deployContract('ReentrancyAttack'); + await expect(this.mock.countAndCall(attacker)).to.be.revertedWith('ReentrancyAttack: failed call'); + }); + + it('_reentrancyGuardEntered should be true when guarded', async function () { + await this.mock.guardedCheckEntered(); + }); + + it('_reentrancyGuardEntered should be false when unguarded', async function () { + await this.mock.unguardedCheckNotEntered(); + }); + + // The following are more side-effects than intended behavior: + // I put them here as documentation, and to monitor any changes + // in the side-effects. + it('does not allow local recursion', async function () { + await expect(this.mock.countLocalRecursive(10n)).to.be.revertedWithCustomError( + this.mock, + 'ReentrancyGuardReentrantCall', + ); + }); + + it('does not allow indirect local recursion', async function () { + await expect(this.mock.countThisRecursive(10n)).to.be.revertedWith(`${this.name}: failed call`); + }); }); - - it('_reentrancyGuardEntered should be false when unguarded', async function () { - await this.mock.unguardedCheckNotEntered(); - }); - - // The following are more side-effects than intended behavior: - // I put them here as documentation, and to monitor any changes - // in the side-effects. - it('does not allow local recursion', async function () { - await expect(this.mock.countLocalRecursive(10n)).to.be.revertedWithCustomError( - this.mock, - 'ReentrancyGuardReentrantCall', - ); - }); - - it('does not allow indirect local recursion', async function () { - await expect(this.mock.countThisRecursive(10n)).to.be.revertedWith('ReentrancyMock: failed call'); - }); -}); +} diff --git a/test/utils/Slots.t.sol b/test/utils/Slots.t.sol new file mode 100644 index 00000000000..c7a7d8170c6 --- /dev/null +++ b/test/utils/Slots.t.sol @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.20; + +import {Test} from "forge-std/Test.sol"; + +import {Slots} from "@openzeppelin/contracts/utils/Slots.sol"; + +contract SlotsTest is Test { + using Slots for *; + + // Variable declarations + uint256 private _variable; + uint256[] private _array; + mapping(address => uint256) private _mapping; + + // Tests + function testValue1(uint256 value) public { + // set in solidity + _variable = value; + // read using Slots + assertEq(_getVariableSlot().asUint256Slot().sload(), value); + } + + function testValue2(uint256 value) public { + // set using Slots + _getVariableSlot().asUint256Slot().sstore(value); + // read in solidity + assertEq(_variable, value); + } + + function testArray1(uint256[] calldata values) public { + // set in solidity + _array = values; + // read using Slots + assertEq(_getArraySlot().asUint256Slot().sload(), values.length); + for (uint256 i = 0; i < values.length; ++i) { + assertEq(_getArraySlot().deriveArray().offset(i).asUint256Slot().sload(), values[i]); + } + } + + function testArray2(uint256[] calldata values) public { + // set using Slots + _getArraySlot().asUint256Slot().sstore(values.length); + for (uint256 i = 0; i < values.length; ++i) { + _getArraySlot().deriveArray().offset(i).asUint256Slot().sstore(values[i]); + } + // read in solidity + assertEq(_array, values); + } + + function testMapping1(address key, uint256 value) public { + // set in solidity + _mapping[key] = value; + // read using Slots + assertEq(_getMappingSlot().deriveMapping(key).asUint256Slot().sload(), value); + } + + function testMapping2(address key, uint256 value) public { + // set using Slots + _getMappingSlot().deriveMapping(key).asUint256Slot().sstore(value); + // read in solidity + assertEq(_mapping[key], value); + } + + // Slot extraction + function _getVariableSlot() public pure returns (bytes32 slot) { + assembly { + slot := _variable.slot + } + } + + function _getArraySlot() public pure returns (bytes32 slot) { + assembly { + slot := _array.slot + } + } + + function _getMappingSlot() public pure returns (bytes32 slot) { + assembly { + slot := _mapping.slot + } + } +} diff --git a/test/utils/Slots.test.js b/test/utils/Slots.test.js new file mode 100644 index 00000000000..268f4e0747a --- /dev/null +++ b/test/utils/Slots.test.js @@ -0,0 +1,70 @@ +const { ethers } = require('hardhat'); +const { expect } = require('chai'); +const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers'); +const { erc1967slot, erc7201slot } = require('../helpers/storage'); +const { generators } = require('../helpers/random'); +const { TYPES } = require('../../scripts/generate/templates/Slots.opts'); + +const slot = ethers.id('some.storage.slot'); +const otherSlot = ethers.id('some.other.storage.slot'); + +async function fixture() { + return { mock: await ethers.deployContract('SlotsMock') }; +} + +describe('Slots', function () { + beforeEach(async function () { + Object.assign(this, await loadFixture(fixture)); + }); + + describe('slot derivation', function () { + const path = 'example.main'; + + it('erc-1967', async function () { + expect(await this.mock.erc1967slot(path)).to.equal(erc1967slot(path)); + }); + + it('erc-7201', async function () { + expect(await this.mock.erc7201slot(path)).to.equal(erc7201slot(path)); + }); + }); + + for (const { type, value, zero } of [ + { type: 'bool', value: true, zero: false }, + { type: 'address', value: generators.address(), zero: ethers.ZeroAddress }, + { type: 'bytes32', value: generators.bytes32(), zero: ethers.ZeroHash }, + { type: 'uint256', value: generators.uint256(), zero: 0n }, + ]) { + describe(type, function () { + const { udvt } = TYPES.find(t => t.type === type); + const load = `tload${udvt}(bytes32)`; + const store = `tstore(bytes32,${type})`; + const event = `${udvt}Value`; + + it('load', async function () { + await expect(this.mock[load](slot)).to.emit(this.mock, event).withArgs(slot, zero); + }); + + it('store and load (2tx)', async function () { + await this.mock[store](slot, value); + await expect(this.mock[load](slot)).to.emit(this.mock, event).withArgs(slot, zero); + }); + + it('store and load (batched)', async function () { + await expect( + this.mock.multicall([ + this.mock.interface.encodeFunctionData(store, [slot, value]), + this.mock.interface.encodeFunctionData(load, [slot]), + this.mock.interface.encodeFunctionData(load, [otherSlot]), + ]), + ) + .to.emit(this.mock, event) + .withArgs(slot, value) + .to.emit(this.mock, event) + .withArgs(otherSlot, zero); + + await expect(this.mock[load](slot)).to.emit(this.mock, event).withArgs(slot, zero); + }); + }); + } +});