@openzeppelin/upgrades-core 1.20.3 → 1.20.4

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/f31b0f42f0a725af669d059b0065b275.json"
3
+ "buildInfo": "../../../../../build-info/03119a98adef5d5c6ebb98792381864e.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/f31b0f42f0a725af669d059b0065b275.json"
3
+ "buildInfo": "../../../../../build-info/03119a98adef5d5c6ebb98792381864e.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../../../build-info/f31b0f42f0a725af669d059b0065b275.json"
3
+ "buildInfo": "../../../../../build-info/03119a98adef5d5c6ebb98792381864e.json"
4
4
  }
@@ -6,30 +6,30 @@
6
6
  "contracts/import.sol": {
7
7
  "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"
8
8
  },
9
- "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": {
10
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n"
9
+ "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": {
10
+ "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../Proxy.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n */\n constructor(address beacon, bytes memory data) payable {\n assert(_BEACON_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.beacon\")) - 1));\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n}\n"
11
11
  },
12
12
  "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol": {
13
13
  "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../../access/Ownable.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This contract is used in conjunction with one or more instances of {BeaconProxy} to determine their\n * implementation contract, which is where they will delegate all function calls.\n *\n * An owner is able to change the implementation the beacon points to, thus upgrading the proxies that use this beacon.\n */\ncontract UpgradeableBeacon is IBeacon, Ownable {\n address private _implementation;\n\n /**\n * @dev Emitted when the implementation returned by the beacon is changed.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Sets the address of the initial implementation, and the deployer account as the owner who can upgrade the\n * beacon.\n */\n constructor(address implementation_) {\n _setImplementation(implementation_);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function implementation() public view virtual override returns (address) {\n return _implementation;\n }\n\n /**\n * @dev Upgrades the beacon to a new implementation.\n *\n * Emits an {Upgraded} event.\n *\n * Requirements:\n *\n * - msg.sender must be the owner of the contract.\n * - `newImplementation` must be a contract.\n */\n function upgradeTo(address newImplementation) public virtual onlyOwner {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Sets the implementation contract address for this beacon\n *\n * Requirements:\n *\n * - `newImplementation` must be a contract.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"UpgradeableBeacon: implementation is not a contract\");\n _implementation = newImplementation;\n }\n}\n"
14
14
  },
15
- "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol": {
16
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./IBeacon.sol\";\nimport \"../Proxy.sol\";\nimport \"../ERC1967/ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}.\n *\n * The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't\n * conflict with the storage layout of the implementation behind the proxy.\n *\n * _Available since v3.4._\n */\ncontract BeaconProxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the proxy with `beacon`.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This\n * will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity\n * constructor.\n *\n * Requirements:\n *\n * - `beacon` must be a contract with the interface {IBeacon}.\n */\n constructor(address beacon, bytes memory data) payable {\n assert(_BEACON_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.beacon\")) - 1));\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n\n /**\n * @dev Returns the current beacon address.\n */\n function _beacon() internal view virtual returns (address) {\n return _getBeacon();\n }\n\n /**\n * @dev Returns the current implementation address of the associated beacon.\n */\n function _implementation() internal view virtual override returns (address) {\n return IBeacon(_getBeacon()).implementation();\n }\n\n /**\n * @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.\n *\n * If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.\n *\n * Requirements:\n *\n * - `beacon` must be a contract.\n * - The implementation returned by `beacon` must be a contract.\n */\n function _setBeacon(address beacon, bytes memory data) internal virtual {\n _upgradeBeaconToAndCall(beacon, data, false);\n }\n}\n"
15
+ "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": {
16
+ "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n"
17
17
  },
18
18
  "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": {
19
19
  "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializating the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n assert(_IMPLEMENTATION_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1));\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n"
20
20
  },
21
- "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": {
22
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(TransparentUpgradeableProxy proxy, address implementation, bytes memory data) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n"
21
+ "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": {
22
+ "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(address _logic, address admin_, bytes memory _data) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n"
23
23
  },
24
24
  "@openzeppelin/contracts/proxy/Proxy.sol": {
25
25
  "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internall call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n // solhint-disable-next-line no-inline-assembly\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 { revert(0, returndatasize()) }\n default { return(0, returndatasize()) }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overriden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internall call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback () external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive () external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overriden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {\n }\n}\n"
26
26
  },
27
- "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": {
28
- "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.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 ERC1967Upgrade {\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 StorageSlot.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(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.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 Address.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 Address.functionDelegateCall(newImplementation, data);\n }\n\n // Perform rollback test if not already in progress\n StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);\n if (!rollbackTesting.value) {\n // Trigger rollback using upgradeTo from the new implementation\n rollbackTesting.value = true;\n Address.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 Address.functionDelegateCall(IBeacon(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 StorageSlot.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 StorageSlot.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 StorageSlot.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 Address.isContract(newBeacon),\n \"ERC1967: new beacon is not a contract\"\n );\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n}\n"
29
- },
30
27
  "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": {
31
28
  "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 IBeacon {\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"
32
29
  },
30
+ "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": {
31
+ "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.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 ERC1967Upgrade {\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 StorageSlot.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(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.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 Address.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 Address.functionDelegateCall(newImplementation, data);\n }\n\n // Perform rollback test if not already in progress\n StorageSlot.BooleanSlot storage rollbackTesting = StorageSlot.getBooleanSlot(_ROLLBACK_SLOT);\n if (!rollbackTesting.value) {\n // Trigger rollback using upgradeTo from the new implementation\n rollbackTesting.value = true;\n Address.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 Address.functionDelegateCall(IBeacon(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 StorageSlot.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 StorageSlot.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 StorageSlot.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 Address.isContract(newBeacon),\n \"ERC1967: new beacon is not a contract\"\n );\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n}\n"
32
+ },
33
33
  "@openzeppelin/contracts/utils/Address.sol": {
34
34
  "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 Address {\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 /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\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, string memory errorMessage) internal returns (bytes memory) {\n require(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, 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"
35
35
  },
@@ -48,18 +48,18 @@
48
48
  "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol": {
49
49
  "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"
50
50
  },
51
- "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": {
52
- "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"
53
- },
54
51
  "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
55
52
  "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"
56
53
  },
57
- "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": {
58
- "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"
54
+ "@openzeppelin/contracts-upgradeable/proxy/ERC1967/ERC1967UpgradeUpgradeable.sol": {
55
+ "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"
59
56
  },
60
57
  "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
61
58
  "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"
62
59
  },
60
+ "@openzeppelin/contracts-upgradeable/proxy/beacon/IBeaconUpgradeable.sol": {
61
+ "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"
62
+ },
63
63
  "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol": {
64
64
  "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"
65
65
  },
@@ -20,7 +20,7 @@ test.before(async (t) => {
20
20
  t.context.validationData = (0, data_1.normalizeValidationData)([t.context.validationRun]);
21
21
  });
22
22
  test('getStorageLayoutForAddress - update layout', async (t) => {
23
- const { version } = t.context.validationRun['ManifestMigrateUnique'];
23
+ const { version } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateUnique'];
24
24
  (0, assert_1.default)(version !== undefined);
25
25
  const updatedLayout = (0, query_1.getStorageLayout)(t.context.validationData, version);
26
26
  const outdatedLayout = removeStorageLayoutMembers(updatedLayout);
@@ -50,7 +50,7 @@ test('getStorageLayoutForAddress - update layout', async (t) => {
50
50
  });
51
51
  });
52
52
  test('getUpdatedLayout - unique layout match', async (t) => {
53
- const { version } = t.context.validationRun['ManifestMigrateUnique'];
53
+ const { version } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateUnique'];
54
54
  (0, assert_1.default)(version !== undefined);
55
55
  const targetLayout = (0, query_1.getStorageLayout)(t.context.validationData, version);
56
56
  const outdatedLayout = removeStorageLayoutMembers(targetLayout);
@@ -58,8 +58,8 @@ test('getUpdatedLayout - unique layout match', async (t) => {
58
58
  t.deepEqual(updatedLayout, targetLayout);
59
59
  });
60
60
  test('getUpdatedLayout - multiple unambiguous layout matches', async (t) => {
61
- const { version: version1 } = t.context.validationRun['ManifestMigrateUnambiguous1'];
62
- const { version: version2 } = t.context.validationRun['ManifestMigrateUnambiguous2'];
61
+ const { version: version1 } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateUnambiguous1'];
62
+ const { version: version2 } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateUnambiguous2'];
63
63
  (0, assert_1.default)(version1 !== undefined && version2 !== undefined);
64
64
  t.is(version1.withoutMetadata, version2.withoutMetadata, 'version is meant to be ambiguous');
65
65
  t.not(version1.withMetadata, version2.withMetadata, 'version with metadata should be different');
@@ -69,8 +69,8 @@ test('getUpdatedLayout - multiple unambiguous layout matches', async (t) => {
69
69
  t.deepEqual(updatedLayout, targetLayout);
70
70
  });
71
71
  test('getUpdatedLayout - multiple ambiguous layout matches', async (t) => {
72
- const { version: version1 } = t.context.validationRun['ManifestMigrateAmbiguous1'];
73
- const { version: version2 } = t.context.validationRun['ManifestMigrateAmbiguous2'];
72
+ const { version: version1 } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateAmbiguous1'];
73
+ const { version: version2 } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateAmbiguous2'];
74
74
  (0, assert_1.default)(version1 !== undefined && version2 !== undefined);
75
75
  t.is(version1.withoutMetadata, version2.withoutMetadata, 'version is meant to be ambiguous');
76
76
  t.not(version1.withMetadata, version2.withMetadata, 'version with metadata should be different');
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-storage-layout.test.js","sourceRoot":"","sources":["../src/manifest-storage-layout.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAoC;AACpC,oDAA4B;AAE5B,qCAAoC;AAEpC,+CAAuD;AACvD,wCAA6D;AAC7D,4CAAoD;AACpD,0CAA0E;AAI1E,uEAAgG;AAOhG,MAAM,IAAI,GAAG,aAAwB,CAAC;AAEtC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;IACpB,MAAM,SAAS,GAAG,MAAM,mBAAS,CAAC,YAAY,CAAC,0DAA0D,CAAC,CAAC;IAC3G,IAAA,gBAAM,EAAC,SAAS,KAAK,SAAS,EAAE,sBAAsB,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,IAAA,oCAAsB,EAAC,SAAS,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,CAA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,GAAG,IAAA,iDAAuB,EAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,QAAQ,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC;IAClH,CAAC,CAAC,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC,CAAC;AAEH,SAAS,YAAY,CAAC,IAAkB;IAEtC,MAAM,QAAQ,GAAoD;QAChE,IAAI;QACJ,KAAK,CAAC,IAAI;YACR,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QACD,KAAK,CAAC,KAAK,CAAC,IAAkB;YAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACnB,CAAC;QACD,KAAK,CAAC,SAAS,CAAI,EAAoB;YACrC,OAAO,EAAE,EAAE,CAAC;QACd,CAAC;KACF,CAAC;IACF,OAAO,QAA6C,CAAC;AACvD,CAAC;AAED,+DAA+D;AAC/D,SAAS,0BAA0B,CAAC,MAAqB;IACvD,MAAM,GAAG,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;IACtD,KAAK,MAAM,EAAE,IAAI,GAAG,CAAC,KAAK,EAAE;QAC1B,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;KAC7D;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -21,6 +21,12 @@ test('reports unsafe operation', t => {
21
21
  t.false(report.ok);
22
22
  t.true(report.errors[0].kind === 'delegatecall');
23
23
  });
24
+ test('reports unsafe operation - fully qualified name', t => {
25
+ const impl = new standalone_1.UpgradeableContract('contracts/test/Standalone.sol:StandaloneV1', t.context.solcInput, t.context.solcOutput);
26
+ const report = impl.getErrorReport();
27
+ t.false(report.ok);
28
+ t.true(report.errors[0].kind === 'delegatecall');
29
+ });
24
30
  test('reports storage upgrade errors', t => {
25
31
  const v1 = new standalone_1.UpgradeableContract('StandaloneV1', t.context.solcInput, t.context.solcOutput);
26
32
  const v2Good = new standalone_1.UpgradeableContract('StandaloneV2Good', t.context.solcInput, t.context.solcOutput);
@@ -1 +1 @@
1
- {"version":3,"file":"standalone.test.js","sourceRoot":"","sources":["../src/standalone.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAoC;AACpC,qCAAoC;AAGpC,6CAAmD;AAOnD,MAAM,IAAI,GAAG,aAAwB,CAAC;AAEtC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;IACpB,MAAM,SAAS,GAAG,MAAM,mBAAS,CAAC,YAAY,CAAC,4CAA4C,CAAC,CAAC;IAC7F,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IACD,CAAC,CAAC,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC;IACtC,CAAC,CAAC,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,MAAM,CAAC;AAC1C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,0BAA0B,EAAE,CAAC,CAAC,EAAE;IACnC,MAAM,IAAI,GAAG,IAAI,gCAAmB,CAAC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAChG,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IACrC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,gCAAgC,EAAE,CAAC,CAAC,EAAE;IACzC,MAAM,EAAE,GAAG,IAAI,gCAAmB,CAAC,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,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAEpG,MAAM,EAAE,GAAG,IAAI,gCAAmB,CAAC,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACpG,MAAM,UAAU,GAAG,EAAE,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAEtB,MAAM,EAAE,GAAG,IAAI,gCAAmB,CAAC,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACpG,MAAM,WAAW,GAAG,EAAE,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC,CAAC,CAAC"}
@@ -2,7 +2,7 @@ import { ValidationRunData } from './run';
2
2
  declare type ValidationDataV1 = ValidationRunData;
3
3
  declare type ValidationDataV2 = ValidationRunData[];
4
4
  interface ValidationDataV3 {
5
- version: '3' | '3.1' | '3.2' | '3.3';
5
+ version: '3' | '3.1' | '3.2' | '3.3' | '3.4';
6
6
  log: ValidationRunData[];
7
7
  }
8
8
  export declare type ValidationDataCurrent = ValidationDataV3;
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/validate/data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,aAAK,gBAAgB,GAAG,iBAAiB,CAAC;AAE1C,aAAK,gBAAgB,GAAG,iBAAiB,EAAE,CAAC;AAK5C,UAAU,gBAAgB;IACxB,OAAO,EAAE,GAAG,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACrC,GAAG,EAAE,iBAAiB,EAAE,CAAC;CAC1B;AAED,oBAAY,qBAAqB,GAAG,gBAAgB,CAAC;AAErD,oBAAY,cAAc,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEpF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,qBAAqB,CAQnF;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,UAAO,GAAG,IAAI,IAAI,qBAAqB,CAczG;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,iBAAiB,EAC7B,YAAY,CAAC,EAAE,qBAAqB,GACnC,qBAAqB,CAKvB"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/validate/data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE1C,aAAK,gBAAgB,GAAG,iBAAiB,CAAC;AAE1C,aAAK,gBAAgB,GAAG,iBAAiB,EAAE,CAAC;AAK5C,UAAU,gBAAgB;IACxB,OAAO,EAAE,GAAG,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IAC7C,GAAG,EAAE,iBAAiB,EAAE,CAAC;CAC1B;AAED,oBAAY,qBAAqB,GAAG,gBAAgB,CAAC;AAErD,oBAAY,cAAc,GAAG,gBAAgB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEpF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,qBAAqB,CAQnF;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,UAAO,GAAG,IAAI,IAAI,qBAAqB,CAczG;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,iBAAiB,EAC7B,YAAY,CAAC,EAAE,qBAAqB,GACnC,qBAAqB,CAKvB"}
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.concatRunData = exports.isCurrentValidationData = exports.normalizeValidationData = void 0;
27
27
  const versions = __importStar(require("compare-versions"));
28
28
  const currentMajor = '3';
29
- const currentVersion = '3.3';
29
+ const currentVersion = '3.4';
30
30
  function normalizeValidationData(data) {
31
31
  if (isCurrentValidationData(data, false)) {
32
32
  return data;
@@ -5,10 +5,25 @@ import { ValidationOptions } from './overrides';
5
5
  import { ValidationData } from './data';
6
6
  import { ProxyDeployment } from '../manifest';
7
7
  export declare function assertUpgradeSafe(data: ValidationData, version: Version, opts: ValidationOptions): void;
8
+ /**
9
+ * Gets the contract version object from the given validation run data and contract name (either fully qualified or simple contract name).
10
+ *
11
+ * @param runData The validation run data
12
+ * @param contractName Fully qualified or simple contract name
13
+ * @returns contract version object
14
+ * @throws {Error} if the given contract name is not found or is ambiguous
15
+ */
8
16
  export declare function getContractVersion(runData: ValidationRunData, contractName: string): Version;
17
+ /**
18
+ * Gets the fully qualified contract name and validation run data.
19
+ *
20
+ * @param data The validation data
21
+ * @param version The contract Version
22
+ * @returns fully qualified contract name and validation run data
23
+ */
9
24
  export declare function getContractNameAndRunValidation(data: ValidationData, version: Version): [string, ValidationRunData];
10
25
  export declare function getStorageLayout(data: ValidationData, version: Version): StorageLayout;
11
- export declare function unfoldStorageLayout(runData: ValidationRunData, contractName: string): StorageLayout;
26
+ export declare function unfoldStorageLayout(runData: ValidationRunData, fullContractName: string): StorageLayout;
12
27
  export declare function findVersionWithoutMetadataMatches(data: ValidationData, versionWithoutMetadata: string): Generator<[string, ValidationRunData]>;
13
28
  export declare function getUnlinkedBytecode(data: ValidationData, bytecode: string): string;
14
29
  export declare function getErrors(data: ValidationData, version: Version, opts?: ValidationOptions): ValidationError[];
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/validate/query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAc,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD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,CAmBjH;AAoBD,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAG7E;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC,MAAM,CAAC,CAS9F"}
@@ -9,46 +9,73 @@ const data_1 = require("./data");
9
9
  const upgradeToSignature = 'upgradeTo(address)';
10
10
  function assertUpgradeSafe(data, version, opts) {
11
11
  const dataV3 = (0, data_1.normalizeValidationData)(data);
12
- const [contractName] = getContractNameAndRunValidation(dataV3, version);
12
+ const [fullContractName] = getContractNameAndRunValidation(dataV3, version);
13
13
  const errors = getErrors(dataV3, version, opts);
14
14
  if (errors.length > 0) {
15
- throw new error_1.ValidationErrors(contractName, errors);
15
+ throw new error_1.ValidationErrors(fullContractName, errors);
16
16
  }
17
17
  }
18
18
  exports.assertUpgradeSafe = assertUpgradeSafe;
19
+ /**
20
+ * Gets the contract version object from the given validation run data and contract name (either fully qualified or simple contract name).
21
+ *
22
+ * @param runData The validation run data
23
+ * @param contractName Fully qualified or simple contract name
24
+ * @returns contract version object
25
+ * @throws {Error} if the given contract name is not found or is ambiguous
26
+ */
19
27
  function getContractVersion(runData, contractName) {
20
- const { version } = runData[contractName];
28
+ let version = undefined;
29
+ if (contractName.includes(':')) {
30
+ version = runData[contractName].version;
31
+ }
32
+ else {
33
+ const foundNames = Object.keys(runData).filter(element => element.endsWith(`:${contractName}`));
34
+ if (foundNames.length > 1) {
35
+ throw new Error(`Contract ${contractName} is ambiguous. Use one of the following:\n${foundNames.join('\n')}`);
36
+ }
37
+ else if (foundNames.length === 1) {
38
+ version = runData[foundNames[0]].version;
39
+ }
40
+ }
21
41
  if (version === undefined) {
22
42
  throw new Error(`Contract ${contractName} is abstract`);
23
43
  }
24
44
  return version;
25
45
  }
26
46
  exports.getContractVersion = getContractVersion;
47
+ /**
48
+ * Gets the fully qualified contract name and validation run data.
49
+ *
50
+ * @param data The validation data
51
+ * @param version The contract Version
52
+ * @returns fully qualified contract name and validation run data
53
+ */
27
54
  function getContractNameAndRunValidation(data, version) {
28
55
  const dataV3 = (0, data_1.normalizeValidationData)(data);
29
56
  let runValidation;
30
- let contractName;
57
+ let fullContractName;
31
58
  for (const validation of dataV3.log) {
32
- contractName = Object.keys(validation).find(name => validation[name].version?.withMetadata === version.withMetadata);
33
- if (contractName !== undefined) {
59
+ fullContractName = Object.keys(validation).find(name => validation[name].version?.withMetadata === version.withMetadata);
60
+ if (fullContractName !== undefined) {
34
61
  runValidation = validation;
35
62
  break;
36
63
  }
37
64
  }
38
- if (contractName === undefined || runValidation === undefined) {
65
+ if (fullContractName === undefined || runValidation === undefined) {
39
66
  throw new Error('The requested contract was not found. Make sure the source code is available for compilation');
40
67
  }
41
- return [contractName, runValidation];
68
+ return [fullContractName, runValidation];
42
69
  }
43
70
  exports.getContractNameAndRunValidation = getContractNameAndRunValidation;
44
71
  function getStorageLayout(data, version) {
45
72
  const dataV3 = (0, data_1.normalizeValidationData)(data);
46
- const [contractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
47
- return unfoldStorageLayout(runValidation, contractName);
73
+ const [fullContractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
74
+ return unfoldStorageLayout(runValidation, fullContractName);
48
75
  }
49
76
  exports.getStorageLayout = getStorageLayout;
50
- function unfoldStorageLayout(runData, contractName) {
51
- const c = runData[contractName];
77
+ function unfoldStorageLayout(runData, fullContractName) {
78
+ const c = runData[fullContractName];
52
79
  const { solcVersion } = c;
53
80
  if (c.layout.flat) {
54
81
  return {
@@ -59,7 +86,7 @@ function unfoldStorageLayout(runData, contractName) {
59
86
  }
60
87
  else {
61
88
  const layout = { solcVersion, storage: [], types: {} };
62
- for (const name of [contractName].concat(c.inherit)) {
89
+ for (const name of [fullContractName].concat(c.inherit)) {
63
90
  layout.storage.unshift(...runData[name].layout.storage);
64
91
  Object.assign(layout.types, runData[name].layout.types);
65
92
  }
@@ -96,21 +123,21 @@ function getUnlinkedBytecode(data, bytecode) {
96
123
  exports.getUnlinkedBytecode = getUnlinkedBytecode;
97
124
  function getErrors(data, version, opts = {}) {
98
125
  const dataV3 = (0, data_1.normalizeValidationData)(data);
99
- const [contractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
100
- const c = runValidation[contractName];
101
- const errors = getUsedContractsAndLibraries(contractName, runValidation).flatMap(name => runValidation[name].errors);
102
- const selfAndInheritedMethods = getAllMethods(runValidation, contractName);
126
+ const [fullContractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
127
+ const c = runValidation[fullContractName];
128
+ const errors = getUsedContractsAndLibraries(fullContractName, runValidation).flatMap(name => runValidation[name].errors);
129
+ const selfAndInheritedMethods = getAllMethods(runValidation, fullContractName);
103
130
  if (!selfAndInheritedMethods.includes(upgradeToSignature)) {
104
131
  errors.push({
105
132
  src: c.src,
106
133
  kind: 'missing-public-upgradeto',
107
134
  });
108
135
  }
109
- return (0, overrides_1.processExceptions)(contractName, errors, opts);
136
+ return (0, overrides_1.processExceptions)(fullContractName, errors, opts);
110
137
  }
111
138
  exports.getErrors = getErrors;
112
- function getAllMethods(runValidation, contractName) {
113
- const c = runValidation[contractName];
139
+ function getAllMethods(runValidation, fullContractName) {
140
+ const c = runValidation[fullContractName];
114
141
  return c.methods.concat(...c.inherit.map(name => runValidation[name].methods));
115
142
  }
116
143
  function getUsedContractsAndLibraries(contractName, runValidation) {
@@ -132,8 +159,8 @@ function isUpgradeSafe(data, version) {
132
159
  exports.isUpgradeSafe = isUpgradeSafe;
133
160
  function inferProxyKind(data, version) {
134
161
  const dataV3 = (0, data_1.normalizeValidationData)(data);
135
- const [contractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
136
- const methods = getAllMethods(runValidation, contractName);
162
+ const [fullContractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
163
+ const methods = getAllMethods(runValidation, fullContractName);
137
164
  if (methods.includes(upgradeToSignature)) {
138
165
  return 'uups';
139
166
  }
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CAAC;IAChC,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,QAAA,MAAM,UAAU,mNAUN,CAAC;AAEX,oBAAY,eAAe,GACvB,0BAA0B,GAC1B,qBAAqB,GACrB,uBAAuB,GACvB,6BAA6B,CAAC;AAElC,UAAU,mBAAmB;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;CACjC;AAED,UAAU,uBAAwB,SAAQ,mBAAmB;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EACA,2BAA2B,GAC3B,0BAA0B,GAC1B,0BAA0B,GAC1B,mBAAmB,GACnB,iBAAiB,CAAC;CACvB;AAED,UAAU,0BAA2B,SAAQ,mBAAmB;IAC9D,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,qBAAsB,SAAQ,mBAAmB;IACzD,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC;CACvC;AAED,UAAU,6BAA8B,SAAQ,mBAAmB;IACjE,IAAI,EAAE,0BAA0B,CAAC;CAClC;AAgDD,wBAAgB,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,iBAAiB,CA0E/G"}
@@ -54,6 +54,9 @@ function getAllowed(node) {
54
54
  function skipCheck(error, node) {
55
55
  return getAllowed(node).includes(error);
56
56
  }
57
+ function getFullyQualifiedName(source, contractName) {
58
+ return `${source}:${contractName}`;
59
+ }
57
60
  function validate(solcOutput, decodeSrc, solcVersion) {
58
61
  const validation = {};
59
62
  const fromId = {};
@@ -65,7 +68,7 @@ function validate(solcOutput, decodeSrc, solcVersion) {
65
68
  const bytecode = solcOutput.contracts[source][contractName].evm.bytecode;
66
69
  const version = bytecode.object === '' ? undefined : (0, version_1.getVersion)(bytecode.object);
67
70
  const linkReferences = (0, link_refs_1.extractLinkReferences)(bytecode);
68
- validation[contractName] = {
71
+ validation[getFullyQualifiedName(source, contractName)] = {
69
72
  src: contractName,
70
73
  version,
71
74
  inherit: [],
@@ -81,14 +84,15 @@ function validate(solcOutput, decodeSrc, solcVersion) {
81
84
  };
82
85
  }
83
86
  for (const contractDef of (0, utils_1.findAll)('ContractDefinition', solcOutput.sources[source].ast)) {
84
- fromId[contractDef.id] = contractDef.name;
87
+ const key = getFullyQualifiedName(source, contractDef.name);
88
+ fromId[contractDef.id] = key;
85
89
  // May be undefined in case of duplicate contract names in Truffle
86
90
  const bytecode = solcOutput.contracts[source][contractDef.name]?.evm.bytecode;
87
- if (contractDef.name in validation && bytecode !== undefined) {
88
- inheritIds[contractDef.name] = contractDef.linearizedBaseContracts.slice(1);
89
- libraryIds[contractDef.name] = getReferencedLibraryIds(contractDef);
90
- validation[contractDef.name].src = decodeSrc(contractDef);
91
- validation[contractDef.name].errors = [
91
+ if (key in validation && bytecode !== undefined) {
92
+ inheritIds[key] = contractDef.linearizedBaseContracts.slice(1);
93
+ libraryIds[key] = getReferencedLibraryIds(contractDef);
94
+ validation[key].src = decodeSrc(contractDef);
95
+ validation[key].errors = [
92
96
  ...getConstructorErrors(contractDef, decodeSrc),
93
97
  ...getOpcodeErrors(contractDef, decodeSrc),
94
98
  ...getStateVariableErrors(contractDef, decodeSrc),
@@ -96,18 +100,18 @@ function validate(solcOutput, decodeSrc, solcVersion) {
96
100
  // https://github.com/OpenZeppelin/openzeppelin-upgrades/issues/52
97
101
  ...getLinkingErrors(contractDef, bytecode),
98
102
  ];
99
- validation[contractDef.name].layout = (0, extract_1.extractStorageLayout)(contractDef, decodeSrc, deref, solcOutput.contracts[source][contractDef.name].storageLayout);
100
- validation[contractDef.name].methods = [...(0, utils_1.findAll)('FunctionDefinition', contractDef)]
103
+ validation[key].layout = (0, extract_1.extractStorageLayout)(contractDef, decodeSrc, deref, solcOutput.contracts[source][contractDef.name].storageLayout);
104
+ validation[key].methods = [...(0, utils_1.findAll)('FunctionDefinition', contractDef)]
101
105
  .filter(fnDef => ['external', 'public'].includes(fnDef.visibility))
102
106
  .map(fnDef => (0, function_1.getFunctionSignature)(fnDef, deref));
103
107
  }
104
108
  }
105
109
  }
106
- for (const contractName in inheritIds) {
107
- validation[contractName].inherit = inheritIds[contractName].map(id => fromId[id]);
110
+ for (const key in inheritIds) {
111
+ validation[key].inherit = inheritIds[key].map(id => fromId[id]);
108
112
  }
109
- for (const contractName in libraryIds) {
110
- validation[contractName].libraries = libraryIds[contractName].map(id => fromId[id]);
113
+ for (const key in libraryIds) {
114
+ validation[key].libraries = libraryIds[key].map(id => fromId[id]);
111
115
  }
112
116
  return validation;
113
117
  }
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/validate/run.ts"],"names":[],"mappings":";;;AACA,8CAAyD;AAKzD,0DAAsD;AACtD,oDAAgD;AAChD,gDAAyD;AACzD,wCAAiD;AACjD,4CAAoE;AACpE,gDAA0D;AAiB1D,MAAM,UAAU,GAAG;IACjB,2BAA2B;IAC3B,0BAA0B;IAC1B,0BAA0B;IAC1B,mBAAmB;IACnB,iBAAiB;IACjB,aAAa;IACb,cAAc;IACd,cAAc;IACd,0BAA0B;CAClB,CAAC;AAoCX,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAU,EAAE,IAAY;IACxC,EAAE,GAAG,IAAI,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,OAAO,IAAI,EAAE;QACX,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5B,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5B,MAAM,KAAK,CAAC;SACb;aAAM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c,CAAC,EAAE;QAChD,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE;YACzD,IAAI,CAAC,SAAS,CAAC,0BAA0B,EAAE,WAAW,CAAC,EAAE;gBACvD,MAAM;oBACJ,IAAI,EAAE,0BAA0B;oBAChC,IAAI,EAAE,OAAO;oBACb,GAAG,EAAE,MAAM;iBACZ,CAAC;aACH;SACF;KACF;AACH,CAAC"}
@@ -115,4 +115,12 @@ testValid('UsesExplicitSafeExternalLibraryNatspec', 'transparent', true);
115
115
  testValid('UsesExplicitUnsafeInternalLibraryNatspec', 'transparent', true);
116
116
  testValid('UsesExplicitUnsafeExternalLibraryNatspec', 'transparent', true);
117
117
  testValid('TransitiveLibraryIsUnsafe', 'transparent', false);
118
+ testValid('contracts/test/ValidationsSameNameSafe.sol:SameName', 'transparent', true);
119
+ testValid('contracts/test/ValidationsSameNameUnsafe.sol:SameName', 'transparent', false);
120
+ test('ambiguous name', t => {
121
+ const error = t.throws(() => (0, validate_1.getContractVersion)(t.context.validation, 'SameName'));
122
+ t.is(error?.message, 'Contract SameName is ambiguous. Use one of the following:\n' +
123
+ 'contracts/test/ValidationsSameNameSafe.sol:SameName\n' +
124
+ 'contracts/test/ValidationsSameNameUnsafe.sol:SameName');
125
+ });
118
126
  //# sourceMappingURL=validate.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.test.js","sourceRoot":"","sources":["../src/validate.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAoC;AACpC,qCAAoC;AAEpC,yCAOoB;AACpB,+CAAuD;AAMvD,MAAM,IAAI,GAAG,aAAwB,CAAC;AAEtC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAC,CAAC,EAAC,EAAE;IACpB,MAAM,SAAS,GAAG;QAChB,oDAAoD;QACpD,sEAAsE;QACtE,+CAA+C;QAC/C,oDAAoD;KACrD,CAAC;IAEF,CAAC,CAAC,OAAO,CAAC,UAAU,G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": "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": "63cfc79d737e0ca25ddc789bf26ff81193faf534"
61
+ "gitHead": "7f39ba7df93a3d5d9e7ecfe905cd09eb1af82b3f"
62
62
  }
@@ -28,7 +28,7 @@ test.before(async t => {
28
28
  });
29
29
 
30
30
  test('getStorageLayoutForAddress - update layout', async t => {
31
- const { version } = t.context.validationRun['ManifestMigrateUnique'];
31
+ const { version } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateUnique'];
32
32
  assert(version !== undefined);
33
33
  const updatedLayout = getStorageLayout(t.context.validationData, version);
34
34
  const outdatedLayout = removeStorageLayoutMembers(updatedLayout);
@@ -60,7 +60,7 @@ test('getStorageLayoutForAddress - update layout', async t => {
60
60
  });
61
61
 
62
62
  test('getUpdatedLayout - unique layout match', async t => {
63
- const { version } = t.context.validationRun['ManifestMigrateUnique'];
63
+ const { version } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateUnique'];
64
64
  assert(version !== undefined);
65
65
  const targetLayout = getStorageLayout(t.context.validationData, version);
66
66
  const outdatedLayout = removeStorageLayoutMembers(targetLayout);
@@ -69,8 +69,10 @@ test('getUpdatedLayout - unique layout match', async t => {
69
69
  });
70
70
 
71
71
  test('getUpdatedLayout - multiple unambiguous layout matches', async t => {
72
- const { version: version1 } = t.context.validationRun['ManifestMigrateUnambiguous1'];
73
- const { version: version2 } = t.context.validationRun['ManifestMigrateUnambiguous2'];
72
+ const { version: version1 } =
73
+ t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateUnambiguous1'];
74
+ const { version: version2 } =
75
+ t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateUnambiguous2'];
74
76
  assert(version1 !== undefined && version2 !== undefined);
75
77
  t.is(version1.withoutMetadata, version2.withoutMetadata, 'version is meant to be ambiguous');
76
78
  t.not(version1.withMetadata, version2.withMetadata, 'version with metadata should be different');
@@ -81,8 +83,8 @@ test('getUpdatedLayout - multiple unambiguous layout matches', async t => {
81
83
  });
82
84
 
83
85
  test('getUpdatedLayout - multiple ambiguous layout matches', async t => {
84
- const { version: version1 } = t.context.validationRun['ManifestMigrateAmbiguous1'];
85
- const { version: version2 } = t.context.validationRun['ManifestMigrateAmbiguous2'];
86
+ const { version: version1 } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateAmbiguous1'];
87
+ const { version: version2 } = t.context.validationRun['contracts/test/ManifestMigrate.sol:ManifestMigrateAmbiguous2'];
86
88
  assert(version1 !== undefined && version2 !== undefined);
87
89
  t.is(version1.withoutMetadata, version2.withoutMetadata, 'version is meant to be ambiguous');
88
90
  t.not(version1.withMetadata, version2.withMetadata, 'version with metadata should be different');
@@ -27,6 +27,17 @@ test('reports unsafe operation', t => {
27
27
  t.true(report.errors[0].kind === 'delegatecall');
28
28
  });
29
29
 
30
+ test('reports unsafe operation - fully qualified name', t => {
31
+ const impl = new UpgradeableContract(
32
+ 'contracts/test/Standalone.sol:StandaloneV1',
33
+ t.context.solcInput,
34
+ t.context.solcOutput,
35
+ );
36
+ const report = impl.getErrorReport();
37
+ t.false(report.ok);
38
+ t.true(report.errors[0].kind === 'delegatecall');
39
+ });
40
+
30
41
  test('reports storage upgrade errors', t => {
31
42
  const v1 = new UpgradeableContract('StandaloneV1', t.context.solcInput, t.context.solcOutput);
32
43
 
@@ -7,10 +7,10 @@ type ValidationDataV1 = ValidationRunData;
7
7
  type ValidationDataV2 = ValidationRunData[];
8
8
 
9
9
  const currentMajor = '3';
10
- const currentVersion = '3.3';
10
+ const currentVersion = '3.4';
11
11
 
12
12
  interface ValidationDataV3 {
13
- version: '3' | '3.1' | '3.2' | '3.3';
13
+ version: '3' | '3.1' | '3.2' | '3.3' | '3.4';
14
14
  log: ValidationRunData[];
15
15
  }
16
16
 
@@ -11,54 +11,81 @@ const upgradeToSignature = 'upgradeTo(address)';
11
11
 
12
12
  export function assertUpgradeSafe(data: ValidationData, version: Version, opts: ValidationOptions): void {
13
13
  const dataV3 = normalizeValidationData(data);
14
- const [contractName] = getContractNameAndRunValidation(dataV3, version);
14
+ const [fullContractName] = getContractNameAndRunValidation(dataV3, version);
15
15
 
16
16
  const errors = getErrors(dataV3, version, opts);
17
17
 
18
18
  if (errors.length > 0) {
19
- throw new ValidationErrors(contractName, errors);
19
+ throw new ValidationErrors(fullContractName, errors);
20
20
  }
21
21
  }
22
22
 
23
+ /**
24
+ * Gets the contract version object from the given validation run data and contract name (either fully qualified or simple contract name).
25
+ *
26
+ * @param runData The validation run data
27
+ * @param contractName Fully qualified or simple contract name
28
+ * @returns contract version object
29
+ * @throws {Error} if the given contract name is not found or is ambiguous
30
+ */
23
31
  export function getContractVersion(runData: ValidationRunData, contractName: string): Version {
24
- const { version } = runData[contractName];
32
+ let version = undefined;
33
+ if (contractName.includes(':')) {
34
+ version = runData[contractName].version;
35
+ } else {
36
+ const foundNames = Object.keys(runData).filter(element => element.endsWith(`:${contractName}`));
37
+ if (foundNames.length > 1) {
38
+ throw new Error(`Contract ${contractName} is ambiguous. Use one of the following:\n${foundNames.join('\n')}`);
39
+ } else if (foundNames.length === 1) {
40
+ version = runData[foundNames[0]].version;
41
+ }
42
+ }
43
+
25
44
  if (version === undefined) {
26
45
  throw new Error(`Contract ${contractName} is abstract`);
27
46
  }
47
+
28
48
  return version;
29
49
  }
30
50
 
51
+ /**
52
+ * Gets the fully qualified contract name and validation run data.
53
+ *
54
+ * @param data The validation data
55
+ * @param version The contract Version
56
+ * @returns fully qualified contract name and validation run data
57
+ */
31
58
  export function getContractNameAndRunValidation(data: ValidationData, version: Version): [string, ValidationRunData] {
32
59
  const dataV3 = normalizeValidationData(data);
33
60
 
34
61
  let runValidation;
35
- let contractName;
62
+ let fullContractName;
36
63
 
37
64
  for (const validation of dataV3.log) {
38
- contractName = Object.keys(validation).find(
65
+ fullContractName = Object.keys(validation).find(
39
66
  name => validation[name].version?.withMetadata === version.withMetadata,
40
67
  );
41
- if (contractName !== undefined) {
68
+ if (fullContractName !== undefined) {
42
69
  runValidation = validation;
43
70
  break;
44
71
  }
45
72
  }
46
73
 
47
- if (contractName === undefined || runValidation === undefined) {
74
+ if (fullContractName === undefined || runValidation === undefined) {
48
75
  throw new Error('The requested contract was not found. Make sure the source code is available for compilation');
49
76
  }
50
77
 
51
- return [contractName, runValidation];
78
+ return [fullContractName, runValidation];
52
79
  }
53
80
 
54
81
  export function getStorageLayout(data: ValidationData, version: Version): StorageLayout {
55
82
  const dataV3 = normalizeValidationData(data);
56
- const [contractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
57
- return unfoldStorageLayout(runValidation, contractName);
83
+ const [fullContractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
84
+ return unfoldStorageLayout(runValidation, fullContractName);
58
85
  }
59
86
 
60
- export function unfoldStorageLayout(runData: ValidationRunData, contractName: string): StorageLayout {
61
- const c = runData[contractName];
87
+ export function unfoldStorageLayout(runData: ValidationRunData, fullContractName: string): StorageLayout {
88
+ const c = runData[fullContractName];
62
89
  const { solcVersion } = c;
63
90
  if (c.layout.flat) {
64
91
  return {
@@ -68,7 +95,7 @@ export function unfoldStorageLayout(runData: ValidationRunData, contractName: st
68
95
  };
69
96
  } else {
70
97
  const layout: StorageLayout = { solcVersion, storage: [], types: {} };
71
- for (const name of [contractName].concat(c.inherit)) {
98
+ for (const name of [fullContractName].concat(c.inherit)) {
72
99
  layout.storage.unshift(...runData[name].layout.storage);
73
100
  Object.assign(layout.types, runData[name].layout.types);
74
101
  }
@@ -113,12 +140,14 @@ export function getUnlinkedBytecode(data: ValidationData, bytecode: string): str
113
140
 
114
141
  export function getErrors(data: ValidationData, version: Version, opts: ValidationOptions = {}): ValidationError[] {
115
142
  const dataV3 = normalizeValidationData(data);
116
- const [contractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
117
- const c = runValidation[contractName];
143
+ const [fullContractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
144
+ const c = runValidation[fullContractName];
118
145
 
119
- const errors = getUsedContractsAndLibraries(contractName, runValidation).flatMap(name => runValidation[name].errors);
146
+ const errors = getUsedContractsAndLibraries(fullContractName, runValidation).flatMap(
147
+ name => runValidation[name].errors,
148
+ );
120
149
 
121
- const selfAndInheritedMethods = getAllMethods(runValidation, contractName);
150
+ const selfAndInheritedMethods = getAllMethods(runValidation, fullContractName);
122
151
 
123
152
  if (!selfAndInheritedMethods.includes(upgradeToSignature)) {
124
153
  errors.push({
@@ -127,11 +156,11 @@ export function getErrors(data: ValidationData, version: Version, opts: Validati
127
156
  });
128
157
  }
129
158
 
130
- return processExceptions(contractName, errors, opts);
159
+ return processExceptions(fullContractName, errors, opts);
131
160
  }
132
161
 
133
- function getAllMethods(runValidation: ValidationRunData, contractName: string): string[] {
134
- const c = runValidation[contractName];
162
+ function getAllMethods(runValidation: ValidationRunData, fullContractName: string): string[] {
163
+ const c = runValidation[fullContractName];
135
164
  return c.methods.concat(...c.inherit.map(name => runValidation[name].methods));
136
165
  }
137
166
 
@@ -155,8 +184,8 @@ export function isUpgradeSafe(data: ValidationData, version: Version): boolean {
155
184
 
156
185
  export function inferProxyKind(data: ValidationData, version: Version): ProxyDeployment['kind'] {
157
186
  const dataV3 = normalizeValidationData(data);
158
- const [contractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
159
- const methods = getAllMethods(runValidation, contractName);
187
+ const [fullContractName, runValidation] = getContractNameAndRunValidation(dataV3, version);
188
+ const methods = getAllMethods(runValidation, fullContractName);
160
189
  if (methods.includes(upgradeToSignature)) {
161
190
  return 'uups';
162
191
  } else {
@@ -114,6 +114,10 @@ function skipCheck(error: string, node: Node): boolean {
114
114
  return getAllowed(node).includes(error);
115
115
  }
116
116
 
117
+ function getFullyQualifiedName(source: string, contractName: string) {
118
+ return `${source}:${contractName}`;
119
+ }
120
+
117
121
  export function validate(solcOutput: SolcOutput, decodeSrc: SrcDecoder, solcVersion?: string): ValidationRunData {
118
122
  const validation: ValidationRunData = {};
119
123
  const fromId: Record<number, string> = {};
@@ -128,7 +132,7 @@ export function validate(solcOutput: SolcOutput, decodeSrc: SrcDecoder, solcVers
128
132
  const version = bytecode.object === '' ? undefined : getVersion(bytecode.object);
129
133
  const linkReferences = extractLinkReferences(bytecode);
130
134
 
131
- validation[contractName] = {
135
+ validation[getFullyQualifiedName(source, contractName)] = {
132
136
  src: contractName,
133
137
  version,
134
138
  inherit: [],
@@ -145,17 +149,19 @@ export function validate(solcOutput: SolcOutput, decodeSrc: SrcDecoder, solcVers
145
149
  }
146
150
 
147
151
  for (const contractDef of findAll('ContractDefinition', solcOutput.sources[source].ast)) {
148
- fromId[contractDef.id] = contractDef.name;
152
+ const key = getFullyQualifiedName(source, contractDef.name);
153
+
154
+ fromId[contractDef.id] = key;
149
155
 
150
156
  // May be undefined in case of duplicate contract names in Truffle
151
157
  const bytecode = solcOutput.contracts[source][contractDef.name]?.evm.bytecode;
152
158
 
153
- if (contractDef.name in validation && bytecode !== undefined) {
154
- inheritIds[contractDef.name] = contractDef.linearizedBaseContracts.slice(1);
155
- libraryIds[contractDef.name] = getReferencedLibraryIds(contractDef);
159
+ if (key in validation && bytecode !== undefined) {
160
+ inheritIds[key] = contractDef.linearizedBaseContracts.slice(1);
161
+ libraryIds[key] = getReferencedLibraryIds(contractDef);
156
162
 
157
- validation[contractDef.name].src = decodeSrc(contractDef);
158
- validation[contractDef.name].errors = [
163
+ validation[key].src = decodeSrc(contractDef);
164
+ validation[key].errors = [
159
165
  ...getConstructorErrors(contractDef, decodeSrc),
160
166
  ...getOpcodeErrors(contractDef, decodeSrc),
161
167
  ...getStateVariableErrors(contractDef, decodeSrc),
@@ -164,25 +170,25 @@ export function validate(solcOutput: SolcOutput, decodeSrc: SrcDecoder, solcVers
164
170
  ...getLinkingErrors(contractDef, bytecode),
165
171
  ];
166
172
 
167
- validation[contractDef.name].layout = extractStorageLayout(
173
+ validation[key].layout = extractStorageLayout(
168
174
  contractDef,
169
175
  decodeSrc,
170
176
  deref,
171
177
  solcOutput.contracts[source][contractDef.name].storageLayout,
172
178
  );
173
- validation[contractDef.name].methods = [...findAll('FunctionDefinition', contractDef)]
179
+ validation[key].methods = [...findAll('FunctionDefinition', contractDef)]
174
180
  .filter(fnDef => ['external', 'public'].includes(fnDef.visibility))
175
181
  .map(fnDef => getFunctionSignature(fnDef, deref));
176
182
  }
177
183
  }
178
184
  }
179
185
 
180
- for (const contractName in inheritIds) {
181
- validation[contractName].inherit = inheritIds[contractName].map(id => fromId[id]);
186
+ for (const key in inheritIds) {
187
+ validation[key].inherit = inheritIds[key].map(id => fromId[id]);
182
188
  }
183
189
 
184
- for (const contractName in libraryIds) {
185
- validation[contractName].libraries = libraryIds[contractName].map(id => fromId[id]);
190
+ for (const key in libraryIds) {
191
+ validation[key].libraries = libraryIds[key].map(id => fromId[id]);
186
192
  }
187
193
 
188
194
  return validation;
@@ -133,3 +133,16 @@ testValid('UsesExplicitSafeExternalLibraryNatspec', 'transparent', true);
133
133
  testValid('UsesExplicitUnsafeInternalLibraryNatspec', 'transparent', true);
134
134
  testValid('UsesExplicitUnsafeExternalLibraryNatspec', 'transparent', true);
135
135
  testValid('TransitiveLibraryIsUnsafe', 'transparent', false);
136
+
137
+ testValid('contracts/test/ValidationsSameNameSafe.sol:SameName', 'transparent', true);
138
+ testValid('contracts/test/ValidationsSameNameUnsafe.sol:SameName', 'transparent', false);
139
+
140
+ test('ambiguous name', t => {
141
+ const error = t.throws(() => getContractVersion(t.context.validation, 'SameName'));
142
+ t.is(
143
+ error?.message,
144
+ 'Contract SameName is ambiguous. Use one of the following:\n' +
145
+ 'contracts/test/ValidationsSameNameSafe.sol:SameName\n' +
146
+ 'contracts/test/ValidationsSameNameUnsafe.sol:SameName',
147
+ );
148
+ });