@openzeppelin/upgrades-core 1.24.0 → 1.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/2c91e356abc6b5659ece0ab630d11e46.json"
3
+ "buildInfo": "../../../../../build-info/7c04d086fb2715e4c62026e93a4a3a8a.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/2c91e356abc6b5659ece0ab630d11e46.json"
3
+ "buildInfo": "../../../../../build-info/7c04d086fb2715e4c62026e93a4a3a8a.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/2c91e356abc6b5659ece0ab630d11e46.json"
3
+ "buildInfo": "../../../../../build-info/7c04d086fb2715e4c62026e93a4a3a8a.json"
4
4
  }
@@ -3,24 +3,6 @@
3
3
  "input": {
4
4
  "language": "Solidity",
5
5
  "sources": {
6
- "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": {
7
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeaconUpgradeable {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n"
8
- },
9
- "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": {
10
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeaconUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/StorageSlotUpgradeable.sol\";\nimport \"../utils/Initializable.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967UpgradeUpgradeable is Initializable {\n function __ERC1967Upgrade_init() internal initializer {\n __ERC1967Upgrade_init_unchained();\n }\n\n function __ERC1967Upgrade_init_unchained() internal initializer {\n }\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(AddressUpgradeable.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallSecure(address newImplementation, bytes memory data, bool forceCall) internal {\n address oldImplementation = _getImplementation();\n\n // Initial upgrade and setup call\n _setImplementation(newImplementation);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(newImplementation, data);\n }\n\n // Perform rollback test if not already in progress\n StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT);\n if (!rollbackTesting.value) {\n // Trigger rollback using upgradeTo from the new implementation\n rollbackTesting.value = true;\n _functionDelegateCall(\n newImplementation,\n abi.encodeWithSignature(\n \"upgradeTo(address)\",\n oldImplementation\n )\n );\n rollbackTesting.value = false;\n // Check rollback was effective\n require(oldImplementation == _getImplementation(), \"ERC1967Upgrade: upgrade breaks further upgrades\");\n // Finally reset to the new implementation and log the upgrade\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(\n AddressUpgradeable.isContract(newBeacon),\n \"ERC1967: new beacon is not a contract\"\n );\n require(\n AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /*\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) {\n require(AddressUpgradeable.isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, \"Address: low-level delegate call failed\");\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n uint256[50] private __gap;\n}\n"
11
- },
12
- "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
13
- "content": "// SPDX-License-Identifier: MIT\n\n// solhint-disable-next-line compiler-version\npragma solidity ^0.8.0;\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n */\nabstract contract Initializable {\n\n /**\n * @dev Indicates that the contract has been initialized.\n */\n bool private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Modifier to protect an initializer function from being invoked twice.\n */\n modifier initializer() {\n require(_initializing || !_initialized, \"Initializable: contract is already initialized\");\n\n bool isTopLevelCall = !_initializing;\n if (isTopLevelCall) {\n _initializing = true;\n _initialized = true;\n }\n\n _;\n\n if (isTopLevelCall) {\n _initializing = false;\n }\n }\n}\n"
14
- },
15
- "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": {
16
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967UpgradeUpgradeable.sol\";\nimport \"./Initializable.sol\";\n\n/**\n * @dev Base contract for building openzeppelin-upgrades compatible implementations for the {ERC1967Proxy}. It includes\n * publicly available upgrade functions that are called by the plugin and by the secure upgrade mechanism to verify\n * continuation of the upgradability.\n *\n * The {_authorizeUpgrade} function MUST be overridden to include access restriction to the upgrade mechanism.\n *\n * _Available since v4.1._\n */\nabstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable {\n function __UUPSUpgradeable_init() internal initializer {\n __ERC1967Upgrade_init_unchained();\n __UUPSUpgradeable_init_unchained();\n }\n\n function __UUPSUpgradeable_init_unchained() internal initializer {\n }\n function upgradeTo(address newImplementation) external virtual {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallSecure(newImplementation, bytes(\"\"), false);\n }\n\n function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual {\n _authorizeUpgrade(newImplementation);\n _upgradeToAndCallSecure(newImplementation, data, true);\n }\n\n function _authorizeUpgrade(address newImplementation) internal virtual;\n uint256[50] private __gap;\n}\n"
17
- },
18
- "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
19
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n"
20
- },
21
- "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": {
22
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlotUpgradeable {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n}\n"
23
- },
24
6
  "@openzeppelin/contracts/access/Ownable.sol": {
25
7
  "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor () {\n address msgSender = _msgSender();\n _owner = msgSender;\n emit OwnershipTransferred(address(0), msgSender);\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n _;\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n emit OwnershipTransferred(_owner, address(0));\n _owner = address(0);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n emit OwnershipTransferred(_owner, newOwner);\n _owner = newOwner;\n }\n}\n"
26
8
  },
@@ -56,156 +38,6 @@
56
38
  },
57
39
  "@openzeppelin/contracts/utils/StorageSlot.sol": {
58
40
  "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n assembly {\n r.slot := slot\n }\n }\n}\n"
59
- },
60
- "contracts/import.sol": {
61
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol\";\nimport \"@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol\";\nimport \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\n\n// Kept for backwards compatibility with older versions of Hardhat and Truffle plugins.\ncontract AdminUpgradeabilityProxy is TransparentUpgradeableProxy {\n constructor(address logic, address admin, bytes memory data) payable TransparentUpgradeableProxy(logic, admin, data) {}\n}\n"
62
- },
63
- "contracts/test/ignore-errors/AllowChild.sol": {
64
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./AllowParent.sol\";\n\ncontract AllowChild is AllowParent {\n function shouldBeAllowed(bytes memory data) public {\n internalDelegateCall(data);\n }\n}\n"
65
- },
66
- "contracts/test/ignore-errors/AllowChildCallTransitive.sol": {
67
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./AllowReachableParentCall.sol\";\n\ncontract AllowChildCallTransitive is AllowReachableParentCall {\n function myfunction(bytes memory data) internal {\n allowed(data);\n }\n}\n"
68
- },
69
- "contracts/test/ignore-errors/AllowChildInheritedTransitive.sol": {
70
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveAllowReachable.sol\";\n\ncontract AllowChildInheritedTransitive is TransitiveAllowReachable {\n}\n"
71
- },
72
- "contracts/test/ignore-errors/AllowChildSelfReachable.sol": {
73
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./AllowParentSelfReachable.sol\";\n\ncontract AllowChildSelfReachable is AllowParentSelfReachable {\n function shouldBeAllowed(bytes memory data) public {\n internalDelegateCall(data);\n }\n}\n"
74
- },
75
- "contracts/test/ignore-errors/AllowParent.sol": {
76
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * allow causes the delegatecall to be ignored for all functions in this contract\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\ncontract AllowParent {\n function internalDelegateCall(\n bytes memory data\n ) internal returns (bytes memory) {\n (, bytes memory returndata) = address(this).delegatecall(data);\n return returndata;\n }\n}"
77
- },
78
- "contracts/test/ignore-errors/AllowParentSelfReachable.sol": {
79
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\n/**\n * allow-reachable causes the delegatecall to be ignored for all functions in this contract, including its own lexical scope\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\ncontract AllowParentSelfReachable {\n function internalDelegateCall(\n bytes memory data\n ) internal returns (bytes memory) {\n (, bytes memory returndata) = address(this).delegatecall(data);\n return returndata;\n }\n}"
80
- },
81
- "contracts/test/ignore-errors/AllowReachable.sol": {
82
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveRiskyLibrary.sol\";\n\n// allow-reachable causes the delegatecall in a transitive function to be ignored\ncontract AllowReachable {\n /// @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n function unsafe(bytes memory data) public {\n TransitiveRiskyLibrary.internalDelegateCall(address(this), data);\n }\n}\n"
83
- },
84
- "contracts/test/ignore-errors/AllowReachableParent.sol": {
85
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveUnsafeParent.sol\";\n\n/**\n * allow-reachable causes the delegatecall in a parent function to be ignored\n *\n * this is actually unsafe but only allowed here for testing purposes!\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\ncontract AllowReachableParent is TransitiveUnsafeParent {\n}\n"
86
- },
87
- "contracts/test/ignore-errors/AllowReachableParentCall.sol": {
88
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyParentContract.sol\";\n\n/**\n * allow-reachable causes the delegatecall to be ignored for all reachable functions from this contract\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\ncontract AllowReachableParentCall is RiskyParentContract {\n function allowed(bytes memory data) internal {\n internalDelegateCall(address(this), data);\n }\n}"
89
- },
90
- "contracts/test/ignore-errors/Constructors.sol": {
91
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nabstract contract UnsafeParent {\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor(bytes memory data) {\n (bool s, ) = msg.sender.delegatecall(data);\n s;\n }\n}\n\ncontract UnsafeChild1 is UnsafeParent {\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() UnsafeParent('') {}\n\n function foo1(uint x) public {}\n}\n\ncontract UnsafeChild2 is UnsafeParent('') {\n function foo2(uint x) public {}\n}\n\nabstract contract UnsafeParentNoArgs {\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n (bool s, ) = msg.sender.delegatecall(\"\");\n s;\n }\n}\n\ncontract UnsafeChild3 is UnsafeParentNoArgs {\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() UnsafeParentNoArgs() {}\n\n function foo3(uint x) public {}\n}\n\ncontract UnsafeChild4 is UnsafeParentNoArgs {\n function foo4(uint x) public {}\n}\n\n/**\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract AllowParentNoArgs {\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n (bool s, ) = msg.sender.delegatecall(\"\");\n s;\n }\n}\n\ncontract AllowChild5 is AllowParentNoArgs {\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() AllowParentNoArgs() {}\n\n function foo5(uint x) public {}\n}\n\ncontract AllowChild6 is AllowParentNoArgs {\n function foo6(uint x) public {}\n}\n\n/**\n * allow has no effect because the delegatecall is in a parent function\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\ncontract UnsafeAllowChild7 is UnsafeParentNoArgs {\n function foo7(uint x) public {}\n}\n\n/**\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\ncontract AllowReachableChild8 is UnsafeParentNoArgs {\n function foo8(uint x) public {}\n}\n\nabstract contract UnsafeFunctions {\n function unsafe() internal {\n (bool s, ) = msg.sender.delegatecall(\"\");\n s;\n }\n}\n\ncontract UnsafeChild9 is UnsafeFunctions {\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n unsafe();\n }\n\n function foo9(uint x) public {}\n}"
92
- },
93
- "contracts/test/ignore-errors/Modifiers.sol": {
94
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nabstract contract UnsafeParentModifier {\n modifier unsafe(bytes memory data) {\n _;\n (bool s, ) = msg.sender.delegatecall(data);\n s;\n }\n}\n\n// TODO: do not throw an error in this case\n// contract ModifierNotUsed is UnsafeParentModifier {\n// function foo() public {}\n// }\n\ncontract ModifierUsed is UnsafeParentModifier {\n function foo() public unsafe('') {}\n}\n"
95
- },
96
- "contracts/test/ignore-errors/RiskyFreeFunctions.sol": {
97
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nfunction isContract(address account) view returns (bool) {\n return account.code.length > 0;\n}\n\nfunction freeDelegateCall(\n address target,\n bytes memory data\n) returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n}\n"
98
- },
99
- "contracts/test/ignore-errors/RiskyLibrary.sol": {
100
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nlibrary RiskyLibrary {\n function isContract(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function internalDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n\n function privateDelegateCall(\n address target,\n bytes memory data\n ) private returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n\n function publicDelegateCall(\n address target,\n bytes memory data\n ) public returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n\n function externalDelegateCall(\n address target,\n bytes memory data\n ) external returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n}"
101
- },
102
- "contracts/test/ignore-errors/RiskyParentContract.sol": {
103
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\ncontract RiskyParentContract {\n function isContract(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function internalDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n\n function privateDelegateCall(\n address target,\n bytes memory data\n ) private returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n}"
104
- },
105
- "contracts/test/ignore-errors/SafeContract.sol": {
106
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\ncontract SafeContract {\n}\n"
107
- },
108
- "contracts/test/ignore-errors/SafeContractWithFreeFunctionCall.sol": {
109
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyFreeFunctions.sol\" as RiskyFreeFunctions;\n\ncontract SafeContractWithFreeFunctionCall {\n function safe() public view returns (bool) {\n return RiskyFreeFunctions.isContract(address(this));\n }\n}\n"
110
- },
111
- "contracts/test/ignore-errors/SafeContractWithLibraryCall.sol": {
112
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyLibrary.sol\";\n\ncontract SafeContractWithLibraryCall {\n function safe() public view returns (bool) {\n return RiskyLibrary.isContract(address(this));\n }\n}\n"
113
- },
114
- "contracts/test/ignore-errors/SafeContractWithLibraryImport.sol": {
115
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyLibrary.sol\";\n\ncontract SafeContractWithLibraryImport {\n\n}\n"
116
- },
117
- "contracts/test/ignore-errors/SafeContractWithLibraryUsingFor.sol": {
118
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyLibrary.sol\";\n\ncontract SafeContractWithLibraryUsingFor {\n using RiskyLibrary for address;\n\n function safe() public view returns (bool) {\n return address(this).isContract();\n }\n}\n"
119
- },
120
- "contracts/test/ignore-errors/SafeContractWithParentCall.sol": {
121
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyParentContract.sol\";\n\ncontract SafeContractWithParentCall is RiskyParentContract {\n function safe() public view returns (bool) {\n return isContract(address(this));\n }\n}\n"
122
- },
123
- "contracts/test/ignore-errors/SafeContractWithTransitiveLibraryCall.sol": {
124
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveRiskyLibrary.sol\";\n\ncontract SafeContractWithTransitiveLibraryCall {\n function safe() public view returns (bool) {\n return TransitiveRiskyLibrary.isContract(address(this));\n }\n}\n"
125
- },
126
- "contracts/test/ignore-errors/SafeRecursion.sol": {
127
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyParentContract.sol\";\n\ncontract SafeRecursion is RiskyParentContract {\n function safe(uint256 i) public view returns (bool) {\n if (++i == 10) {\n return isContract(address(this));\n } else {\n return safe(i);\n }\n }\n}\n"
128
- },
129
- "contracts/test/ignore-errors/TransitiveAllowReachable.sol": {
130
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyLibrary.sol\";\n\n/**\n * allow delegatecalls on all of this contract's functions and reachable code\n *\n * @custom:oz-upgrades-unsafe-allow-reachable delegatecall\n */\ncontract TransitiveAllowReachable {\n function internalDelegateCall(\n bytes memory data\n ) external returns (bytes memory) {\n return RiskyLibrary.internalDelegateCall(address(this), data);\n }\n}"
131
- },
132
- "contracts/test/ignore-errors/TransitiveRiskyLibrary.sol": {
133
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyLibrary.sol\";\n\nlibrary TransitiveRiskyLibrary {\n function isContract(address account) internal view returns (bool) {\n return RiskyLibrary.isContract(account);\n }\n\n function internalDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n return RiskyLibrary.internalDelegateCall(target, data);\n }\n}"
134
- },
135
- "contracts/test/ignore-errors/TransitiveUnsafeParent.sol": {
136
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./UnsafeParentContract.sol\";\n\ncontract TransitiveUnsafeParent is UnsafeParentContract {\n}"
137
- },
138
- "contracts/test/ignore-errors/UnsafeAllow.sol": {
139
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveRiskyLibrary.sol\";\n\n// allow has no effect because the delegatecall is in a transitive function\ncontract UnsafeAllow {\n /// @custom:oz-upgrades-unsafe-allow delegatecall\n function unsafe(address target, bytes memory data) public {\n TransitiveRiskyLibrary.internalDelegateCall(target, data);\n }\n}\n"
140
- },
141
- "contracts/test/ignore-errors/UnsafeAllowParent.sol": {
142
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveUnsafeParent.sol\";\n\n/**\n * allow has no effect because the delegatecall is in a parent function\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\ncontract UnsafeAllowParent is TransitiveUnsafeParent {\n}\n"
143
- },
144
- "contracts/test/ignore-errors/UnsafeAllowReachableDifferentOpcode.sol": {
145
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveRiskyLibrary.sol\";\n\n// allow-reachable has no effect because the transitive function has a different opcode\ncontract UnsafeAllowReachableDifferentOpcode {\n /// @custom:oz-upgrades-unsafe-allow-reachable selfdestruct\n function unsafe(bytes memory data) public {\n TransitiveRiskyLibrary.internalDelegateCall(address(this), data);\n }\n}\n"
146
- },
147
- "contracts/test/ignore-errors/UnsafeAllowReachableParentDifferentOpcode.sol": {
148
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveUnsafeParent.sol\";\n\n/**\n * allow-reachable has no effect because the parent function has a different opcode\n *\n * @custom:oz-upgrades-unsafe-allow-reachable selfdestruct\n */\ncontract UnsafeAllowReachableParentDifferentOpcode is TransitiveUnsafeParent {\n}\n"
149
- },
150
- "contracts/test/ignore-errors/UnsafeContract.sol": {
151
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\ncontract UnsafeContract {\n function externalDelegateCall(\n address target,\n bytes memory data\n ) external returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n}\n"
152
- },
153
- "contracts/test/ignore-errors/UnsafeContractWithFreeFunctionCall.sol": {
154
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyFreeFunctions.sol\" as RiskyFreeFunctions;\n\ncontract UnsafeContractWithFreeFunctionCall {\n function unsafe(address target, bytes memory data) public {\n RiskyFreeFunctions.freeDelegateCall(target, data);\n }\n}\n"
155
- },
156
- "contracts/test/ignore-errors/UnsafeContractWithInheritedParent.sol": {
157
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./UnsafeParentContract.sol\";\n\ncontract UnsafeContractWithInheritedParent is UnsafeParentContract {\n}\n"
158
- },
159
- "contracts/test/ignore-errors/UnsafeContractWithInheritedTransitiveParent.sol": {
160
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveUnsafeParent.sol\";\n\ncontract UnsafeContractWithInheritedTransitiveParent is TransitiveUnsafeParent {\n}\n"
161
- },
162
- "contracts/test/ignore-errors/UnsafeContractWithLibraryCall.sol": {
163
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyLibrary.sol\";\n\ncontract UnsafeContractWithLibraryCall {\n function unsafe(address target, bytes memory data) public {\n RiskyLibrary.internalDelegateCall(target, data);\n }\n}\n"
164
- },
165
- "contracts/test/ignore-errors/UnsafeContractWithLibraryUsingFor.sol": {
166
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyLibrary.sol\";\n\ncontract UnsafeContractWithLibraryUsingFor {\n using RiskyLibrary for address;\n\n function unsafe(address target, bytes memory data) public {\n target.internalDelegateCall(data);\n }\n}\n"
167
- },
168
- "contracts/test/ignore-errors/UnsafeContractWithParentCall.sol": {
169
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyParentContract.sol\";\n\ncontract UnsafeContractWithParentCall is RiskyParentContract {\n function unsafe(address target, bytes memory data) public {\n internalDelegateCall(target, data);\n }\n}\n"
170
- },
171
- "contracts/test/ignore-errors/UnsafeContractWithTransitiveLibraryCall.sol": {
172
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./TransitiveRiskyLibrary.sol\";\n\ncontract UnsafeContractWithTransitiveLibraryCall {\n function unsafe(address target, bytes memory data) public {\n TransitiveRiskyLibrary.internalDelegateCall(target, data);\n }\n}\n"
173
- },
174
- "contracts/test/ignore-errors/UnsafeParentContract.sol": {
175
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\ncontract UnsafeParentContract {\n function isContract(address account) internal view returns (bool) {\n return account.code.length > 0;\n }\n\n function internalDelegateCall(\n address target,\n bytes memory data\n ) internal returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n\n function privateDelegateCall(\n address target,\n bytes memory data\n ) private returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n\n // unsafe!\n function publicDelegateCall(\n address target,\n bytes memory data\n ) public returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n\n // unsafe!\n function externalDelegateCall(\n address target,\n bytes memory data\n ) external returns (bytes memory) {\n (, bytes memory returndata) = target.delegatecall(data);\n return returndata;\n }\n}"
176
- },
177
- "contracts/test/ignore-errors/UnsafeRecursion.sol": {
178
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"./RiskyParentContract.sol\";\n\ncontract UnsafeRecursion is RiskyParentContract {\n function unsafe(uint256 i, address target, bytes memory data) public returns (bytes memory) {\n if (++i == 10) {\n return internalDelegateCall(target, data);\n } else {\n return unsafe(i, target, data);\n }\n }\n}\n"
179
- },
180
- "contracts/test/Memory08.sol": {
181
- "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\ncontract Memory08 {\n mapping(string => address) a;\n mapping(bytes => address) b;\n}\n\ncontract Memory08Bad {\n mapping(bytes => address) a;\n mapping(string => address) b;\n}\n"
182
- },
183
- "contracts/test/Proxiable.sol": {
184
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol\";\n\nabstract contract Proxiable is UUPSUpgradeable {\n function _authorizeUpgrade(address newImplementation) internal override {\n _beforeUpgrade(newImplementation);\n }\n\n function _beforeUpgrade(address newImplementation) internal virtual;\n}\n\ncontract ChildOfProxiable is Proxiable {\n function _beforeUpgrade(address newImplementation) internal virtual override {}\n}\n"
185
- },
186
- "contracts/test/RenamedRetyped.sol": {
187
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\ncontract RenameV1 {\n uint x;\n}\n\ncontract RenameV2 {\n /// @custom:oz-renamed-from x\n uint y;\n}\n\ncontract RetypeV1 {\n bool x;\n}\n\ncontract RetypeV2 {\n /// @dev a retyped variable\n /// @custom:oz-retyped-from bool\n uint8 x;\n}\n\ncontract WronglyReportedRetypeV3 {\n /// @custom:oz-retyped-from address\n uint8 x;\n}\n\ncontract MissmatchingTypeRetypeV4 {\n /// @custom:oz-retyped-from bool\n bytes32 x;\n}\n\ncontract ConfusingRetypeV1 {\n address y;\n bool x;\n}\n\ncontract ConfusingRetypeV2 {\n address y;\n /// @custom:oz-retyped-from address\n uint8 x;\n}\n\ncontract NonHardcodedRetypeV1 {\n address a;\n}\n\ncontract NonHardcodedRetypeV2 {\n /// @custom:oz-retyped-from address\n bytes20 a;\n}\n\ncontract LayoutChangeV1 {\n bool a;\n bool b;\n}\n\ncontract LayoutChangeV2 {\n /// @custom:oz-retyped-from bool\n uint16 a;\n\n /// @custom:oz-retyped-from bool\n uint8 b;\n}"
188
- },
189
- "contracts/test/RetypeFromContract.sol": {
190
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\ninterface CustomInterface {}\ncontract CustomContract {}\n\ninterface CustomInterface2 {}\ncontract CustomContract2 {}\n\ncontract RetypeContractToUint160V1 {\n CustomInterface a;\n CustomContract b;\n}\n\ncontract RetypeContractToUint160V2 {\n /// @custom:oz-retyped-from CustomInterface\n uint160 a;\n\n /// @custom:oz-retyped-from CustomContract\n uint160 b;\n}\n\ncontract RetypeUint160ToContractV1 {\n uint160 a;\n uint160 b;\n}\n\ncontract RetypeUint160ToContractV2 {\n /// @custom:oz-retyped-from uint160\n CustomInterface private a;\n\n /// @custom:oz-retyped-from uint160\n CustomContract private b;\n}\n\ncontract RetypeContractToUint160MappingV1 {\n mapping(uint8 => CustomInterface) a;\n mapping(uint8 => CustomContract) b;\n mapping(CustomInterface => CustomInterface) c;\n mapping(CustomContract => CustomContract) d;\n}\n\ncontract RetypeContractToUint160MappingV2 {\n /// @custom:oz-retyped-from mapping(uint8 => CustomInterface)\n mapping(uint8 => uint160) a;\n\n /// @custom:oz-retyped-from mapping(uint8 => CustomContract)\n mapping(uint8 => uint160) b;\n\n /// @custom:oz-retyped-from mapping(CustomInterface => CustomInterface)\n mapping(uint160 => uint160) c;\n\n /// @custom:oz-retyped-from mapping(CustomContract => CustomContract)\n mapping(uint160 => uint160) d;\n}\n\ncontract RetypeUint160ToContractMappingV1 {\n mapping(uint8 => uint160) a;\n mapping(uint8 => uint160) b;\n mapping(uint160 => uint160) c;\n mapping(uint160 => uint160) d;\n}\n\ncontract RetypeUint160ToContractMappingV2 {\n /// @custom:oz-retyped-from mapping(uint8 => uint160)\n mapping(uint8 => CustomInterface) a;\n\n /// @custom:oz-retyped-from mapping(uint8 => uint160)\n mapping(uint8 => CustomContract) b;\n\n /// @custom:oz-retyped-from mapping(uint160 => uint160)\n mapping(CustomInterface => CustomInterface) c;\n\n /// @custom:oz-retyped-from mapping(uint160 => uint160)\n mapping(CustomContract => CustomContract) d;\n}\n\ncontract ImplicitRetypeV1 {\n CustomInterface a;\n CustomContract b;\n\n address c;\n address d;\n\n CustomInterface e;\n CustomInterface f;\n\n CustomContract g;\n CustomContract h;\n}\n\ncontract ImplicitRetypeV2 {\n address a;\n address b;\n\n CustomInterface c;\n CustomContract d;\n\n CustomInterface2 e;\n CustomContract f;\n\n CustomContract2 g;\n CustomInterface h;\n}\n\ncontract ImplicitRetypeMappingV1 {\n mapping(uint8 => CustomInterface) a;\n mapping(uint8 => CustomContract) b;\n\n mapping(uint8 => address) c;\n mapping(uint8 => address) d;\n\n mapping(uint8 => CustomInterface) e;\n mapping(uint8 => CustomInterface) f;\n\n mapping(uint8 => CustomContract) g;\n mapping(uint8 => CustomContract) h;\n}\n\ncontract ImplicitRetypeMappingV2 {\n mapping(uint8 => address) a;\n mapping(uint8 => address) b;\n\n mapping(uint8 => CustomInterface) c;\n mapping(uint8 => CustomContract) d;\n\n mapping(uint8 => CustomInterface2) e;\n mapping(uint8 => CustomContract) f;\n\n mapping(uint8 => CustomContract2) g;\n mapping(uint8 => CustomInterface) h;\n}\n\nstruct StructUint256 {\n uint256 a;\n uint256 b;\n}\n\ncontract RetypeStructV1 {\n StructUint256 x;\n}\n\ncontract RetypeStructV2 {\n /// @custom:oz-retyped-from StructUint256\n uint256[2] x;\n}\n\ncontract RetypeStructV2Bad {\n /// @custom:oz-retyped-from StructUint256\n uint256[3] x;\n}\n\nenum MyEnums { ONE, TWO }\n\ncontract RetypeEnumV1 {\n MyEnums x;\n}\n\ncontract RetypeEnumV2 {\n /// @custom:oz-retyped-from MyEnums\n uint8 x;\n}\n\ncontract RetypeEnumV2Bad {\n /// @custom:oz-retyped-from MyEnums\n uint16 x;\n}"
191
- },
192
- "contracts/test/Standalone.sol": {
193
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\ncontract StandaloneV1 {\n uint a;\n string b;\n\n function extremelyUnsafe(address target, bytes memory data) public {\n (bool ok, ) = target.delegatecall(data);\n require(ok);\n }\n}\n\ncontract StandaloneV2Good {\n uint a;\n string b;\n uint c;\n}\n\ncontract StandaloneV2Bad {\n uint x;\n uint a;\n string b;\n}\n\ncontract StandaloneRenameV1 {\n uint x;\n}\n\ncontract StandaloneRenameV2 {\n /// @custom:oz-renamed-from x\n uint y;\n}\n\ncontract StandaloneRenameV3 is StandaloneRenameV2 {\n uint z;\n}"
194
- },
195
- "contracts/test/Storage089.sol": {
196
- "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\ncontract Storage089 {\n type MyUserValueType is uint128;\n MyUserValueType my_user_value;\n}\n\ncontract Storage089_V2 {\n type MyUserValueType is uint128;\n MyUserValueType my_user_value;\n\n uint x;\n}\n\ncontract Storage089_V3 {\n type MyUserValueType is uint8;\n MyUserValueType my_user_value;\n\n uint x;\n}\n"
197
- },
198
- "contracts/test/StorageRenamedRetyped.sol": {
199
- "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\ncontract StorageRenamedRetyped {\n /// @custom:oz-renamed-from b\n uint a;\n\n /// @custom:oz-retyped-from bool\n uint8 b;\n\n /// @custom:oz-renamed-from b\n /// @custom:oz-retyped-from bool\n uint8 c;\n\n /// @custom:oz-retyped-from bool\n /// @custom:oz-renamed-from b\n uint8 d;\n}\n"
200
- },
201
- "contracts/test/ValidationsNatspec.sol": {
202
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\n/// @custom:oz-upgrades-unsafe-allow constructor\ncontract HasNonEmptyConstructorNatspec1 {\n constructor() { msg.sender; }\n}\n\ncontract HasNonEmptyConstructorNatspec2 {\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() { msg.sender; }\n}\n\n/**\n * @custom:oz-upgrades-unsafe-allow constructor\n */\ncontract HasNonEmptyConstructorNatspec3 {\n constructor() { msg.sender; }\n}\n\n/**\n * @dev This confused the parser.\n * @custom:oz-upgrades-unsafe-allow constructor\n */\ncontract HasNonEmptyConstructorNatspec4 {\n constructor() { msg.sender; }\n}\n\ncontract ParentHasNonEmptyConstructorNatspec1 is HasNonEmptyConstructorNatspec1 {}\ncontract ParentHasNonEmptyConstructorNatspec2 is HasNonEmptyConstructorNatspec2 {}\ncontract AncestorHasNonEmptyConstructorNatspec1 is ParentHasNonEmptyConstructorNatspec1 {}\ncontract AncestorHasNonEmptyConstructorNatspec2 is ParentHasNonEmptyConstructorNatspec2 {}\n\n/// @custom:oz-upgrades-unsafe-allow state-variable-assignment\ncontract HasStateVariableAssignmentNatspec1 {\n uint x = 1;\n}\n\ncontract HasStateVariableAssignmentNatspec2 {\n /// @custom:oz-upgrades-unsafe-allow state-variable-assignment\n uint x = 1;\n}\n\ncontract HasStateVariableAssignmentNatspec3 {\n /// @custom:oz-upgrades-unsafe-allow state-variable-assignment\n uint x = 1;\n uint y = 2;\n}\n\n/// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\ncontract HasImmutableStateVariableNatspec1 {\n uint immutable x = 1;\n}\n\ncontract HasImmutableStateVariableNatspec2 {\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n uint immutable x = 1;\n}\n\ncontract HasImmutableStateVariableNatspec3 {\n /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment\n uint immutable x = 1;\n uint immutable y = 2;\n}\n\n/// @custom:oz-upgrades-unsafe-allow selfdestruct\ncontract HasSelfDestructNatspec1 {\n function d() public {\n selfdestruct(payable(msg.sender));\n }\n}\n\ncontract HasSelfDestructNatspec2 {\n /// @custom:oz-upgrades-unsafe-allow selfdestruct\n function d() public {\n selfdestruct(payable(msg.sender));\n }\n}\n\ncontract HasSelfDestructNatspec3 {\n function d() public {\n /// @custom:oz-upgrades-unsafe-allow selfdestruct\n selfdestruct(payable(msg.sender));\n }\n}\n\n/// @custom:oz-upgrades-unsafe-allow delegatecall\ncontract HasDelegateCallNatspec1 {\n function d() public {\n (bool s, ) = msg.sender.delegatecall(\"\");\n s;\n }\n}\n\ncontract HasDelegateCallNatspec2 {\n /// @custom:oz-upgrades-unsafe-allow delegatecall\n function d() public {\n (bool s, ) = msg.sender.delegatecall(\"\");\n s;\n }\n}\n\ncontract HasDelegateCallNatspec3 {\n function d() public {\n /// @custom:oz-upgrades-unsafe-allow delegatecall\n (bool s, ) = msg.sender.delegatecall(\"\");\n s;\n }\n}\n\nimport './ValidationsNatspecImport.sol';\n\ncontract ImportedParentHasStateVariableAssignmentNatspec1 is ImportedHasStateVariableAssignmentNatspec1 {}\ncontract ImportedParentHasStateVariableAssignmentNatspec2 is ImportedHasStateVariableAssignmentNatspec2 {}\n\n// For each of 3 dimensions, libraries usage can be\n// 1. implicit or explicit (_use for_ directive or not)\n// 2. upgrade safe or unsafe\n// 3. internal or external (method's visibility)\n\n// libs\n\nlibrary SafeInternalLibraryNatspec {\n function add(uint x, uint y) internal pure returns (uint) {\n return x + y;\n }\n}\n\nlibrary SafeExternalLibraryNatspec {\n function add(uint x, uint y) public pure returns (uint) {\n return x + y;\n }\n}\n\nlibrary UnsafeInternalLibraryNatspec {\n function explode(uint x, uint y) internal {\n x + y;\n /// @custom:oz-upgrades-unsafe-allow selfdestruct\n selfdestruct(payable(msg.sender));\n }\n}\n\nlibrary UnsafeExternalLibraryNatspec {\n function explode(uint x, uint y) public {\n x + y;\n /// @custom:oz-upgrades-unsafe-allow selfdestruct\n selfdestruct(payable(msg.sender));\n }\n}\n\n// usage\n\ncontract UsesImplicitSafeInternalLibraryNatspec {\n using SafeInternalLibraryNatspec for uint;\n uint x;\n\n function foo(uint y) public view {\n x.add(y);\n }\n}\n\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\ncontract UsesImplicitSafeExternalLibraryNatspec {\n using SafeExternalLibraryNatspec for uint;\n uint x;\n\n function foo(uint y) public view {\n x.add(y);\n }\n}\n\ncontract UsesImplicitUnsafeInternalLibraryNatspec {\n using UnsafeInternalLibraryNatspec for uint;\n uint x;\n\n function foo(uint y) public {\n x.explode(y);\n }\n}\n\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\ncontract UsesImplicitUnsafeExternalLibraryNatspec {\n using UnsafeExternalLibraryNatspec for uint;\n uint x;\n\n function foo(uint y) public {\n x.explode(y);\n }\n}\n\ncontract UsesExplicitSafeInternalLibraryNatspec {\n uint x;\n\n function foo(uint y) public view {\n SafeInternalLibraryNatspec.add(x, y);\n }\n}\n\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\ncontract UsesExplicitSafeExternalLibraryNatspec {\n uint x;\n\n function foo(uint y) public view {\n SafeExternalLibraryNatspec.add(x, y);\n }\n}\n\ncontract UsesExplicitUnsafeInternalLibraryNatspec {\n uint x;\n\n function foo(uint y) public {\n UnsafeInternalLibraryNatspec.explode(x, y);\n }\n}\n\n/// @custom:oz-upgrades-unsafe-allow external-library-linking\ncontract UsesExplicitUnsafeExternalLibraryNatspec {\n uint x;\n\n function foo(uint y) public {\n UnsafeExternalLibraryNatspec.explode(x, y);\n }\n}\n"
203
- },
204
- "contracts/test/ValidationsNatspecImport.sol": {
205
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\n/// @custom:oz-upgrades-unsafe-allow state-variable-assignment\ncontract ImportedHasStateVariableAssignmentNatspec1 {\n uint x = 1;\n}\n\ncontract ImportedHasStateVariableAssignmentNatspec2 {\n /// @custom:oz-upgrades-unsafe-allow state-variable-assignment\n uint x = 1;\n}\n"
206
- },
207
- "contracts/test/ValidationsUDVT.sol": {
208
- "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\ncontract ValidationsUDVT {\n type MyUserValueType is uint128;\n MyUserValueType my_user_value;\n function foo(MyUserValueType v) external {\n my_user_value = v;\n }\n}\n"
209
41
  }
210
42
  },
211
43
  "settings": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openzeppelin/upgrades-core",
3
- "version": "1.24.0",
3
+ "version": "1.24.1",
4
4
  "description": "",
5
5
  "repository": "https://github.com/OpenZeppelin/openzeppelin-upgrades/tree/master/packages/core",
6
6
  "license": "MIT",
@@ -58,5 +58,5 @@
58
58
  "proper-lockfile": "^4.1.1",
59
59
  "solidity-ast": "^0.4.15"
60
60
  },
61
- "gitHead": "6eb62c8d90ea332bf21e6b4e210928d3b9780e9a"
61
+ "gitHead": "c504c7b5db837985e5f2bc42576ae48f84be7bb4"
62
62
  }