diff --git a/contracts/libraries/Utils.sol b/contracts/libraries/Utils.sol index 412b6d3..8e993a0 100644 --- a/contracts/libraries/Utils.sol +++ b/contracts/libraries/Utils.sol @@ -17,7 +17,7 @@ library Utils { bytes32 public constant OFFER_TYPE_HASH = keccak256( // solhint-disable-next-line max-line-length - "Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn)" + "Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn,uint256 checkOut)" ); bytes32 public constant CHECK_IN_TYPE_HASH = @@ -180,7 +180,8 @@ library Utils { _offer.paymentHash, _offer.cancelHash, _offer.transferable, - _offer.checkIn + _offer.checkIn, + _offer.checkOut ) ); } diff --git a/deploy/001.ts b/deploy/001.ts index d35dc53..a5b4998 100644 --- a/deploy/001.ts +++ b/deploy/001.ts @@ -9,7 +9,7 @@ import { protocolFee, retailerFee, minDeposit, -} from "../utils/constants"; +} from "../utils"; const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { network, deployments, getNamedAccounts } = hre; diff --git a/deploy/002.ts b/deploy/002.ts index bb57925..0aee7a8 100644 --- a/deploy/002.ts +++ b/deploy/002.ts @@ -6,15 +6,6 @@ import { DeployOptions, DeployResult, } from "hardhat-deploy/types"; -import { - kindsArr, - eip712name, - eip712version, - claimPeriod, - protocolFee, - retailerFee, - minDeposit, -} from "../utils/constants"; const setupToken = async ( proxySettings: { owner: string; proxyContract: string }, @@ -29,10 +20,10 @@ const setupToken = async ( contract: contractName, proxy: { ...proxySettings, - execute: { - methodName: "initialize", - args: [tokenName, tokenSymbol, owner], - }, + // execute: { + // methodName: "initialize", + // args: [tokenName, tokenSymbol, owner], + // }, }, from: owner, log: true, @@ -128,19 +119,19 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const protocolConfig = await deploy("Config", { proxy: { ...PROXY_SETTINGS_WITH_UPGRADE, - execute: { - methodName: "initialize", - args: [ - owner, - lif.address, - claimPeriod, - protocolFee, - retailerFee, - owner, - kindsArr, - kindsArr.map(() => minDeposit), // same limit for all - ], - }, + // execute: { + // methodName: "initialize", + // args: [ + // owner, + // lif.address, + // claimPeriod, + // protocolFee, + // retailerFee, + // owner, + // kindsArr, + // kindsArr.map(() => minDeposit), // same limit for all + // ], + // }, }, from: owner, log: true, @@ -158,10 +149,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const entities = await deploy("EntitiesRegistry", { proxy: { ...PROXY_SETTINGS_WITH_UPGRADE, - execute: { - methodName: "initialize", - args: [owner, protocolConfig.address], - }, + // execute: { + // methodName: "initialize", + // args: [owner, protocolConfig.address], + // }, }, from: owner, log: true, @@ -179,16 +170,16 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const market = await deploy("Market", { proxy: { ...PROXY_SETTINGS_WITH_UPGRADE, - execute: { - methodName: "initialize", - args: [ - owner, - eip712name, - eip712version, - protocolConfig.address, - entities.address, - ], - }, + // execute: { + // methodName: "initialize", + // args: [ + // owner, + // eip712name, + // eip712version, + // protocolConfig.address, + // entities.address, + // ], + // }, }, from: owner, log: true, diff --git a/deployments/polzktest/Market.json b/deployments/polzktest/Market.json index d7c50e5..99ac62f 100644 --- a/deployments/polzktest/Market.json +++ b/deployments/polzktest/Market.json @@ -1331,22 +1331,12 @@ "0xE794d70bE712b0C36bB4Ed5da82Bee64Eb07bFdF", "0x6cf1dbed00000000000000000000000012dc8e8de1c576284ab25842c2750c749c32630100000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000098b1d12cafe7315c77b6d308a62ce02806260ee0000000000000000000000004bb51528c83844b509e1152eeb05260ee1bf60e600000000000000000000000000000000000000000000000000000000000000064d61726b6574000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013100000000000000000000000000000000000000000000000000000000000000" ], - "numDeployments": 1, + "numDeployments": 2, "solcInputHash": "0e89febeebc7444140de8e67c9067d2c", "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":999999},\"remappings\":[]},\"sources\":{\"solc_0.8/openzeppelin/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x93b4e21c931252739a1ec13ea31d3d35a5c068be3163ccab83e4d70c40355f03\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/ERC1967/ERC1967Proxy.sol)\\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\",\"keccak256\":\"0x6309f9f39dc6f4f45a24f296543867aa358e32946cd6b2874627a996d606b3a0\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.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(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(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 _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\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 virtual 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(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(Address.isContract(IBeacon(newBeacon).implementation()), \\\"ERC1967: beacon implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\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(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) 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\",\"keccak256\":\"0x17668652127feebed0ce8d9431ef95ccc8c4292f03e3b8cf06c6ca16af396633\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (proxy/Proxy.sol)\\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 internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\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 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\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\",\"keccak256\":\"0xd5d1fd16e9faff7fcb3a52e02a8d49156f42a38a03f07b5f1810c21c2149a8ab\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\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\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/TransparentUpgradeableProxy.sol)\\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(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) 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\",\"keccak256\":\"0x140055a64cf579d622e04f5a198595832bf2cb193cd0005f4f2d4d61ca906253\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0-rc.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 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 (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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) 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 (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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal 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 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\",\"keccak256\":\"0x3777e696b62134e6177440dbe6e6601c0c156a443f57167194b67e75527439de\",\"license\":\"MIT\"},\"solc_0.8/openzeppelin/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xfe1b7a9aa2a530a9e705b220e26cd584e2fbdc9602a3a1066032b12816b46aca\",\"license\":\"MIT\"}},\"version\":1}", "bytecode": "0x6080604052604051620011b2380380620011b2833981016040819052620000269162000519565b82816200005560017f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbd620005f9565b6000805160206200116b833981519152146200007557620000756200061f565b6200008382826000620000e7565b50620000b3905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005f9565b6000805160206200114b83398151915214620000d357620000d36200061f565b620000de8262000124565b50505062000688565b620000f2836200017f565b600082511180620001005750805b156200011f576200011d8383620001c160201b620002ff1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6200014f620001f0565b604080516001600160a01b03928316815291841660208301520160405180910390a16200017c8162000229565b50565b6200018a81620002de565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060620001e983836040518060600160405280602781526020016200118b6027913962000381565b9392505050565b60006200021a6000805160206200114b83398151915260001b6200046760201b620002731760201c565b546001600160a01b0316919050565b6001600160a01b038116620002945760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002bd6000805160206200114b83398151915260001b6200046760201b620002731760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002f4816200046a60201b6200032b1760201c565b620003585760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016200028b565b80620002bd6000805160206200116b83398151915260001b6200046760201b620002731760201c565b60606001600160a01b0384163b620003eb5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b60648201526084016200028b565b600080856001600160a01b03168560405162000408919062000635565b600060405180830381855af49150503d806000811462000445576040519150601f19603f3d011682016040523d82523d6000602084013e6200044a565b606091505b5090925090506200045d82828662000479565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200048a575081620001e9565b8251156200049b5782518084602001fd5b8160405162461bcd60e51b81526004016200028b919062000653565b80516001600160a01b0381168114620004cf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101562000507578181015183820152602001620004ed565b838111156200011d5750506000910152565b6000806000606084860312156200052f57600080fd5b6200053a84620004b7565b92506200054a60208501620004b7565b60408501519092506001600160401b03808211156200056857600080fd5b818601915086601f8301126200057d57600080fd5b815181811115620005925762000592620004d4565b604051601f8201601f19908116603f01168101908382118183101715620005bd57620005bd620004d4565b81604052828152896020848701011115620005d757600080fd5b620005ea836020830160208801620004ea565b80955050505050509250925092565b6000828210156200061a57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052600160045260246000fd5b6000825162000649818460208701620004ea565b9190910192915050565b602081526000825180602084015262000674816040850160208701620004ea565b601f01601f19169190910160400192915050565b610ab380620006986000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461091f565b610135565b61006b6100a336600461093a565b610196565b3480156100b457600080fd5b506100bd610221565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461091f565b610276565b34801561011257600080fd5b506100bd6102ba565b610123610347565b61013361012e610435565b61043f565b565b61013d610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816040518060200160405280600081525060006104a3565b50565b61018b61011b565b61019e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610219576102148383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506104a3915050565b505050565b61021461011b565b600061022b610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610435565b905090565b61027361011b565b90565b61027e610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561018e5761018b816104ce565b60006102c4610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561026b57610266610463565b60606103248383604051806060016040528060278152602001610a576027913961052f565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b61034f610463565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b6000610266610657565b3660008037600080366000845af43d6000803e80801561045e573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b6104ac8361067f565b6000825111806104b95750805b15610214576104c883836102ff565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6104f7610463565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161018b816106cc565b606073ffffffffffffffffffffffffffffffffffffffff84163b6105d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e74726163740000000000000000000000000000000000000000000000000000606482015260840161042c565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105fd91906109e9565b600060405180830381855af49150503d8060008114610638576040519150601f19603f3d011682016040523d82523d6000602084013e61063d565b606091505b509150915061064d8282866107d8565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610487565b6106888161082b565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff811661076f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161042c565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b606083156107e7575081610324565b8251156107f75782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161042c9190610a05565b73ffffffffffffffffffffffffffffffffffffffff81163b6108cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e747261637400000000000000000000000000000000000000606482015260840161042c565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610792565b803573ffffffffffffffffffffffffffffffffffffffff8116811461091a57600080fd5b919050565b60006020828403121561093157600080fd5b610324826108f6565b60008060006040848603121561094f57600080fd5b610958846108f6565b9250602084013567ffffffffffffffff8082111561097557600080fd5b818601915086601f83011261098957600080fd5b81358181111561099857600080fd5b8760208285010111156109aa57600080fd5b6020830194508093505050509250925092565b60005b838110156109d85781810151838201526020016109c0565b838111156104c85750506000910152565b600082516109fb8184602087016109bd565b9190910192915050565b6020815260008251806020840152610a248160408501602087016109bd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220b29caa54336b3ee836679675e9732ec5e526fb3f803cca2fe336cc3555aba62264736f6c634300080a0033", - "execute": { - "methodName": "initialize", - "args": [ - "0x12DC8e8De1C576284ab25842C2750c749c326301", - "Market", - "1", - "0x098b1d12cAfE7315C77b6d308A62ce02806260Ee", - "0x4bB51528C83844b509E1152EEb05260eE1bf60e6" - ] - }, - "implementation": "0x9Fb6d3Fa4fd3e407CebDBA609Bca28209Da242d0", + "implementation": "0x5E11aeA0ECef4077AD02f2c08c186647f2d6EB4a", "devdoc": { "details": "This contract implements a proxy that is upgradeable by an admin. To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", "kind": "dev", @@ -1381,4 +1371,4 @@ "storage": [], "types": null } -} +} \ No newline at end of file diff --git a/deployments/polzktest/Market_Implementation.json b/deployments/polzktest/Market_Implementation.json index 8d6210d..390ddac 100644 --- a/deployments/polzktest/Market_Implementation.json +++ b/deployments/polzktest/Market_Implementation.json @@ -1,5 +1,5 @@ { - "address": "0x9Fb6d3Fa4fd3e407CebDBA609Bca28209Da242d0", + "address": "0x5E11aeA0ECef4077AD02f2c08c186647f2d6EB4a", "abi": [ { "inputs": [], @@ -1119,41 +1119,41 @@ "type": "function" } ], - "transactionHash": "0x2616f5d156f264f7a65ed2e5d7ad522bfff0d2f8c5c2e41c01f723b1ffcd4943", + "transactionHash": "0xf6deac060d23fa57d7fa5f4f1984832e7a0c8e3a2ccadf998d77999b8510c847", "receipt": { "to": null, "from": "0x12DC8e8De1C576284ab25842C2750c749c326301", - "contractAddress": "0x9Fb6d3Fa4fd3e407CebDBA609Bca28209Da242d0", + "contractAddress": "0x5E11aeA0ECef4077AD02f2c08c186647f2d6EB4a", "transactionIndex": 0, - "gasUsed": "5037141", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000001000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x79cf4ea2b8f383c8c288d2b5a0632b9737d0d130117f7fdff90e22d15db8ce0d", - "transactionHash": "0x2616f5d156f264f7a65ed2e5d7ad522bfff0d2f8c5c2e41c01f723b1ffcd4943", + "gasUsed": "5039949", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000200000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x84d0190230ec23999c7bc1d9b37da8c12cd466f66135338e68b0f0f431dc1b5c", + "transactionHash": "0xf6deac060d23fa57d7fa5f4f1984832e7a0c8e3a2ccadf998d77999b8510c847", "logs": [ { "transactionIndex": 0, - "blockNumber": 700087, - "transactionHash": "0x2616f5d156f264f7a65ed2e5d7ad522bfff0d2f8c5c2e41c01f723b1ffcd4943", - "address": "0x9Fb6d3Fa4fd3e407CebDBA609Bca28209Da242d0", + "blockNumber": 797476, + "transactionHash": "0xf6deac060d23fa57d7fa5f4f1984832e7a0c8e3a2ccadf998d77999b8510c847", + "address": "0x5E11aeA0ECef4077AD02f2c08c186647f2d6EB4a", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0x79cf4ea2b8f383c8c288d2b5a0632b9737d0d130117f7fdff90e22d15db8ce0d" + "blockHash": "0x84d0190230ec23999c7bc1d9b37da8c12cd466f66135338e68b0f0f431dc1b5c" } ], - "blockNumber": 700087, - "cumulativeGasUsed": "5037141", + "blockNumber": 797476, + "cumulativeGasUsed": "5039949", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "8d0b6126b03e4a7dfd9b020d5703a4a0", - "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"DealAlreadyCreated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DealExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DealFundsTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DealNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisabledRetailer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisabledSupplier\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidCancelOptions\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOfferSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPaymentId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPaymentOptions\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPercent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRetailer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotAllowedAuth\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotAllowedStatus\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotAllowedTime\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenTransferNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetEntities\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"enum Utils.DealStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"Status\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"penalty\",\"type\":\"uint256\"}],\"internalType\":\"struct Utils.CancelOption[]\",\"name\":\"_cancelOptions\",\"type\":\"tuple[]\"}],\"name\":\"cancel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"signs\",\"type\":\"bytes[]\"}],\"name\":\"checkIn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"}],\"name\":\"checkOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"config\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expire\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"supplierId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"requestHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"optionsHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"paymentHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"cancelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"checkIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"checkOut\",\"type\":\"uint256\"}],\"internalType\":\"struct Utils.Offer\",\"name\":\"offer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"}],\"internalType\":\"struct Utils.PaymentOption[]\",\"name\":\"paymentOptions\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes32\",\"name\":\"paymentId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"retailerId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"signs\",\"type\":\"bytes[]\"}],\"name\":\"deal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"created\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expire\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"supplierId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"requestHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"optionsHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"paymentHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"cancelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"checkIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"checkOut\",\"type\":\"uint256\"}],\"internalType\":\"struct Utils.Offer\",\"name\":\"offer\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"retailerId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"buyer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"enum Utils.DealStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"entities\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_version\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_config\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_entities\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"offerTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"reason\",\"type\":\"bytes32\"}],\"name\":\"reject\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"resolveTokenId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_config\",\"type\":\"address\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_entities\",\"type\":\"address\"}],\"name\":\"setEntities\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenOffers\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"custom:security-contact\":\"security@windingtree.com\",\"details\":\"This contract enables the creation and management of deals\",\"errors\":{\"DealAlreadyCreated()\":[{\"details\":\"Thrown when Deal was created in the `_beforeCreate` hook\"}],\"DealExists()\":[{\"details\":\"Thrown when a user attempts to create an already existing Deal\"}],\"DealFundsTransferFailed()\":[{\"details\":\"Thrown when a Deal funds transfer is failed\"}],\"DealNotFound()\":[{\"details\":\"Thrown when the Deal is not found\"}],\"DisabledRetailer()\":[{\"details\":\"Thrown when the retailer is not enabled\"}],\"DisabledSupplier()\":[{\"details\":\"Thrown when the supplier of the offer is not enabled\"}],\"InvalidCancelOptions()\":[{\"details\":\"Thrown when a user attempts to cancel the deal using invalid cancellation options\"}],\"InvalidOfferSignature()\":[{\"details\":\"Thrown when a user attempts to create a deal using an offer with an invalid signature\"}],\"InvalidPaymentId()\":[{\"details\":\"Thrown when a user attempts to create a deal providing an invalid payment option Id\"}],\"InvalidPaymentOptions()\":[{\"details\":\"Thrown when a user attempts to create a deal providing an invalid payment options\"}],\"InvalidPercent()\":[{\"details\":\"Thrown when percents value greater than 100\"}],\"InvalidRetailer()\":[{\"details\":\"Thrown when the retailer of the offer is not found\"}],\"NotAllowedAuth()\":[{\"details\":\"Thrown when a function call is not allowed for current user\"}],\"NotAllowedStatus()\":[{\"details\":\"Thrown when a user attempts to claim the deal in non-created status\"}],\"NotAllowedTime()\":[{\"details\":\"Thrown when a user attempts to do something that not allowed at a moment\"}]},\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when `owner` enables `approved` to manage the `tokenId` token.\"},\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"SetConfig(address,address)\":{\"details\":\"Emitted when updated an address of the protocol config contract\"},\"SetEntities(address,address)\":{\"details\":\"Emitted when updated an address of the Entities registry contract\"},\"Status(bytes32,uint8,address)\":{\"details\":\"Emitted when a Deal status is updated\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `tokenId` token is transferred from `from` to `to`.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\"},\"cancel(bytes32,(uint256,uint256)[])\":{\"details\":\"Cancels the deal\",\"params\":{\"_cancelOptions\":\"Cancellation options from offer Requirements: - the deal must exists - the deal must be in status DealStatus.Created or DealStatus.Claimed - must be called by buyer - if the deal in DealStatus.Claimed status: - if block.timestamp > checkIn time then zero refund - cancellation rules must follow the rules defined by offer\",\"offerId\":\"The deal offer Id\"}},\"checkIn(bytes32,bytes[])\":{\"details\":\"Checks in the deal\",\"params\":{\"offerId\":\"The deal offer Id\",\"signs\":\"Signatures Requirements: - the deal must exists - the deal must be in status DealStatus.Claimed - must be called by the supplier's signer or buyer's address - if called by the supplier's signer: - a valid signature of suppliers's signer must be provided in signs[0] - if before sign-in time: a valid signature of the buyer must be provided in signs[1] - if called buy buyer: - a valid signature of the buyer must be provided in signs[0] - a valid signature of suppliers's signer must be provided in signs[1]\"}},\"checkOut(bytes32)\":{\"details\":\"Checks out the deal and sends funds to the supplier\",\"params\":{\"offerId\":\"The deal offer Id Requirements: - the deal must exists - must be called by the supplier's signer only - the deal must be in status DealStatus.CheckIn - must be called after checkOut time only\"}},\"claim(bytes32)\":{\"details\":\"Claims the deal\",\"params\":{\"offerId\":\"The deal offer Id Requirements: - the deal must exists - the deal must be in status DealStatus.Created - must be called by the signer address of the deal offer supplier\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"deal((bytes32,uint256,bytes32,uint256,bytes32,bytes32,bytes32,bytes32,bool,uint256,uint256),(bytes32,uint256,address)[],bytes32,bytes32,bytes[])\":{\"details\":\"Creates a Deal on a base of an offer\",\"params\":{\"offer\":\"An offer payload\",\"paymentId\":\"Payment option Id\",\"paymentOptions\":\"Raw offered payment options array\",\"retailerId\":\"Retailer Id\",\"signs\":\"Signatures: [0] - offer: ECDSA/ERC1271; [1] - asset permit: ECDSA (optional) Requirements: - supplier of the offer must be registered - offer must be signed with a proper signer - the deal should not be created before - the deal should not be created inside the _before hook - payment options must be valid (equal to those from the offer) - payment Id must exists in payment options - the contract must be able to make transfer of funds NOTE: `permit` signature can be ECDSA of type only\"}},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"initialize(address,string,string,address,address)\":{\"details\":\"Initializes the Market contract with the given arguments\",\"params\":{\"_config\":\"The protocol config contract address\",\"_entities\":\"Entities registry contract address\",\"_name\":\"The name of the contract\",\"_owner\":\"The owner of the contract\",\"_version\":\"The version of the contract\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"details\":\"See {IERC721-ownerOf}.\"},\"pause()\":{\"details\":\"Pauses the contract\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"refund(bytes32)\":{\"details\":\"Refunds the deal\",\"params\":{\"offerId\":\"The deal offer Id Requirements: - the deal must exists - the deal must be in status DealStatus.CheckedIn - must be called by the signer address of the deal offer supplier\"}},\"reject(bytes32,bytes32)\":{\"details\":\"Rejects the deal\",\"params\":{\"offerId\":\"The deal offer Id\",\"reason\":\"Rejection reason Requirements: - the deal must exists - the deal must be in status DealStatus.Created - must be called by the signer address of the deal offer supplier\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"resolveTokenId(uint256)\":{\"details\":\"Returns offerId linked to the token\",\"params\":{\"tokenId\":\"The ID of the token\"},\"returns\":{\"offerId\":\"The ID of the offer linked to the token\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"setConfig(address)\":{\"details\":\"Sets the new address of the protocol config contract address\",\"params\":{\"_config\":\"The new protocol config contract address\"}},\"setEntities(address)\":{\"details\":\"Sets the new address of the entities registry\",\"params\":{\"_entities\":\"The new protocol config contract address\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenByIndex(uint256)\":{\"details\":\"See {IERC721Enumerable-tokenByIndex}.\"},\"tokenOfOwnerByIndex(address,uint256)\":{\"details\":\"See {IERC721Enumerable-tokenOfOwnerByIndex}.\"},\"tokenURI(uint256)\":{\"details\":\"Returns the token URI of the given token ID\",\"params\":{\"tokenId\":\"The ID of the token\"},\"returns\":{\"_0\":\"The token URI of the given token ID\"}},\"totalSupply()\":{\"details\":\"See {IERC721Enumerable-totalSupply}.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unpause()\":{\"details\":\"Unpauses the contract\"}},\"stateVariables\":{\"offerTokens\":{\"details\":\"Mapping of offer Id on token Id\"},\"tokenOffers\":{\"details\":\"Mapping of token Id on offer Id\"}},\"title\":\"Market\",\"version\":1},\"userdoc\":{\"errors\":{\"TokenTransferNotAllowed()\":[{\"notice\":\"Throws when NFT transfer is not allowed by offer rule\"}]},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Market.sol\":\"Market\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC1271Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271Upgradeable {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x4473c09c087ee1a48c5547b23799c0474b2e08cde6fec5921c628171c4ebcdc0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\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 proxied contracts do not make use of 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 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\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 *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 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 Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal onlyInitializing {\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal onlyInitializing {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x40c636b4572ff5f1dc50cf22097e93c0723ee14eff87e99ac2b02636eeca1250\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[44] private __gap;\\n}\\n\",\"keccak256\":\"0xac29c453f4cf43afe4c9599374b6e1ed493c18644d814554e8a5969aaa6f3486\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721ReceiverUpgradeable {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2c0b89cef83f353c6f9488c013d8a5968587ffdd6dfc26aad53774214b97e229\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721EnumerableUpgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\\n * enumerability of all the token ids in the contract as well as all token ids owned by each\\n * account.\\n */\\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\\n function __ERC721Enumerable_init() internal onlyInitializing {\\n }\\n\\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\\n }\\n // Mapping from owner to list of owned token IDs\\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\\n\\n // Mapping from token ID to index of the owner tokens list\\n mapping(uint256 => uint256) private _ownedTokensIndex;\\n\\n // Array with all token ids, used for enumeration\\n uint256[] private _allTokens;\\n\\n // Mapping from token id to position in the allTokens array\\n mapping(uint256 => uint256) private _allTokensIndex;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\\n */\\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\\n require(index < ERC721Upgradeable.balanceOf(owner), \\\"ERC721Enumerable: owner index out of bounds\\\");\\n return _ownedTokens[owner][index];\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _allTokens.length;\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-tokenByIndex}.\\n */\\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \\\"ERC721Enumerable: global index out of bounds\\\");\\n return _allTokens[index];\\n }\\n\\n /**\\n * @dev See {ERC721-_beforeTokenTransfer}.\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual override {\\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\\n\\n if (batchSize > 1) {\\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\\n revert(\\\"ERC721Enumerable: consecutive transfers not supported\\\");\\n }\\n\\n uint256 tokenId = firstTokenId;\\n\\n if (from == address(0)) {\\n _addTokenToAllTokensEnumeration(tokenId);\\n } else if (from != to) {\\n _removeTokenFromOwnerEnumeration(from, tokenId);\\n }\\n if (to == address(0)) {\\n _removeTokenFromAllTokensEnumeration(tokenId);\\n } else if (to != from) {\\n _addTokenToOwnerEnumeration(to, tokenId);\\n }\\n }\\n\\n /**\\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\\n * @param to address representing the new owner of the given token ID\\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\\n */\\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\\n uint256 length = ERC721Upgradeable.balanceOf(to);\\n _ownedTokens[to][length] = tokenId;\\n _ownedTokensIndex[tokenId] = length;\\n }\\n\\n /**\\n * @dev Private function to add a token to this extension's token tracking data structures.\\n * @param tokenId uint256 ID of the token to be added to the tokens list\\n */\\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\\n _allTokensIndex[tokenId] = _allTokens.length;\\n _allTokens.push(tokenId);\\n }\\n\\n /**\\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\\n * @param from address representing the previous owner of the given token ID\\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\\n */\\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary\\n if (tokenIndex != lastTokenIndex) {\\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\\n\\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n }\\n\\n // This also deletes the contents at the last position of the array\\n delete _ownedTokensIndex[tokenId];\\n delete _ownedTokens[from][lastTokenIndex];\\n }\\n\\n /**\\n * @dev Private function to remove a token from this extension's token tracking data structures.\\n * This has O(1) time complexity, but alters the order of the _allTokens array.\\n * @param tokenId uint256 ID of the token to be removed from the tokens list\\n */\\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = _allTokens.length - 1;\\n uint256 tokenIndex = _allTokensIndex[tokenId];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\\n uint256 lastTokenId = _allTokens[lastTokenIndex];\\n\\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n\\n // This also deletes the contents at the last position of the array\\n delete _allTokensIndex[tokenId];\\n _allTokens.pop();\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[46] private __gap;\\n}\\n\",\"keccak256\":\"0x2c98457c4171d86094adf9a4fd8cd2402b7e3e309e961f07910a60a576dd100f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\\n /**\\n * @dev Returns the total amount of tokens stored by the contract.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\\n */\\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\\n\\n /**\\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\\n * Use along with {totalSupply} to enumerate all tokens.\\n */\\n function tokenByIndex(uint256 index) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xf1870306db8391db9cf14b41be0da76857a88df0e5c623d2b2338fb30a3bd5ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 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 (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 functionCallWithValue(target, data, 0, \\\"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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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 /// @solidity memory-safe-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\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Counters\\n * @author Matt Condon (@shrugs)\\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\\n *\\n * Include with `using Counters for Counters.Counter;`\\n */\\nlibrary CountersUpgradeable {\\n struct Counter {\\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\\n // this feature: see https://github.com/ethereum/solidity/issues/4637\\n uint256 _value; // default: 0\\n }\\n\\n function current(Counter storage counter) internal view returns (uint256) {\\n return counter._value;\\n }\\n\\n function increment(Counter storage counter) internal {\\n unchecked {\\n counter._value += 1;\\n }\\n }\\n\\n function decrement(Counter storage counter) internal {\\n uint256 value = counter._value;\\n require(value > 0, \\\"Counter: decrement overflow\\\");\\n unchecked {\\n counter._value = value - 1;\\n }\\n }\\n\\n function reset(Counter storage counter) internal {\\n counter._value = 0;\\n }\\n}\\n\",\"keccak256\":\"0x798741e231b22b81e2dd2eddaaf8832dee4baf5cd8e2dbaa5c1dd12a1c053c4d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0x6b9a5d35b744b25529a2856a8093e7c03fb35a34b1c4fb5499e560f8ade140da\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../StringsUpgradeable.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSAUpgradeable {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", StringsUpgradeable.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x12f297cafe6e2847ae0378502f155654d0764b532a9873c8afe4350950fa7971\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable {\\n /* solhint-disable var-name-mixedcase */\\n bytes32 private _HASHED_NAME;\\n bytes32 private _HASHED_VERSION;\\n bytes32 private constant _TYPE_HASH = keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /* solhint-enable var-name-mixedcase */\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\\n __EIP712_init_unchained(name, version);\\n }\\n\\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\\n bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712NameHash() internal virtual view returns (bytes32) {\\n return _HASHED_NAME;\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\\n return _HASHED_VERSION;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x3017aded62c4a2b9707f5f06f92934e592c1c9b6f384b91b51340a6d5f841931\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/SignatureChecker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../AddressUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1271Upgradeable.sol\\\";\\n\\n/**\\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\\n * Argent and Gnosis Safe.\\n *\\n * _Available since v4.1._\\n */\\nlibrary SignatureCheckerUpgradeable {\\n /**\\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\\n *\\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\\n */\\n function isValidSignatureNow(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) internal view returns (bool) {\\n (address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hash, signature);\\n if (error == ECDSAUpgradeable.RecoverError.NoError && recovered == signer) {\\n return true;\\n }\\n\\n (bool success, bytes memory result) = signer.staticcall(\\n abi.encodeWithSelector(IERC1271Upgradeable.isValidSignature.selector, hash, signature)\\n );\\n return (success &&\\n result.length == 32 &&\\n abi.decode(result, (bytes32)) == bytes32(IERC1271Upgradeable.isValidSignature.selector));\\n }\\n}\\n\",\"keccak256\":\"0x5f6f34a77bdf88981d8985a33ebdb727df972172df6bdbb2a1bd480ce0bd43cb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc1bd5b53319c68f84e3becd75694d941e8f4be94049903232cd8bc7c535aaa5a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMathUpgradeable {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcaa8b7861115ea691c77ddbeac140a444e0edcd1d9812a43942c0f6b42b36a49\",\"license\":\"MIT\"},\"contracts/DealsRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\\\";\\nimport \\\"./interfaces/IEntitiesRegistry.sol\\\";\\nimport \\\"./interfaces/IConfig.sol\\\";\\nimport \\\"./libraries/Utils.sol\\\";\\nimport \\\"./libraries/SignatureUtils.sol\\\";\\nimport \\\"./utils/IERC20.sol\\\";\\n\\n/**\\n * @title DealsRegistry\\n * @dev A smart contract for creating and managing deals between buyers and sellers.\\n * The contract stores offers made by suppliers, and allows buyers to create deals based on those offers.\\n * Each deal specifies the payment and cancellation terms, and can be tracked on-chain using its unique Id.\\n */\\nabstract contract DealsRegistry is\\n EIP712Upgradeable,\\n PausableUpgradeable,\\n OwnableUpgradeable\\n{\\n using SignatureCheckerUpgradeable for address;\\n using SignatureUtils for bytes;\\n using SafeMathUpgradeable for uint256;\\n\\n /// @dev The protocol config contract address\\n address public config;\\n\\n /// @dev Entities registry contract address\\n address public entities;\\n\\n /// @dev Mapping of context to allowed statuses list\\n mapping(bytes32 => Utils.DealStatus[]) private allowedStatuses;\\n\\n /// @dev Mapping of an offer Id on a Deal\\n mapping(bytes32 => Utils.Deal) public deals;\\n\\n /// @dev Emitted when a Deal status is updated\\n event Status(bytes32 offerId, Utils.DealStatus status, address sender);\\n\\n /// @dev Emitted when updated an address of the protocol config contract\\n event SetConfig(address oldAddress, address newAddress);\\n\\n /// @dev Emitted when updated an address of the Entities registry contract\\n event SetEntities(address oldAddress, address newAddress);\\n\\n /// @dev Thrown when a user attempts to create a deal using an offer with an invalid signature\\n error InvalidOfferSignature();\\n\\n /// @dev Thrown when a user attempts to create an already existing Deal\\n error DealExists();\\n\\n /// @dev Thrown when Deal was created in the `_beforeCreate` hook\\n error DealAlreadyCreated();\\n\\n /// @dev Thrown when the Deal is not found\\n error DealNotFound();\\n\\n /// @dev Thrown when a user attempts to create a deal providing an invalid payment options\\n error InvalidPaymentOptions();\\n\\n /// @dev Thrown when a user attempts to create a deal providing an invalid payment option Id\\n error InvalidPaymentId();\\n\\n /// @dev Thrown when a Deal funds transfer is failed\\n error DealFundsTransferFailed();\\n\\n /// @dev Thrown when the retailer of the offer is not found\\n error InvalidRetailer();\\n\\n /// @dev Thrown when the supplier of the offer is not enabled\\n error DisabledSupplier();\\n\\n /// @dev Thrown when the retailer is not enabled\\n error DisabledRetailer();\\n\\n /// @dev Thrown when a function call is not allowed for current user\\n error NotAllowedAuth();\\n\\n /// @dev Thrown when a user attempts to claim the deal in non-created status\\n error NotAllowedStatus();\\n\\n /// @dev Thrown when a user attempts to do something that not allowed at a moment\\n error NotAllowedTime();\\n\\n /// @dev Thrown when a user attempts to cancel the deal using invalid cancellation options\\n error InvalidCancelOptions();\\n\\n /**\\n * @dev DealsRegistry initializer\\n * @param _name The name of the contract\\n * @param _version The version of the contract\\n * @param _config The protocol config contract address\\n * @param _entities Entities registry contract address\\n */\\n function __DealsRegistry_init(\\n string memory _name,\\n string memory _version,\\n address _config,\\n address _entities\\n ) internal onlyInitializing {\\n __EIP712_init(_name, _version);\\n __Pausable_init();\\n\\n // Save the protocol config contract address\\n config = _config;\\n\\n // Save entities registry address\\n entities = _entities;\\n\\n // Allowed statuses for functions execution\\n allowedStatuses[\\\"reject\\\"] = [Utils.DealStatus.Created];\\n allowedStatuses[\\\"cancel\\\"] = [\\n Utils.DealStatus.Created,\\n Utils.DealStatus.Claimed\\n ];\\n allowedStatuses[\\\"refund\\\"] = [\\n Utils.DealStatus.Claimed,\\n Utils.DealStatus.CheckedIn\\n ];\\n allowedStatuses[\\\"claim\\\"] = [Utils.DealStatus.Created];\\n allowedStatuses[\\\"checkIn\\\"] = [Utils.DealStatus.Claimed];\\n allowedStatuses[\\\"checkOut\\\"] = [Utils.DealStatus.CheckedIn];\\n allowedStatuses[\\\"dispute\\\"] = [\\n Utils.DealStatus.CheckedIn,\\n Utils.DealStatus.CheckedOut\\n ];\\n }\\n\\n /// Modifiers\\n\\n /**\\n * @dev Modifier to make a function callable only when deal is exists\\n *\\n * Requirements:\\n *\\n * - the deal of the `offerId` must exists\\n */\\n modifier dealExists(bytes32 offerId) {\\n if (deals[offerId].offer.id == bytes32(0)) {\\n revert DealNotFound();\\n }\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when deal in specific statuses.\\n *\\n * Requirements:\\n *\\n * - the deal of the `offerId` must exists\\n * - the deal is in `statuses`\\n */\\n modifier inStatuses(bytes32 offerId, Utils.DealStatus[] memory statuses) {\\n uint256 allowed;\\n Utils.DealStatus currentStatus = deals[offerId].status;\\n\\n for (uint256 i = 0; i < statuses.length; i++) {\\n if (currentStatus == statuses[i]) {\\n allowed = 1;\\n break;\\n }\\n }\\n\\n if (allowed != 1) {\\n revert NotAllowedStatus();\\n }\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only by supplier's signer.\\n *\\n * Requirements:\\n *\\n * - the function called by the supplier's signer\\n */\\n modifier onlySigner(bytes32 offerId) {\\n if (\\n _msgSender() !=\\n IEntitiesRegistry(entities)\\n .getEntity(deals[offerId].offer.supplierId)\\n .signer\\n ) {\\n revert NotAllowedAuth();\\n }\\n _;\\n }\\n\\n /// Utilities\\n\\n /**\\n * @dev Sets the new address of the protocol config contract address\\n * @param _config The new protocol config contract address\\n */\\n function setConfig(address _config) external onlyOwner {\\n emit SetConfig(config, _config);\\n config = _config;\\n }\\n\\n /**\\n * @dev Sets the new address of the entities registry\\n * @param _entities The new protocol config contract address\\n */\\n function setEntities(address _entities) external onlyOwner {\\n emit SetEntities(entities, _entities);\\n entities = _entities;\\n }\\n\\n /// Workflow hooks\\n\\n /**\\n * @dev Hook function that runs before a new deal is created.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offer The offer used to create the deal\\n * @param price The price of the asset in wei\\n * @param asset The address of the ERC20 token used for payment\\n * @param signs An array of signatures authorizing the creation of the deal\\n */\\n function _beforeCreate(\\n Utils.Offer memory offer,\\n uint256 price,\\n address asset,\\n bytes[] memory signs\\n ) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after a new deal is created.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offer The offer used to create the deal\\n * @param price The price of the asset in wei\\n * @param asset The address of the ERC20 token used for payment\\n * @param signs An array of signatures authorizing the creation of the deal\\n */\\n function _afterCreate(\\n Utils.Offer memory offer,\\n uint256 price,\\n address asset,\\n bytes[] memory signs\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is rejected by a supplier.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param reason Rejection reason\\n */\\n function _beforeReject(\\n bytes32 offerId,\\n bytes32 reason\\n ) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is rejected by s supplier.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param reason Rejection reason\\n */\\n function _afterReject(bytes32 offerId, bytes32 reason) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is canceled.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _beforeCancel(bytes32 offerId) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is canceled.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _afterCancel(bytes32 offerId) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is refunded.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _beforeRefund(bytes32 offerId) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is refunded.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _afterRefund(bytes32 offerId) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is claimed.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param buyer Address of the deal buyer\\n */\\n function _beforeClaim(\\n bytes32 offerId,\\n address buyer\\n ) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is claimed.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param buyer Address of the deal buyer\\n */\\n function _afterClaim(bytes32 offerId, address buyer) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is checked in.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param signs An array of signatures authorizing the check in of the deal\\n */\\n function _beforeCheckIn(\\n bytes32 offerId,\\n bytes[] memory signs\\n ) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is checked in.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param signs An array of signatures authorizing the check in of the deal\\n */\\n function _afterCheckIn(\\n bytes32 offerId,\\n bytes[] memory signs\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is checked out.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _beforeCheckOut(bytes32 offerId) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is checked out.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _afterCheckOut(bytes32 offerId) internal virtual {}\\n\\n /// Features\\n\\n /**\\n * @dev Creates a Deal on a base of an offer\\n * @param offer An offer payload\\n * @param paymentOptions Raw offered payment options array\\n * @param paymentId Payment option Id\\n * @param retailerId Retailer Id\\n * @param signs Signatures: [0] - offer: ECDSA/ERC1271; [1] - asset permit: ECDSA (optional)\\n *\\n * Requirements:\\n *\\n * - supplier of the offer must be registered\\n * - offer must be signed with a proper signer\\n * - the deal should not be created before\\n * - the deal should not be created inside the _before hook\\n * - payment options must be valid (equal to those from the offer)\\n * - payment Id must exists in payment options\\n * - the contract must be able to make transfer of funds\\n *\\n * NOTE: `permit` signature can be ECDSA of type only\\n */\\n function deal(\\n Utils.Offer memory offer,\\n Utils.PaymentOption[] memory paymentOptions,\\n bytes32 paymentId,\\n bytes32 retailerId,\\n bytes[] memory signs\\n ) external {\\n address buyer = _msgSender();\\n\\n /// @dev variable scoping used to avoid stack too deep errors\\n /// The `supplier` storage variable is required is the frame of this scope only\\n {\\n bytes32 offerHash = _hashTypedDataV4(Utils.hash(offer));\\n IEntitiesRegistry.Entity memory supplier = IEntitiesRegistry(entities)\\n .getEntity(offer.supplierId);\\n\\n // Checking ECDSA/AA signature is valid\\n if (!supplier.signer.isValidSignatureNow(offerHash, signs[0])) {\\n revert InvalidOfferSignature();\\n }\\n\\n // Not-enabled suppliers are not allowed to accept deals\\n // So, we cannot allow to create such a deal\\n if (!IEntitiesRegistry(entities).isEntityEnabled(offer.supplierId)) {\\n revert DisabledSupplier();\\n }\\n\\n // The retailer is optional, so we validate its rules only if retailerId is defined\\n if (retailerId != bytes32(0)) {\\n IEntitiesRegistry.Entity memory retailer = IEntitiesRegistry(entities)\\n .getEntity(retailerId);\\n\\n // Retailer must be registered\\n if (retailer.owner == address(0)) {\\n revert InvalidRetailer();\\n }\\n\\n // Not-enabled retailer are not allowed\\n if (!IEntitiesRegistry(entities).isEntityEnabled(retailerId)) {\\n revert DisabledRetailer();\\n }\\n }\\n\\n // Deal can be created only once\\n if (deals[offer.id].offer.id == offer.id) {\\n revert DealExists();\\n }\\n\\n bytes32 paymentHash = Utils.hash(paymentOptions);\\n\\n // payment options provided with argument must be the same\\n // as signed in the offer\\n if (paymentHash != offer.paymentHash) {\\n revert InvalidPaymentOptions();\\n }\\n }\\n\\n uint256 price;\\n address asset;\\n\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n // Payment id must be one of the defined in payment options\\n if (paymentOptions[i].id == paymentId) {\\n price = paymentOptions[i].price;\\n asset = paymentOptions[i].asset;\\n break;\\n }\\n }\\n\\n if (asset == address(0)) {\\n revert InvalidPaymentId();\\n }\\n\\n _beforeCreate(offer, price, asset, signs);\\n\\n // Check that the deal was not created by `_beforeCreate` hook\\n if (deals[offer.id].offer.id == offer.id) {\\n revert DealAlreadyCreated();\\n }\\n\\n // Creating the deal before any external call to avoid reentrancy\\n deals[offer.id] = Utils.Deal(\\n block.timestamp,\\n offer,\\n retailerId,\\n buyer,\\n price,\\n asset,\\n Utils.DealStatus.Created\\n );\\n\\n if (signs.length > 1) {\\n // Use permit function to transfer tokens from the sender to the contract\\n (uint8 v, bytes32 r, bytes32 s) = signs[1].split();\\n IERC20(asset).permit(buyer, address(this), price, offer.expire, v, r, s);\\n }\\n\\n // Use transferFrom function to transfer tokens from the sender to the contract\\n if (!IERC20(asset).transferFrom(buyer, address(this), price)) {\\n revert DealFundsTransferFailed();\\n }\\n\\n emit Status(offer.id, Utils.DealStatus.Created, buyer);\\n\\n _afterCreate(offer, price, asset, signs);\\n }\\n\\n /**\\n * @dev Rejects the deal\\n * @param offerId The deal offer Id\\n * @param reason Rejection reason\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.Created\\n * - must be called by the signer address of the deal offer supplier\\n */\\n function reject(\\n bytes32 offerId,\\n bytes32 reason\\n )\\n external\\n dealExists(offerId)\\n onlySigner(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"reject\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n // Moving to the Rejected status before all to avoid reentrancy\\n storedDeal.status = Utils.DealStatus.Rejected;\\n\\n _beforeReject(offerId, reason);\\n\\n if (\\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n emit Status(offerId, Utils.DealStatus.Rejected, _msgSender());\\n\\n _afterReject(offerId, reason);\\n }\\n\\n /**\\n * @dev Refunds the deal\\n * @param offerId The deal offer Id\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.CheckedIn\\n * - must be called by the signer address of the deal offer supplier\\n */\\n function refund(\\n bytes32 offerId\\n )\\n external\\n dealExists(offerId)\\n onlySigner(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"refund\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n // Moving to the Refunded status before all to avoid reentrancy\\n storedDeal.status = Utils.DealStatus.Refunded;\\n\\n _beforeRefund(offerId);\\n\\n if (\\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n emit Status(offerId, Utils.DealStatus.Refunded, _msgSender());\\n\\n _afterRefund(offerId);\\n }\\n\\n /**\\n * @dev Cancels the deal\\n * @param offerId The deal offer Id\\n * @param _cancelOptions Cancellation options from offer\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.Created or DealStatus.Claimed\\n * - must be called by buyer\\n * - if the deal in DealStatus.Claimed status:\\n * - if block.timestamp > checkIn time then zero refund\\n * - cancellation rules must follow the rules defined by offer\\n */\\n function cancel(\\n bytes32 offerId,\\n Utils.CancelOption[] memory _cancelOptions\\n )\\n external\\n dealExists(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"cancel\\\"])\\n {\\n address sender = _msgSender();\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n if (sender != storedDeal.buyer) {\\n revert NotAllowedAuth();\\n }\\n\\n // Buyer is not able to cancel the deal during `claim_period`\\n // This time is given to the supplier to claim the deal\\n if (\\n block.timestamp <\\n storedDeal.created.add(IConfig(config).getNumber(\\\"claim_period\\\"))\\n ) {\\n revert NotAllowedTime();\\n }\\n\\n Utils.DealStatus callStatus = storedDeal.status;\\n\\n // Moving to the Cancelled status before all to avoid reentrancy\\n storedDeal.status = Utils.DealStatus.Cancelled;\\n\\n _beforeCancel(offerId);\\n\\n if (callStatus == Utils.DealStatus.Created) {\\n // Full refund\\n if (\\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n } else if (\\n callStatus == Utils.DealStatus.Claimed &&\\n block.timestamp < storedDeal.offer.checkIn\\n ) {\\n if (storedDeal.offer.cancelHash != Utils.hash(_cancelOptions)) {\\n revert InvalidCancelOptions();\\n }\\n\\n // Using offer cancellation rules\\n uint256 selectedTime;\\n uint256 selectedPenalty;\\n\\n for (uint256 i = 0; i < _cancelOptions.length; i++) {\\n if (\\n block.timestamp >= _cancelOptions[i].time &&\\n (selectedTime == 0 || _cancelOptions[i].time < selectedTime)\\n ) {\\n selectedTime = _cancelOptions[i].time;\\n selectedPenalty = _cancelOptions[i].penalty;\\n }\\n }\\n\\n if (selectedPenalty > 100) {\\n selectedPenalty = 100;\\n }\\n\\n uint256 penaltyValue = Utils._percentage(\\n storedDeal.price,\\n selectedPenalty\\n );\\n\\n if (\\n !IERC20(storedDeal.asset).transfer(\\n storedDeal.buyer,\\n storedDeal.price.sub(penaltyValue)\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n if (\\n penaltyValue > 0 &&\\n !IERC20(storedDeal.asset).transfer(\\n IEntitiesRegistry(entities)\\n .getEntity(storedDeal.offer.supplierId)\\n .owner,\\n penaltyValue\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n } else {\\n revert NotAllowedStatus();\\n }\\n\\n emit Status(offerId, Utils.DealStatus.Cancelled, sender);\\n\\n _afterCancel(offerId);\\n }\\n\\n /**\\n * @dev Claims the deal\\n * @param offerId The deal offer Id\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.Created\\n * - must be called by the signer address of the deal offer supplier\\n */\\n function claim(\\n bytes32 offerId\\n )\\n external\\n dealExists(offerId)\\n onlySigner(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"claim\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n _beforeClaim(offerId, storedDeal.buyer);\\n\\n storedDeal.status = Utils.DealStatus.Claimed;\\n emit Status(offerId, Utils.DealStatus.Claimed, _msgSender());\\n\\n _afterClaim(offerId, storedDeal.buyer);\\n }\\n\\n /**\\n * @dev Checks in the deal\\n * @param offerId The deal offer Id\\n * @param signs Signatures\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.Claimed\\n * - must be called by the supplier's signer or buyer's address\\n * - if called by the supplier's signer:\\n * - a valid signature of suppliers's signer must be provided in signs[0]\\n * - if before sign-in time: a valid signature of the buyer must be provided in signs[1]\\n * - if called buy buyer:\\n * - a valid signature of the buyer must be provided in signs[0]\\n * - a valid signature of suppliers's signer must be provided in signs[1]\\n */\\n function checkIn(\\n bytes32 offerId,\\n bytes[] memory signs\\n )\\n external\\n dealExists(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"checkIn\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n IEntitiesRegistry.Entity memory supplier = IEntitiesRegistry(entities)\\n .getEntity(storedDeal.offer.supplierId);\\n\\n address sender = _msgSender();\\n bytes32 signInHash;\\n\\n if (sender == supplier.signer) {\\n // The function is called by the supplier's signer\\n signInHash = _hashTypedDataV4(\\n Utils.hashCheckInOut(storedDeal.offer.id, supplier.signer)\\n );\\n\\n // Checking ECDSA/AA signature of the suppliers's signer is valid\\n if (!supplier.signer.isValidSignatureNow(signInHash, signs[0])) {\\n revert InvalidOfferSignature();\\n }\\n\\n // Before checkIn time of the offer a signature of the buyer is required\\n if (block.timestamp < storedDeal.offer.checkIn) {\\n signInHash = _hashTypedDataV4(\\n Utils.hashCheckInOut(storedDeal.offer.id, storedDeal.buyer)\\n );\\n\\n // Checking ECDSA/AA signature of the buyer is valid\\n if (!storedDeal.buyer.isValidSignatureNow(signInHash, signs[1])) {\\n revert InvalidOfferSignature();\\n }\\n }\\n } else if (sender == storedDeal.buyer) {\\n signInHash = _hashTypedDataV4(\\n Utils.hashCheckInOut(storedDeal.offer.id, storedDeal.buyer)\\n );\\n\\n // Checking ECDSA/AA signature of the suppliers's signer is valid\\n if (!storedDeal.buyer.isValidSignatureNow(signInHash, signs[0])) {\\n revert InvalidOfferSignature();\\n }\\n\\n signInHash = _hashTypedDataV4(\\n Utils.hashCheckInOut(storedDeal.offer.id, supplier.signer)\\n );\\n\\n // Checking ECDSA/AA signature of the buyer is valid\\n if (!supplier.signer.isValidSignatureNow(signInHash, signs[1])) {\\n revert InvalidOfferSignature();\\n }\\n } else {\\n revert NotAllowedAuth();\\n }\\n\\n // Execute before checkIn hook\\n _beforeCheckIn(offerId, signs);\\n\\n storedDeal.status = Utils.DealStatus.CheckedIn;\\n emit Status(offerId, Utils.DealStatus.CheckedIn, sender);\\n\\n // Execute after checkIn hook\\n _afterCheckIn(offerId, signs);\\n }\\n\\n /**\\n * @dev Checks out the deal and sends funds to the supplier\\n * @param offerId The deal offer Id\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - must be called by the supplier's signer only\\n * - the deal must be in status DealStatus.CheckIn\\n * - must be called after checkOut time only\\n */\\n function checkOut(\\n bytes32 offerId\\n )\\n external\\n dealExists(offerId)\\n onlySigner(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"checkOut\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n if (block.timestamp < storedDeal.offer.checkOut) {\\n revert NotAllowedTime();\\n }\\n\\n // Moving to CheckedOut status before all to avoid reentrancy\\n storedDeal.status = Utils.DealStatus.CheckedOut;\\n\\n // Execute before checkOut hook\\n _beforeCheckOut(offerId);\\n\\n uint256 protocolFee;\\n uint256 retailerFee;\\n uint256 supplierValue;\\n\\n protocolFee = Utils._percentage(\\n storedDeal.price,\\n IConfig(config).getNumber(\\\"protocol_fee\\\")\\n );\\n\\n if (storedDeal.retailerId != bytes32(0)) {\\n retailerFee = Utils._percentage(\\n storedDeal.price,\\n IConfig(config).getNumber(\\\"retailer_fee\\\")\\n );\\n }\\n\\n supplierValue = storedDeal.price.sub(protocolFee).sub(retailerFee);\\n\\n if (\\n protocolFee > 0 &&\\n // Sends fee to the protocol recipient\\n !IERC20(storedDeal.asset).transfer(\\n IConfig(config).getAddress(\\\"fee_recipient\\\"),\\n protocolFee\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n if (\\n retailerFee > 0 &&\\n // Send fee to the deal retailer\\n !IERC20(storedDeal.asset).transfer(\\n IEntitiesRegistry(entities).getEntity(storedDeal.retailerId).owner,\\n retailerFee\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n if (\\n // Sends value to the supplier\\n !IERC20(storedDeal.asset).transfer(\\n IEntitiesRegistry(entities)\\n .getEntity(storedDeal.offer.supplierId)\\n .owner,\\n supplierValue\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n emit Status(offerId, Utils.DealStatus.CheckedOut, _msgSender());\\n\\n // Execute after checkOut hook\\n _afterCheckOut(offerId);\\n }\\n\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x0cae627472d2521a751ef0c9242ce97cecbc4625a7947c11b4f3009394442e74\",\"license\":\"MIT\"},\"contracts/ERC721Token.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\\\";\\n\\n/**\\n * @title ERC721Token\\n * @dev Abstract contract that defines an ERC721 token\\n * with additional functionality for enumeration and pausing\\n */\\nabstract contract ERC721Token is\\n ERC721Upgradeable,\\n ERC721EnumerableUpgradeable,\\n PausableUpgradeable,\\n OwnableUpgradeable\\n{\\n using CountersUpgradeable for CountersUpgradeable.Counter;\\n\\n /// @dev Internal counter to keep track of tokenIds\\n CountersUpgradeable.Counter private _tokenIdCounter;\\n\\n /**\\n * @dev Initializer that sets the name and symbol of the token\\n * @param name The name of the token\\n * @param symbol The symbol of the token\\n */\\n function __ERC721Token_init(\\n string memory name,\\n string memory symbol\\n ) internal onlyInitializing {\\n __ERC721_init(name, symbol);\\n __ERC721Enumerable_init();\\n __Pausable_init();\\n }\\n\\n /**\\n * @dev Internal function to safely mint an NFT to an address with custom URI\\n * @param to The address that will receive the minted NFT\\n */\\n function safeMint(address to) internal returns (uint256) {\\n uint256 tokenId = _tokenIdCounter.current();\\n _tokenIdCounter.increment();\\n _safeMint(to, tokenId);\\n return tokenId;\\n }\\n\\n /**\\n * @dev Internal function to safely burn an NFT\\n * @param tokenId The ID of the NFT to be burnt\\n */\\n function safeBurn(uint256 tokenId) internal {\\n require(\\n _isApprovedOrOwner(_msgSender(), tokenId),\\n \\\"ERC721: caller is not token owner or approved\\\"\\n );\\n _burn(tokenId);\\n }\\n\\n /// @inheritdoc ERC721Upgradeable\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n uint256 batchSize\\n )\\n internal\\n virtual\\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\\n whenNotPaused\\n {\\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\\n }\\n\\n /// @inheritdoc ERC721Upgradeable\\n function supportsInterface(\\n bytes4 interfaceId\\n )\\n public\\n view\\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x6c68f9f78d2994add0bf3ea8529ac99e0347eedcde91243a414a4cd02d424bdc\",\"license\":\"MIT\"},\"contracts/Market.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport \\\"./ERC721Token.sol\\\";\\nimport \\\"./DealsRegistry.sol\\\";\\nimport \\\"./libraries/Utils.sol\\\";\\n\\n/**\\n * @title Market\\n * @dev This contract enables the creation and management of deals\\n * @custom:security-contact security@windingtree.com\\n */\\ncontract Market is ERC721Token, DealsRegistry {\\n /// @dev Mapping of token Id on offer Id\\n mapping(uint256 => bytes32) public tokenOffers;\\n\\n /// @dev Mapping of offer Id on token Id\\n mapping(bytes32 => uint256) public offerTokens;\\n\\n /// Throws when NFT transfer is not allowed by offer rule\\n error TokenTransferNotAllowed();\\n\\n /**\\n * @dev Constructor of ERC721Token\\n */\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the Market contract with the given arguments\\n * @param _owner The owner of the contract\\n * @param _name The name of the contract\\n * @param _version The version of the contract\\n * @param _config The protocol config contract address\\n * @param _entities Entities registry contract address\\n */\\n function initialize(\\n address _owner,\\n string memory _name,\\n string memory _version,\\n address _config,\\n address _entities\\n ) external initializer {\\n _transferOwnership(_owner);\\n\\n // Initialize ERC721 token\\n __ERC721Token_init(\\\"DealToken\\\", \\\"DEAL\\\");\\n\\n // Initialize Deals registry\\n __DealsRegistry_init(_name, _version, _config, _entities);\\n }\\n\\n /// Getters\\n\\n /**\\n * @dev Returns offerId linked to the token\\n * @param tokenId The ID of the token\\n * @return offerId The ID of the offer linked to the token\\n */\\n function resolveTokenId(\\n uint256 tokenId\\n ) external view returns (bytes32 offerId) {\\n _requireMinted(tokenId);\\n offerId = tokenOffers[tokenId];\\n }\\n\\n /// Pausable features\\n\\n /**\\n * @dev Pauses the contract\\n */\\n function pause() public onlyOwner {\\n _pause();\\n }\\n\\n /**\\n * @dev Unpauses the contract\\n */\\n function unpause() public onlyOwner {\\n _unpause();\\n }\\n\\n /// Features\\n\\n /**\\n * @dev Executes logic before a deal is created\\n * @param offer The details of the offer\\n * @param price The price of the offer\\n * @param asset The address of the asset\\n * @param signs The signatures of the offer\\n */\\n function _beforeCreate(\\n Utils.Offer memory offer,\\n uint256 price,\\n address asset,\\n bytes[] memory signs\\n ) internal override(DealsRegistry) whenNotPaused {\\n super._beforeCreate(offer, price, asset, signs);\\n }\\n\\n /**\\n * @dev Executes logic after a deal is created\\n * @param offer The details of the offer\\n * @param price The price of the offer\\n * @param asset The address of the asset\\n * @param signs The signatures of the offer\\n */\\n function _afterCreate(\\n Utils.Offer memory offer,\\n uint256 price,\\n address asset,\\n bytes[] memory signs\\n ) internal override(DealsRegistry) {\\n // After-deal logic\\n super._afterCreate(offer, price, asset, signs);\\n }\\n\\n /**\\n * @dev Executes logic after a deal is claimed\\n * @param offerId The ID of the offer\\n * @param buyer The address of the buyer\\n */\\n function _afterClaim(\\n bytes32 offerId,\\n address buyer\\n ) internal override(DealsRegistry) {\\n // Minting of a token\\n uint256 tokenId = safeMint(buyer);\\n // Create a map of token Id on offer Id\\n tokenOffers[tokenId] = offerId;\\n // Create a map of offer Id on token Id\\n offerTokens[offerId] = tokenId;\\n super._afterClaim(offerId, buyer);\\n }\\n\\n /**\\n * @dev Executes logic after a deal is canceled\\n * @param offerId The ID of the offer\\n */\\n function _afterCancel(bytes32 offerId) internal override(DealsRegistry) {\\n uint256 tokenId = offerTokens[offerId];\\n\\n // If token has been minted we must burn it\\n if (tokenId != 0) {\\n safeBurn(tokenId);\\n delete tokenOffers[tokenId];\\n delete offerTokens[offerId];\\n }\\n\\n super._beforeCancel(offerId);\\n }\\n\\n /// ERC721 features\\n\\n /**\\n * @dev Returns the token URI of the given token ID\\n * @param tokenId The ID of the token\\n * @return The token URI of the given token ID\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override(ERC721Upgradeable) returns (string memory) {\\n _requireMinted(tokenId);\\n // TODO: Generate data-uri that depends on the id\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev Executes before a token transfer\\n * @param from The address to transfer the token from\\n * @param to The address to transfer the token to\\n * @param tokenId The ID of the token being transferred\\n * @param batchSize The size of the batch being transferred\\n *\\n * NOTE: Initially minted token is transferred to his owner without any restrictions\\n * All other transfers are managed according the following requirements:\\n *\\n * - token must be linked to an offerId\\n * - token can be transferred or not according to the configuration of offer\\n * - token can not be transferred when the deal status is `Claimed` only\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n uint256 batchSize\\n ) internal override(ERC721Token) whenNotPaused {\\n // Execute the logic when the function called not from `_mint` or `_burn`\\n if (from != address(0) && to != address(0)) {\\n bytes32 offerId = tokenOffers[tokenId];\\n\\n if (offerId == bytes32(0)) {\\n revert DealNotFound();\\n }\\n\\n Utils.Deal storage offerDeal = deals[offerId];\\n\\n // Prevent transfer of token when this is not allowed by the offer\\n // or the deal is in the non-transferrable status\\n if (\\n !offerDeal.offer.transferable ||\\n offerDeal.status != Utils.DealStatus.Claimed\\n ) {\\n revert TokenTransferNotAllowed();\\n }\\n\\n // Change the deal buyer to the new token owner\\n offerDeal.buyer = to;\\n }\\n\\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\\n }\\n\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x21d01e263b41cf342eba12f17f7382a6d9f4261e58834af078087b57aba78aa1\",\"license\":\"MIT\"},\"contracts/interfaces/IConfig.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\n/**\\n * @title Configurable contract interface\\n * @dev Interface for a contract that allows for dynamic configuration of uint256 and address values.\\n */\\ninterface IConfig {\\n /**\\n * @dev Returns a number by name\\n * @param _name A number name\\n * @return The value of the number\\n */\\n function getNumber(bytes32 _name) external view returns (uint256);\\n\\n /**\\n * @dev Returns an address by name\\n * @param _name An address name\\n * @return The address value\\n */\\n function getAddress(bytes32 _name) external view returns (address);\\n\\n /**\\n * @dev Returns a list of registered config variables names\\n * @return Array of registered variables names\\n */\\n function variables() external view returns (bytes32[] memory);\\n\\n /**\\n * @dev Returns a minDeposit value of the entity\\n * @param _name An entity name\\n * @return The value of the number\\n */\\n function getMinDeposit(bytes32 _name) external view returns (uint256);\\n\\n /**\\n * @dev Changes variable uint256 of value\\n * @param name Name of variable\\n * @param value Value of variable\\n */\\n function config(bytes32 name, uint256 value) external;\\n\\n /**\\n * @dev Changes variable address of value\\n * @param name Name of variable\\n * @param value Value of variable\\n */\\n function config(bytes32 name, address value) external;\\n\\n /**\\n * @dev Sets minimum deposits values\\n * @param _kinds Supported entity types\\n * @param _minDeposits Minimum value of deposit\\n */\\n function setMinDeposits(\\n bytes32[] memory _kinds,\\n uint256[] memory _minDeposits\\n ) external;\\n}\\n\",\"keccak256\":\"0x47c6b566e13ed415ae815097092e0482b39832a76aeadccfd8a889d9d03b8518\",\"license\":\"MIT\"},\"contracts/interfaces/IEntitiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\n/**\\n * @title IEntitiesRegistry\\n * @dev A smart contract interface for registering and managing entities who can participate in the protocol.\\n */\\ninterface IEntitiesRegistry {\\n /**\\n * @dev Entity storage struct\\n * @param id Unique entity Id\\n * @param owner Owner of the entity entity\\n * @param enabled The entity entity activity flag\\n * @param signer Offers signer\\n */\\n struct Entity {\\n bytes32 kind;\\n bytes32 id;\\n address owner;\\n bool enabled;\\n address signer;\\n }\\n\\n /**\\n * @dev Returns entity by Id\\n * @param _id The entity Id\\n */\\n function getEntity(bytes32 _id) external view returns (Entity memory);\\n\\n /**\\n * @dev Returns the value of the entity's deposit\\n * @param _id The entity Id\\n */\\n function balanceOfEntity(bytes32 _id) external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of `enabled` entity status\\n * @param _id The entity Id\\n */\\n function isEntityEnabled(bytes32 _id) external view returns (bool);\\n\\n /**\\n * @dev Sets the new address of the protocol config contract address\\n */\\n function setConfig(address _config) external;\\n\\n /**\\n * @dev Registers a new entity\\n * @param _kind Type of entity\\n * @param _salt Unique bytes32 string that allows off-chain calculation of the entity Id\\n * @param _signer Account address that authorized by the entity owner to sign offers\\n *\\n * If registering of the entity is succeeded:\\n * - the function emits `EntityRegistered(bytes32 id, bytes32 id)` event\\n *\\n * Requirements:\\n *\\n * - `salt` can be used only once. If a `salt` has been used and the entity is registered\\n * the next attempt will results in the error `EntityExists()`\\n * - an entity type provided with `_kind` must be registered\\n *\\n * NOTE: When the entity is registered its initial `enabled` status is set to `false`.\\n * This means that to start accepting deals the entity must be enabled\\n */\\n function register(bytes32 _kind, bytes32 _salt, address _signer) external;\\n\\n /**\\n * @dev Changes signer account of the entity\\n * @param _id The entity Id\\n * @param _signer Account authorized by the entity to sign offers\\n *\\n * If changing of the signer is succeeded:\\n * - the function emits `SignerChanged(bytes32 id, address sender, address oldSigner, address new Signer)` event\\n *\\n * Requirements:\\n *\\n * - can be called by the entity owner only\\n */\\n function changeSigner(bytes32 _id, address _signer) external;\\n\\n /**\\n * @dev Toggles an enabled status of the entity\\n * @param _id The entity Id\\n *\\n * This function inverts a value of the `enabled` parameter of the entity\\n *\\n * If toggling is succeeded:\\n * - the function emits `ToggleEnabled(bytes32 id, address sender, bool enabled)` event\\n *\\n * Requirements:\\n *\\n * - can be called by the entity owner only\\n */\\n function toggleEntity(bytes32 _id) external;\\n\\n /**\\n * @dev See {EntitiesRegistry._addDeposit}.\\n */\\n function addDeposit(bytes32 _id, uint256 _value) external;\\n\\n /**\\n * @dev Makes deposit of `asset` tokens with permit\\n * @param _id The entity Id\\n * @param _value Amount of `asset` tokens that must be deposited\\n * @param _deadline Deadline time of permit\\n * @param _sign Permit signature (EIP712)\\n *\\n * If `_sign` argument is provided the function will use the `permit` function\\n * to transfer tokens from the sender to the contract, overwise the usual\\n * `transferFrom` will be used.\\n *\\n * If the tokens transfer is succeeded:\\n * - the function emits `Deposit(bytes32 id, address sender, uint256 value)` event\\n *\\n * Requirements:\\n *\\n * - can be called by the entity owner only\\n */\\n function addDeposit(\\n bytes32 _id,\\n uint256 _value,\\n uint256 _deadline,\\n bytes memory _sign\\n ) external;\\n\\n /**\\n * @dev Makes deposit withdrawal of the entity\\n * @param _id The entity Id\\n * @param _value Amount of `asset` tokens that must be withdrawn\\n *\\n * If the tokens withdrawal is succeeded:\\n * - the function emits `Withdraw(bytes32 id, address sender, uint256 value)` event\\n *\\n * Requirements:\\n *\\n * - can be called by the entity owner only\\n */\\n function withdrawDeposit(bytes32 _id, uint256 _value) external;\\n}\\n\",\"keccak256\":\"0x3f48925046ed3c45e1bd041ddf7c64bcebbb82ef30dc88532ea4c136265a30b8\",\"license\":\"MIT\"},\"contracts/libraries/SignatureUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nlibrary SignatureUtils {\\n error InvalidSignature();\\n\\n /// @dev Splits signature into v/r/s form\\n function split(\\n bytes memory signature\\n ) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\\n if (signature.length == 65) {\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n\\n if eq(v, 0) {\\n v := 27\\n }\\n\\n if eq(v, 1) {\\n v := 28\\n }\\n }\\n } else {\\n revert InvalidSignature();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb20f713cacd073216c4a1be4af5649de3eabdcb46cffcaf2b60c59b58ae10e1f\",\"license\":\"MIT\"},\"contracts/libraries/Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\\\";\\n\\nlibrary Utils {\\n using SafeMathUpgradeable for uint256;\\n\\n /// Constants\\n\\n bytes32 public constant PAYMENT_OPTION_TYPE_HASH =\\n keccak256(\\\"PaymentOption(bytes32 id,uint256 price,address asset)\\\");\\n\\n bytes32 public constant CANCEL_OPTION_TYPE_HASH =\\n keccak256(\\\"CancelOption(uint256 time,uint256 penalty)\\\");\\n\\n bytes32 public constant OFFER_TYPE_HASH =\\n keccak256(\\n // solhint-disable-next-line max-line-length\\n \\\"Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn)\\\"\\n );\\n\\n bytes32 public constant CHECK_IN_TYPE_HASH =\\n keccak256(\\\"Voucher(bytes32 id,address signer)\\\");\\n\\n /// Errors\\n\\n /// @dev Thrown when percents value greater than 100\\n error InvalidPercent();\\n\\n /// Data structures\\n\\n /**\\n * @dev Payment option\\n * @param id Unique ID of the payment option\\n * @param price The price of the asset in wei\\n * @param asset The address of the ERC20 token used for payment\\n */\\n struct PaymentOption {\\n bytes32 id;\\n uint256 price;\\n address asset;\\n }\\n\\n /**\\n * @dev Deal cancellation option\\n * @param time The number of seconds before checkIn\\n * @param penalty The percentage of the total sum to be paid as a penalty if the deal is cancelled\\n */\\n struct CancelOption {\\n uint256 time;\\n uint256 penalty;\\n }\\n\\n /**\\n * @dev Offer payload\\n * @param id The unique ID of the offer\\n * @param expire The time when the offer expires (in seconds since the Unix epoch)\\n * @param supplierId The unique ID of the supplier offering the deal\\n * @param chainId The ID of the network chain where the deal is to be executed\\n * @param requestHash The hash of the request made by the buyer\\n * @param optionsHash The hash of the payment and cancellation options for the deal\\n * @param paymentHash The hash of the payment option used for the deal\\n * @param cancelHash The hash of the cancellation option used for the deal\\n * @param transferable Indicates whether the deal NFT is transferable or not\\n * @param checkIn The check-in time for the deal (in seconds since the Unix epoch)\\n * @param checkOut The check-out time for the deal (in seconds since the Unix epoch)\\n */\\n struct Offer {\\n bytes32 id;\\n uint256 expire;\\n bytes32 supplierId;\\n uint256 chainId;\\n bytes32 requestHash;\\n bytes32 optionsHash;\\n bytes32 paymentHash;\\n bytes32 cancelHash;\\n bool transferable;\\n uint256 checkIn;\\n uint256 checkOut;\\n }\\n\\n /**\\n * @dev Deal status\\n */\\n enum DealStatus {\\n Created, // Just created\\n Claimed, // Claimed by the supplier\\n Rejected, // Rejected by the supplier\\n Refunded, // Refunded by the supplier\\n Cancelled, // Cancelled by the buyer\\n CheckedIn, // Checked In\\n CheckedOut, // Checked Out\\n Disputed // Dispute started\\n }\\n\\n /**\\n * @dev Deal storage struct\\n * @param offer Offer payload\\n * @param price Deal price\\n * @param asset Deal asset\\n * @param status Current deal status\\n */\\n struct Deal {\\n uint256 created;\\n Offer offer;\\n bytes32 retailerId;\\n address buyer;\\n uint256 price;\\n address asset;\\n DealStatus status;\\n }\\n\\n /// @dev Create a has of bytes32 array\\n function hash(bytes32[] memory _hashes) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_hashes));\\n }\\n\\n /// @dev Creates a hash of a PaymentOption\\n function hash(\\n PaymentOption memory _paymentOptions\\n ) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(\\n PAYMENT_OPTION_TYPE_HASH,\\n _paymentOptions.id,\\n _paymentOptions.price,\\n _paymentOptions.asset\\n )\\n );\\n }\\n\\n /// @dev Creates a hash of a CancelOption\\n function hash(CancelOption memory _cancel) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(CANCEL_OPTION_TYPE_HASH, _cancel.time, _cancel.penalty)\\n );\\n }\\n\\n /// @dev Creates a hash of an array of PaymentOption\\n function hash(\\n PaymentOption[] memory _paymentOptions\\n ) internal pure returns (bytes32) {\\n bytes32[] memory hashes = new bytes32[](_paymentOptions.length);\\n\\n for (uint256 i = 0; i < _paymentOptions.length; i++) {\\n hashes[i] = hash(_paymentOptions[i]);\\n }\\n\\n return hash(hashes);\\n }\\n\\n /// @dev Creates a hash of an array of CancelOption\\n function hash(\\n CancelOption[] memory _cancelOptions\\n ) internal pure returns (bytes32) {\\n bytes32[] memory hashes = new bytes32[](_cancelOptions.length);\\n\\n for (uint256 i = 0; i < _cancelOptions.length; i++) {\\n hashes[i] = hash(_cancelOptions[i]);\\n }\\n\\n return hash(hashes);\\n }\\n\\n /// @dev Creates a hash of an Offer\\n function hash(Offer memory _offer) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n OFFER_TYPE_HASH,\\n _offer.id,\\n _offer.expire,\\n _offer.supplierId,\\n _offer.chainId,\\n _offer.requestHash,\\n _offer.optionsHash,\\n _offer.paymentHash,\\n _offer.cancelHash,\\n _offer.transferable,\\n _offer.checkIn\\n )\\n );\\n }\\n\\n /// @dev Create a hash of check-in data\\n function hashCheckInOut(\\n bytes32 _id,\\n address _signer\\n ) internal pure returns (bytes32) {\\n return keccak256(abi.encode(CHECK_IN_TYPE_HASH, _id, _signer));\\n }\\n\\n /// @dev Calculates percentage value\\n function _percentage(\\n uint256 value,\\n uint256 percent\\n ) internal pure returns (uint256) {\\n if (percent > 100) {\\n revert InvalidPercent();\\n }\\n return value.mul(1000).mul(percent).div(100).div(1000);\\n }\\n}\\n\",\"keccak256\":\"0x2b3bf72ed636a28916f2691624d92f815ae0d3bcdf7fde15e9af30ca93967511\",\"license\":\"MIT\"},\"contracts/utils/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\n/// @dev Simple ERC20 token interface\\ninterface IERC20 {\\n function decimals() external view returns (uint256);\\n\\n function transfer(address, uint256) external returns (bool);\\n\\n function transferFrom(address, address, uint256) external returns (bool);\\n\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\",\"keccak256\":\"0x1ad28279394506573ea860d0d680098c6716a0874ad0ec0475fec44b4f4d3d0f\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6159a680620000f46000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c806370a0823111610130578063aaf741e4116100b8578063d2d849761161007c578063d2d849761461059c578063d56f7bcc146105af578063e985e9c5146105c2578063f2ca5dc5146105fe578063f2fde38b1461061157600080fd5b8063aaf741e414610521578063b88d4fde14610542578063bd66528a14610555578063c87b56dd14610568578063ca0345271461057b57600080fd5b806381cd872a116100ff57806381cd872a146104005780638456cb59146104ec5780638da5cb5b146104f457806395d89b4114610506578063a22cb4651461050e57600080fd5b806370a08231146103be578063715018a6146103d15780637249fbb6146103d957806379502c55146103ec57600080fd5b806320e3dbd4116101be57806342842e0e1161018257806342842e0e146103675780634f6ccce71461037a5780635c975abb1461038d5780636352211e146103985780636cf1dbed146103ab57600080fd5b806320e3dbd41461031357806323b872dd146103265780632f745c59146103395780633f4ba83a1461034c5780634246c1b71461035457600080fd5b806308122cc71161020557806308122cc71461029c578063081812fc146102af578063095ea7b3146102da5780631615fd03146102ed57806318160ddd1461030157600080fd5b806301ffc9a714610237578063042bc95b1461025f57806304f999c71461027457806306fdde0314610287575b600080fd5b61024a610245366004614beb565b610624565b60405190151581526020015b60405180910390f35b61027261026d366004614cde565b610635565b005b610272610282366004614da3565b610cfc565b61028f611046565b6040516102569190614e15565b6102726102aa366004614e28565b6110d8565b6102c26102bd366004614e28565b611813565b6040516001600160a01b039091168152602001610256565b6102726102e8366004614e56565b61183a565b610163546102c2906001600160a01b031681565b60cd545b604051908152602001610256565b610272610321366004614e82565b611954565b610272610334366004614e9f565b6119c7565b610305610347366004614e56565b6119f9565b610272611a8f565b610272610362366004614fd9565b611aa1565b610272610375366004614e9f565b611ede565b610305610388366004614e28565b611ef9565b60fd5460ff1661024a565b6102c26103a6366004614e28565b611f8c565b6102726103b936600461501f565b611fec565b6103056103cc366004614e82565b612156565b6102726121dc565b6102726103e7366004614e28565b6121ee565b610162546102c2906001600160a01b031681565b6104d961040e366004614e28565b610165602090815260009182526040918290208054835161016081018552600183015481526002830154938101939093526003820154938301939093526004810154606083015260058101546080830152600681015460a0830152600781015460c0830152600881015460e0830152600981015460ff9081161515610100840152600a820154610120840152600b820154610140840152600c820154600d830154600e840154600f9094015491936001600160a01b0391821693909291821691600160a01b90041687565b60405161025697969594939291906150f4565b610272612537565b61012f546001600160a01b03166102c2565b61028f612547565b61027261051c3660046151df565b612556565b61030561052f366004614e28565b6101996020526000908152604090205481565b610272610550366004615218565b612565565b610272610563366004614e28565b61259d565b61028f610576366004614e28565b612864565b610305610589366004614e28565b6101986020526000908152604090205481565b6102726105aa366004614e82565b612883565b6102726105bd366004615320565b6128f6565b61024a6105d036600461542e565b6001600160a01b039182166000908152609e6020908152604080832093909416825291909152205460ff1690565b61030561060c366004614e28565b61300d565b61027261061f366004614e82565b61302c565b600061062f826130a5565b92915050565b6000828152610165602052604090206001015482906106675760405163223da47360e21b815260040160405180910390fd5b6518d85b98d95b60d21b60005261016460209081527f81062d4f7ca92921b22616119900c96f98bed102c24746a50196946c312490ea8054604080518285028101850190915281815286939092919083018282801561071557602002820191906000526020600020906000905b82829054906101000a900460ff1660078111156106f3576106f36150bc565b8152602060019283018181049485019490930390920291018084116106d45790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156107a2578381815181106107575761075761545c565b60200260200101516007811115610770576107706150bc565b826007811115610782576107826150bc565b0361079057600192506107a2565b8061079a81615488565b91505061073c565b50816001146107c457604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600d8101543391906001600160a01b03168214610803576040516308ffd32360e41b815260040160405180910390fd5b61016254604051630bb2c35960e21b81526b18db185a5b57dc195c9a5bd960a21b6004820152610889916001600160a01b031690632ecb0d6490602401602060405180830381865afa15801561085d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088191906154a1565b8254906130ca565b4210156108a95760405163e340eb8560e01b815260040160405180910390fd5b600f8101805460ff60a01b198116600160a21b17909155600160a01b900460ff166108d38a6130dd565b60008160078111156108e7576108e76150bc565b0361099157600f820154600d830154600e84015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af115801561094b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f91906154ba565b61098c5760405163244743ff60e01b815260040160405180910390fd5b610cbd565b60018160078111156109a5576109a56150bc565b1480156109b55750600a82015442105b15610ca4576109c3896130e5565b6008830154146109e65760405163b124e96f60e01b815260040160405180910390fd5b60008060005b8b51811015610a9e578b8181518110610a0757610a0761545c565b6020026020010151600001514210158015610a465750821580610a465750828c8281518110610a3857610a3861545c565b602002602001015160000151105b15610a8c578b8181518110610a5d57610a5d61545c565b60200260200101516000015192508b8181518110610a7d57610a7d61545c565b60200260200101516020015191505b80610a9681615488565b9150506109ec565b506064811115610aac575060645b6000610abc85600e015483613194565b600f860154600d870154600e8801549293506001600160a01b039182169263a9059cbb9290911690610aee90856131db565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d91906154ba565b610b7a5760405163244743ff60e01b815260040160405180910390fd5b600081118015610c7e5750600f8501546101635460038701546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0691906154d7565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610c58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7c91906154ba565b155b15610c9c5760405163244743ff60e01b815260040160405180910390fd5b505050610cbd565b604051632adde06f60e21b815260040160405180910390fd5b6000805160206159518339815191528a600485604051610cdf9392919061555e565b60405180910390a1610cf08a6131e7565b50505050505050505050565b600082815261016560205260409020600101548290610d2e5760405163223da47360e21b815260040160405180910390fd5b6101635460008481526101656020526040908190206003015490516329db379b60e11b8152600481019190915284916001600160a01b0316906353b66f369060240160a060405180830381865afa158015610d8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db191906154d7565b608001516001600160a01b0316336001600160a01b031614610de6576040516308ffd32360e41b815260040160405180910390fd5b651c995a9958dd60d21b60005261016460209081527fc46af9fb757a5392b04e96a191cee5d6fe9386d767a56a820e480e8cd4dd9fd980546040805182850281018501909152818152879390929190830182828015610e9457602002820191906000526020600020906000905b82829054906101000a900460ff166007811115610e7257610e726150bc565b815260206001928301818104948501949093039092029101808411610e535790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015610f2157838181518110610ed657610ed661545c565b60200260200101516007811115610eef57610eef6150bc565b826007811115610f0157610f016150bc565b03610f0f5760019250610f21565b80610f1981615488565b915050610ebb565b5081600114610f4357604051632adde06f60e21b815260040160405180910390fd5b600088815261016560205260409020600f8101805460ff60a01b1916600160a11b179055610f718989613231565b600f810154600d820154600e83015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff491906154ba565b6110115760405163244743ff60e01b815260040160405180910390fd5b600080516020615951833981519152896002336040516110339392919061555e565b60405180910390a1505050505050505050565b6060609980546110559061558b565b80601f01602080910402602001604051908101604052809291908181526020018280546110819061558b565b80156110ce5780601f106110a3576101008083540402835291602001916110ce565b820191906000526020600020905b8154815290600101906020018083116110b157829003601f168201915b5050505050905090565b60008181526101656020526040902060010154819061110a5760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa158015611169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118d91906154d7565b608001516001600160a01b0316336001600160a01b0316146111c2576040516308ffd32360e41b815260040160405180910390fd5b6718da1958dad3dd5d60c21b60005261016460209081527fc1dd3999e8023eaa9ce335ac20c9f0911c06155bdf47040ab8df5eebc20004ba8054604080518285028101850190915281815286939092919083018282801561127257602002820191906000526020600020906000905b82829054906101000a900460ff166007811115611250576112506150bc565b8152602060019283018181049485019490930390920291018084116112315790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156112ff578381815181106112b4576112b461545c565b602002602001015160078111156112cd576112cd6150bc565b8260078111156112df576112df6150bc565b036112ed57600192506112ff565b806112f781615488565b915050611299565b508160011461132157604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600b8101544210156113555760405163e340eb8560e01b815260040160405180910390fd5b600f8101805460ff60a01b1916600360a11b179055611373886130dd565b600e81015461016254604051630bb2c35960e21b81526b70726f746f636f6c5f66656560a01b60048201526000928392839261140492916001600160a01b031690632ecb0d64906024015b602060405180830381865afa1580156113db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ff91906154a1565b613194565b600c8501549093501561145c57600e84015461016254604051630bb2c35960e21b81526b72657461696c65725f66656560a01b600482015261145992916001600160a01b031690632ecb0d64906024016113be565b91505b61147d826114778587600e01546131db90919063ffffffff16565b906131db565b90506000831180156115875750600f840154610162546040516321f8a72160e01b81526c19995957dc9958da5c1a595b9d609a1b60048201526001600160a01b039283169263a9059cbb9216906321f8a72190602401602060405180830381865afa1580156114f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151491906155c5565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018690526044016020604051808303816000875af1158015611561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158591906154ba565b155b156115a55760405163244743ff60e01b815260040160405180910390fd5b6000821180156116a95750600f84015461016354600c8601546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa15801561160d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163191906154d7565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af1158015611683573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a791906154ba565b155b156116c75760405163244743ff60e01b815260040160405180910390fd5b600f8401546101635460038601546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa158015611724573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174891906154d7565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af115801561179a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117be91906154ba565b6117db5760405163244743ff60e01b815260040160405180910390fd5b6000805160206159518339815191528b6006336040516117fd9392919061555e565b60405180910390a15b5050505050505050505050565b600061181e82613239565b506000908152609d60205260409020546001600160a01b031690565b600061184582611f8c565b9050806001600160a01b0316836001600160a01b0316036118b75760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806118d357506118d381336105d0565b6119455760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016118ae565b61194f8383613298565b505050565b61195c613306565b61016254604080516001600160a01b03928316815291831660208301527fbd7986d31c086d8cc2901a1c41d1edc0af6e8a7a5c6fc1b8283919c1b2122c38910160405180910390a161016280546001600160a01b0319166001600160a01b0392909216919091179055565b6119d2335b82613361565b6119ee5760405162461bcd60e51b81526004016118ae906155e2565b61194f8383836133e0565b6000611a0483612156565b8210611a665760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016118ae565b506001600160a01b0391909116600090815260cb60209081526040808320938352929052205490565b611a97613306565b611a9f613551565b565b600082815261016560205260409020600101548290611ad35760405163223da47360e21b815260040160405180910390fd5b6631b432b1b5a4b760c91b60005261016460209081527fc78e0758b723b136c59844f7da34685e7f27894489b1657d97b9b8e3e8e19ced80546040805182850281018501909152818152869390929190830182828015611b8257602002820191906000526020600020906000905b82829054906101000a900460ff166007811115611b6057611b606150bc565b815260206001928301818104948501949093039092029101808411611b415790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015611c0f57838181518110611bc457611bc461545c565b60200260200101516007811115611bdd57611bdd6150bc565b826007811115611bef57611bef6150bc565b03611bfd5760019250611c0f565b80611c0781615488565b915050611ba9565b5081600114611c3157604051632adde06f60e21b815260040160405180910390fd5b6000878152610165602052604080822061016354600382015492516329db379b60e11b81529193926001600160a01b03909116916353b66f3691611c7b9160040190815260200190565b60a060405180830381865afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc91906154d7565b608081015190915033906000906001600160a01b03168203611dd757611cf5611cf0856001016000015485608001516135a3565b613607565b9050611d33818b600081518110611d0e57611d0e61545c565b602002602001015185608001516001600160a01b031661361a9092919063ffffffff16565b611d505760405163a2fb840f60e01b815260040160405180910390fd5b600a840154421015611dd2576001840154600d850154611d7c91611cf0916001600160a01b03166135a3565b9050611db5818b600181518110611d9557611d9561545c565b6020908102919091010151600d8701546001600160a01b0316919061361a565b611dd25760405163a2fb840f60e01b815260040160405180910390fd5b611e8f565b600d8401546001600160a01b0390811690831603611e76576001840154600d850154611e0f91611cf0916001600160a01b03166135a3565b9050611e28818b600081518110611d9557611d9561545c565b611e455760405163a2fb840f60e01b815260040160405180910390fd5b611e5d611cf0856001016000015485608001516135a3565b9050611db5818b600181518110611d0e57611d0e61545c565b6040516308ffd32360e41b815260040160405180910390fd5b611e998b8b613231565b600f8401805460ff60a01b1916600560a01b17905560405160008051602061595183398151915290611ed1908d90600590869061555e565b60405180910390a1611806565b61194f83838360405180602001604052806000815250612565565b6000611f0460cd5490565b8210611f675760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016118ae565b60cd8281548110611f7a57611f7a61545c565b90600052602060002001549050919050565b6000818152609b60205260408120546001600160a01b03168061062f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016118ae565b600054610100900460ff161580801561200c5750600054600160ff909116105b806120265750303b158015612026575060005460ff166001145b6120895760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016118ae565b6000805460ff1916600117905580156120ac576000805461ff0019166101001790555b6120b58661375c565b6120fc604051806040016040528060098152602001682232b0b62a37b5b2b760b91b815250604051806040016040528060048152602001631111505360e21b8152506137af565b612108858585856137f0565b801561214e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006001600160a01b0382166121c05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016118ae565b506001600160a01b03166000908152609c602052604090205490565b6121e4613306565b611a9f600061375c565b6000818152610165602052604090206001015481906122205760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa15801561227f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a391906154d7565b608001516001600160a01b0316336001600160a01b0316146122d8576040516308ffd32360e41b815260040160405180910390fd5b651c99599d5b9960d21b60005261016460209081527f07a4462434a8663ef8cbef768cea3239b3345cd5f028a224e47a7db4a71138368054604080518285028101850190915281815286939092919083018282801561238657602002820191906000526020600020906000905b82829054906101000a900460ff166007811115612364576123646150bc565b8152602060019283018181049485019490930390920291018084116123455790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015612413578381815181106123c8576123c861545c565b602002602001015160078111156123e1576123e16150bc565b8260078111156123f3576123f36150bc565b036124015760019250612413565b8061240b81615488565b9150506123ad565b508160011461243557604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600f8101805460ff60a01b1916600360a01b179055612462886130dd565b600f810154600d820154600e83015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156124c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e591906154ba565b6125025760405163244743ff60e01b815260040160405180910390fd5b600080516020615951833981519152886003336040516125249392919061555e565b60405180910390a15b5050505050505050565b61253f613306565b611a9f613aad565b6060609a80546110559061558b565b612561338383613aea565b5050565b61256f3383613361565b61258b5760405162461bcd60e51b81526004016118ae906155e2565b61259784848484613bb8565b50505050565b6000818152610165602052604090206001015481906125cf5760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa15801561262e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265291906154d7565b608001516001600160a01b0316336001600160a01b031614612687576040516308ffd32360e41b815260040160405180910390fd5b64636c61696d60d81b60005261016460209081527f8fded9216611b5e46bf52fe515d6ddc32059da80463e1a4891e5dc68d5c1a8a88054604080518285028101850190915281815286939092919083018282801561273457602002820191906000526020600020906000905b82829054906101000a900460ff166007811115612712576127126150bc565b8152602060019283018181049485019490930390920291018084116126f35790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156127c1578381815181106127765761277661545c565b6020026020010151600781111561278f5761278f6150bc565b8260078111156127a1576127a16150bc565b036127af57600192506127c1565b806127b981615488565b91505061275b565b50816001146127e357604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600d81015461280b9089906001600160a01b0316613231565b600f8101805460ff60a01b1916600160a01b17905560405160008051602061595183398151915290612843908a90600190339061555e565b60405180910390a1600d81015461252d9089906001600160a01b0316613beb565b606061286f82613239565b505060408051602081019091526000815290565b61288b613306565b61016354604080516001600160a01b03928316815291831660208301527fb468923d3f8581bd45345fed844c850e4c681b7170a99d4b47a7f92f66e226d2910160405180910390a161016380546001600160a01b0319166001600160a01b0392909216919091179055565b336000612905611cf088613c1f565b610163546040808a015190516329db379b60e11b81529293506000926001600160a01b03909216916353b66f36916129439160040190815260200190565b60a060405180830381865afa158015612960573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298491906154d7565b90506129c2828560008151811061299d5761299d61545c565b602002602001015183608001516001600160a01b031661361a9092919063ffffffff16565b6129df5760405163a2fb840f60e01b815260040160405180910390fd5b610163546040808a0151905163a241f54d60e01b81526001600160a01b039092169163a241f54d91612a179160040190815260200190565b602060405180830381865afa158015612a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5891906154ba565b612a755760405163e1040adb60e01b815260040160405180910390fd5b8415612ba557610163546040516329db379b60e11b8152600481018790526000916001600160a01b0316906353b66f369060240160a060405180830381865afa158015612ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aea91906154d7565b60408101519091506001600160a01b0316612b18576040516301e8b0f960e51b815260040160405180910390fd5b6101635460405163a241f54d60e01b8152600481018890526001600160a01b039091169063a241f54d90602401602060405180830381865afa158015612b62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8691906154ba565b612ba357604051630620118d60e51b815260040160405180910390fd5b505b87516000818152610165602052604090206001015403612bd857604051635d341dcb60e11b815260040160405180910390fd5b6000612be388613cf8565b90508860c001518114612c09576040516304b1ffc560e51b815260040160405180910390fd5b50505060008060005b8751811015612c965786888281518110612c2e57612c2e61545c565b60200260200101516000015103612c8457878181518110612c5157612c5161545c565b6020026020010151602001519250878181518110612c7157612c7161545c565b6020026020010151604001519150612c96565b80612c8e81615488565b915050612c12565b506001600160a01b038116612cbe57604051632c46fa3160e21b815260040160405180910390fd5b612cca88838387613d9d565b87516000818152610165602052604090206001015403612cfd5760405163a00179fd60e01b815260040160405180910390fd5b6040518060e00160405280428152602001898152602001868152602001846001600160a01b03168152602001838152602001826001600160a01b0316815260200160006007811115612d5157612d516150bc565b90528851600090815261016560209081526040918290208351815583820151805160018301559182015160028201558183015160038201556060808301516004830155608080840151600584015560a080850151600685015560c08086015160078087019190915560e0870151600887015561010087015160098701805491151560ff19909216919091179055610120870151600a87015561014090960151600b86015595870151600c85015591860151600d840180546001600160a01b039283166001600160a01b03199182161790915591870151600e85015591860151600f840180549190931691811682178355948601519294929391926001600160a81b0319161790600160a01b908490811115612e6e57612e6e6150bc565b0217905550905050600184511115612f40576000806000612ea887600181518110612e9b57612e9b61545c565b6020026020010151613db1565b60208e015160405163d505accf60e01b81526001600160a01b038b81166004830152306024830152604482018b9052606482019290925260ff8516608482015260a4810184905260c48101839052939650919450925085169063d505accf9060e401600060405180830381600087803b158015612f2457600080fd5b505af1158015612f38573d6000803e3d6000fd5b505050505050505b6040516323b872dd60e01b81526001600160a01b038481166004830152306024830152604482018490528216906323b872dd906064016020604051808303816000875af1158015612f95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb991906154ba565b612fd65760405163244743ff60e01b815260040160405180910390fd5b875160405160008051602061595183398151915291612ff991600090879061555e565b60405180910390a161252d88838387613e12565b600061301882613239565b506000908152610198602052604090205490565b613034613306565b6001600160a01b0381166130995760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016118ae565b6130a28161375c565b50565b60006001600160e01b0319821663780e9d6360e01b148061062f575061062f82613e17565b60006130d6828461562f565b9392505050565b6130a2613e67565b60008082516001600160401b0381111561310157613101614c08565b60405190808252806020026020018201604052801561312a578160200160208202803683370190505b50905060005b835181101561318a5761315b84828151811061314e5761314e61545c565b6020026020010151613ead565b82828151811061316d5761316d61545c565b60209081029190910101528061318281615488565b915050613130565b506130d681613efa565b600060648211156131b857604051635c974e3d60e11b815260040160405180910390fd5b6130d66103e86131d5606481866131cf8986613f0d565b90613f0d565b90613f19565b60006130d68284615642565b6000818152610199602052604090205480156132285761320681613f25565b6000818152610198602090815260408083208390558483526101999091528120555b612561826130dd565b612561613e67565b6000818152609b60205260409020546001600160a01b03166130a25760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016118ae565b6000818152609d6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906132cd82611f8c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b61012f546001600160a01b03163314611a9f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016118ae565b60008061336d83611f8c565b9050806001600160a01b0316846001600160a01b031614806133b457506001600160a01b038082166000908152609e602090815260408083209388168352929052205460ff165b806133d85750836001600160a01b03166133cd84611813565b6001600160a01b0316145b949350505050565b826001600160a01b03166133f382611f8c565b6001600160a01b0316146134195760405162461bcd60e51b81526004016118ae90615655565b6001600160a01b03821661347b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016118ae565b6134888383836001613f53565b826001600160a01b031661349b82611f8c565b6001600160a01b0316146134c15760405162461bcd60e51b81526004016118ae90615655565b6000818152609d6020908152604080832080546001600160a01b03199081169091556001600160a01b03878116808652609c8552838620805460001901905590871680865283862080546001019055868652609b90945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b613559614039565b60fd805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080517ff811d7f3ddb148410001929e2cbfb7fea8779b9349b7c2f650fa91840528d69c60208201529081018390526001600160a01b03821660608201526000906080015b60405160208183030381529060405280519060200120905092915050565b600061062f613614614082565b83614102565b60008060006136298585614129565b90925090506000816004811115613642576136426150bc565b1480156136605750856001600160a01b0316826001600160a01b0316145b15613670576001925050506130d6565b600080876001600160a01b0316631626ba7e60e01b888860405160240161369892919061569a565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516136d691906156b3565b600060405180830381855afa9150503d8060008114613711576040519150601f19603f3d011682016040523d82523d6000602084013e613716565b606091505b5091509150818015613729575080516020145b801561375057508051630b135d3f60e11b9061374e90830160209081019084016154a1565b145b98975050505050505050565b61012f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166137d65760405162461bcd60e51b81526004016118ae906156cf565b6137e0828261416e565b6137e861419f565b6125616141c6565b600054610100900460ff166138175760405162461bcd60e51b81526004016118ae906156cf565b61382184846141f5565b6138296141c6565b61016280546001600160a01b038481166001600160a01b03199283161790925561016380549284169290911691909117905560408051602081019091528060009052651c995a9958dd60d21b6000526101646020526138ab907fc46af9fb757a5392b04e96a191cee5d6fe9386d767a56a820e480e8cd4dd9fd9906001614a97565b50604080518082019091528060008152602001600190526518d85b98d95b60d21b600052610164602052613902907f81062d4f7ca92921b22616119900c96f98bed102c24746a50196946c312490ea906002614b4b565b5060408051808201909152806001815260200160059052651c99599d5b9960d21b600052610164602052613959907f07a4462434a8663ef8cbef768cea3239b3345cd5f028a224e47a7db4a7113836906002614b4b565b506040805160208101909152806000905264636c61696d60d81b6000526101646020526139a9907f8fded9216611b5e46bf52fe515d6ddc32059da80463e1a4891e5dc68d5c1a8a8906001614a97565b50604080516020810190915280600190526631b432b1b5a4b760c91b6000526101646020526139fb907fc78e0758b723b136c59844f7da34685e7f27894489b1657d97b9b8e3e8e19ced906001614a97565b50604080516020810190915280600590526718da1958dad3dd5d60c21b600052610164602052613a4e907fc1dd3999e8023eaa9ce335ac20c9f0911c06155bdf47040ab8df5eebc20004ba906001614a97565b5060408051808201909152806005815260200160069052666469737075746560c81b600052610164602052613aa6907f755971b5036353f540d427876647973a20fcd901626978bb47564e1a4a28b6d4906002614b4b565b5050505050565b613ab5613e67565b60fd805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135863390565b816001600160a01b0316836001600160a01b031603613b4b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016118ae565b6001600160a01b038381166000818152609e6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613bc38484846133e0565b613bcf84848484614226565b6125975760405162461bcd60e51b81526004016118ae9061571a565b6000613bf682614327565b600081815261019860209081526040808320879055958252610199905293909320929092555050565b60007fcf2addd2f89a78825d3f130a17e47b4e9963adfd09837fa9c454569faa073354826000015183602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b6101200151604051602001613cdb9b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935260a087019190915260c086015260e085015261010084015215156101208301526101408201526101600190565b604051602081830303815290604052805190602001209050919050565b60008082516001600160401b03811115613d1457613d14614c08565b604051908082528060200260200182016040528015613d3d578160200160208202803683370190505b50905060005b835181101561318a57613d6e848281518110613d6157613d6161545c565b602002602001015161434f565b828281518110613d8057613d8061545c565b602090810291909101015280613d9581615488565b915050613d43565b613da5613e67565b612597848484846143bd565b60008060008351604103613df25750505060208101516040820151606083015160001a919082613de057601b92505b60018303613ded57601c92505b613e0b565b604051638baa579f60e01b815260040160405180910390fd5b9193909250565b612597565b60006001600160e01b031982166380ac58cd60e01b1480613e4857506001600160e01b03198216635b5e139f60e01b145b8061062f57506301ffc9a760e01b6001600160e01b031983161461062f565b60fd5460ff1615611a9f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016118ae565b8051602080830151604051600093613cdb937f8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5939192019283526020830191909152604082015260600190565b600081604051602001613cdb919061576c565b60006130d682846157a2565b60006130d682846157b9565b613f2e336119cc565b613f4a5760405162461bcd60e51b81526004016118ae906155e2565b6130a2816143c5565b613f5b613e67565b6001600160a01b03841615801590613f7b57506001600160a01b03831615155b1561402d576000828152610198602052604090205480613fae5760405163223da47360e21b815260040160405180910390fd5b600081815261016560205260409020600981015460ff161580613ff157506001600f820154600160a01b900460ff166007811115613fee57613fee6150bc565b14155b1561400f5760405163ca7cbc7760e01b815260040160405180910390fd5b600d0180546001600160a01b0319166001600160a01b038616179055505b61259784848484614468565b60fd5460ff16611a9f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016118ae565b60006140fd7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6140b160015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b905090565b60405161190160f01b602082015260228101839052604281018290526000906062016135e9565b600080825160410361415f5760208301516040840151606085015160001a6141538782858561447c565b94509450505050614167565b506000905060025b9250929050565b600054610100900460ff166141955760405162461bcd60e51b81526004016118ae906156cf565b6125618282614540565b600054610100900460ff16611a9f5760405162461bcd60e51b81526004016118ae906156cf565b600054610100900460ff166141ed5760405162461bcd60e51b81526004016118ae906156cf565b611a9f614580565b600054610100900460ff1661421c5760405162461bcd60e51b81526004016118ae906156cf565b61256182826145b3565b60006001600160a01b0384163b1561431c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061426a9033908990889088906004016157db565b6020604051808303816000875af19250505080156142a5575060408051601f3d908101601f191682019092526142a291810190615818565b60015b614302573d8080156142d3576040519150601f19603f3d011682016040523d82523d6000602084013e6142d8565b606091505b5080516000036142fa5760405162461bcd60e51b81526004016118ae9061571a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506133d8565b506001949350505050565b6000806143346101615490565b905061434561016180546001019055565b61062f83826145f4565b60007f2f8fc0b3ad3f58f6deb367673d38e4112a3c8c64de033c5b780b84ef8f67cde6826000015183602001518460400151604051602001613cdb949392919093845260208401929092526040830152606090811b6bffffffffffffffffffffffff19169082015260740190565b612597613e67565b60006143d082611f8c565b90506143e0816000846001613f53565b6143e982611f8c565b6000838152609d6020908152604080832080546001600160a01b03199081169091556001600160a01b038516808552609c84528285208054600019019055878552609b909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b614470613e67565b6125978484848461460e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156144b35750600090506003614537565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614507573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661453057600060019250925050614537565b9150600090505b94509492505050565b600054610100900460ff166145675760405162461bcd60e51b81526004016118ae906156cf565b6099614573838261587b565b50609a61194f828261587b565b600054610100900460ff166145a75760405162461bcd60e51b81526004016118ae906156cf565b60fd805460ff19169055565b600054610100900460ff166145da5760405162461bcd60e51b81526004016118ae906156cf565b815160209283012081519190920120600191909155600255565b61256182826040518060200160405280600081525061473b565b600181111561467d5760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b60648201526084016118ae565b816001600160a01b0385166146d9576146d48160cd8054600083815260ce60205260408120829055600182018355919091527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0155565b6146fc565b836001600160a01b0316856001600160a01b0316146146fc576146fc858261476e565b6001600160a01b038416614718576147138161480b565b613aa6565b846001600160a01b0316846001600160a01b031614613aa657613aa684826148ba565b61474583836148fe565b6147526000848484614226565b61194f5760405162461bcd60e51b81526004016118ae9061571a565b6000600161477b84612156565b6147859190615642565b600083815260cc60205260409020549091508082146147d8576001600160a01b038416600090815260cb60209081526040808320858452825280832054848452818420819055835260cc90915290208190555b50600091825260cc602090815260408084208490556001600160a01b03909416835260cb81528383209183525290812055565b60cd5460009061481d90600190615642565b600083815260ce602052604081205460cd80549394509092849081106148455761484561545c565b906000526020600020015490508060cd83815481106148665761486661545c565b600091825260208083209091019290925582815260ce909152604080822084905585825281205560cd80548061489e5761489e61593a565b6001900381819060005260206000200160009055905550505050565b60006148c583612156565b6001600160a01b03909316600090815260cb60209081526040808320868452825280832085905593825260cc9052919091209190915550565b6001600160a01b0382166149545760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016118ae565b6000818152609b60205260409020546001600160a01b0316156149b95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016118ae565b6149c7600083836001613f53565b6000818152609b60205260409020546001600160a01b031615614a2c5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016118ae565b6001600160a01b0382166000818152609c6020908152604080832080546001019055848352609b90915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b82805482825590600052602060002090601f01602090048101928215614b3b5791602002820160005b83821115614b0c57835183826101000a81548160ff02191690836007811115614aeb57614aeb6150bc565b02179055509260200192600101602081600001049283019260010302614ac0565b8015614b395782816101000a81549060ff0219169055600101602081600001049283019260010302614b0c565b505b50614b47929150614bc0565b5090565b82805482825590600052602060002090601f01602090048101928215614b3b5791602002820160005b83821115614b0c57835183826101000a81548160ff02191690836007811115614b9f57614b9f6150bc565b02179055509260200192600101602081600001049283019260010302614b74565b5b80821115614b475760008155600101614bc1565b6001600160e01b0319811681146130a257600080fd5b600060208284031215614bfd57600080fd5b81356130d681614bd5565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614c4057614c40614c08565b60405290565b604051606081016001600160401b0381118282101715614c4057614c40614c08565b60405161016081016001600160401b0381118282101715614c4057614c40614c08565b604051601f8201601f191681016001600160401b0381118282101715614cb357614cb3614c08565b604052919050565b60006001600160401b03821115614cd457614cd4614c08565b5060051b60200190565b6000806040808486031215614cf257600080fd5b833592506020808501356001600160401b03811115614d1057600080fd5b8501601f81018713614d2157600080fd5b8035614d34614d2f82614cbb565b614c8b565b81815260069190911b82018301908381019089831115614d5357600080fd5b928401925b82841015614d935785848b031215614d705760008081fd5b614d78614c1e565b84358152858501358682015282529285019290840190614d58565b8096505050505050509250929050565b60008060408385031215614db657600080fd5b50508035926020909101359150565b60005b83811015614de0578181015183820152602001614dc8565b50506000910152565b60008151808452614e01816020860160208601614dc5565b601f01601f19169290920160200192915050565b6020815260006130d66020830184614de9565b600060208284031215614e3a57600080fd5b5035919050565b6001600160a01b03811681146130a257600080fd5b60008060408385031215614e6957600080fd5b8235614e7481614e41565b946020939093013593505050565b600060208284031215614e9457600080fd5b81356130d681614e41565b600080600060608486031215614eb457600080fd5b8335614ebf81614e41565b92506020840135614ecf81614e41565b929592945050506040919091013590565b600082601f830112614ef157600080fd5b81356001600160401b03811115614f0a57614f0a614c08565b614f1d601f8201601f1916602001614c8b565b818152846020838601011115614f3257600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614f6057600080fd5b81356020614f70614d2f83614cbb565b82815260059290921b84018101918181019086841115614f8f57600080fd5b8286015b84811015614fce5780356001600160401b03811115614fb25760008081fd5b614fc08986838b0101614ee0565b845250918301918301614f93565b509695505050505050565b60008060408385031215614fec57600080fd5b8235915060208301356001600160401b0381111561500957600080fd5b61501585828601614f4f565b9150509250929050565b600080600080600060a0868803121561503757600080fd5b853561504281614e41565b945060208601356001600160401b038082111561505e57600080fd5b61506a89838a01614ee0565b9550604088013591508082111561508057600080fd5b5061508d88828901614ee0565b935050606086013561509e81614e41565b915060808601356150ae81614e41565b809150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600881106150f057634e487b7160e01b600052602160045260246000fd5b9052565b60006102208201905088825287516020830152602088015160408301526040880151606083015260608801516080830152608088015160a083015260a088015160c083015260c088015160e083015260e08801516101008181850152808a01519150506101206151678185018315159052565b890151610140848101919091528901516101608401525061018082018790526001600160a01b0386166101a0830152846101c08301526151b36101e08301856001600160a01b03169052565b6137506102008301846150d2565b80151581146130a257600080fd5b80356151da816151c1565b919050565b600080604083850312156151f257600080fd5b82356151fd81614e41565b9150602083013561520d816151c1565b809150509250929050565b6000806000806080858703121561522e57600080fd5b843561523981614e41565b9350602085013561524981614e41565b92506040850135915060608501356001600160401b0381111561526b57600080fd5b61527787828801614ee0565b91505092959194509250565b600082601f83011261529457600080fd5b813560206152a4614d2f83614cbb565b828152606092830285018201928282019190878511156152c357600080fd5b8387015b858110156153135781818a0312156152df5760008081fd5b6152e7614c46565b81358152858201358682015260408083013561530281614e41565b9082015284529284019281016152c7565b5090979650505050505050565b60008060008060008587036101e081121561533a57600080fd5b6101608082121561534a57600080fd5b615352614c68565b9150873582526020880135602083015260408801356040830152606088013560608301526080880135608083015260a088013560a083015260c088013560c083015260e088013560e08301526101006153ac818a016151cf565b90830152610120888101359083015261014080890135908301529095508601356001600160401b03808211156153e157600080fd5b6153ed89838a01615283565b955061018088013594506101a088013593506101c088013591508082111561541457600080fd5b5061542188828901614f4f565b9150509295509295909350565b6000806040838503121561544157600080fd5b823561544c81614e41565b9150602083013561520d81614e41565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161549a5761549a615472565b5060010190565b6000602082840312156154b357600080fd5b5051919050565b6000602082840312156154cc57600080fd5b81516130d6816151c1565b600060a082840312156154e957600080fd5b60405160a081018181106001600160401b038211171561550b5761550b614c08565b80604052508251815260208301516020820152604083015161552c81614e41565b6040820152606083015161553f816151c1565b6060820152608083015161555281614e41565b60808201529392505050565b8381526060810161557260208301856150d2565b6001600160a01b03929092166040919091015292915050565b600181811c9082168061559f57607f821691505b6020821081036155bf57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156155d757600080fd5b81516130d681614e41565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b8082018082111561062f5761062f615472565b8181038181111561062f5761062f615472565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b8281526040602082015260006133d86040830184614de9565b600082516156c5818460208701614dc5565b9190910192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b815160009082906020808601845b838110156157965781518552938201939082019060010161577a565b50929695505050505050565b808202811582820484141761062f5761062f615472565b6000826157d657634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061580e90830184614de9565b9695505050505050565b60006020828403121561582a57600080fd5b81516130d681614bd5565b601f82111561194f57600081815260208120601f850160051c8101602086101561585c5750805b601f850160051c820191505b8181101561214e57828155600101615868565b81516001600160401b0381111561589457615894614c08565b6158a8816158a2845461558b565b84615835565b602080601f8311600181146158dd57600084156158c55750858301515b600019600386901b1c1916600185901b17855561214e565b600085815260208120601f198616915b8281101561590c578886015182559484019460019091019084016158ed565b508582101561592a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603160045260246000fdfe9249b5b023ae28b94b85dd92d6432cec63267a9d5c52f82a83da2f987b142cc9a264697066735822122065e58bc47c219f2a466d9848ffe681866cd01b1ef41e420d16231fb9137303ff64736f6c63430008130033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102325760003560e01c806370a0823111610130578063aaf741e4116100b8578063d2d849761161007c578063d2d849761461059c578063d56f7bcc146105af578063e985e9c5146105c2578063f2ca5dc5146105fe578063f2fde38b1461061157600080fd5b8063aaf741e414610521578063b88d4fde14610542578063bd66528a14610555578063c87b56dd14610568578063ca0345271461057b57600080fd5b806381cd872a116100ff57806381cd872a146104005780638456cb59146104ec5780638da5cb5b146104f457806395d89b4114610506578063a22cb4651461050e57600080fd5b806370a08231146103be578063715018a6146103d15780637249fbb6146103d957806379502c55146103ec57600080fd5b806320e3dbd4116101be57806342842e0e1161018257806342842e0e146103675780634f6ccce71461037a5780635c975abb1461038d5780636352211e146103985780636cf1dbed146103ab57600080fd5b806320e3dbd41461031357806323b872dd146103265780632f745c59146103395780633f4ba83a1461034c5780634246c1b71461035457600080fd5b806308122cc71161020557806308122cc71461029c578063081812fc146102af578063095ea7b3146102da5780631615fd03146102ed57806318160ddd1461030157600080fd5b806301ffc9a714610237578063042bc95b1461025f57806304f999c71461027457806306fdde0314610287575b600080fd5b61024a610245366004614beb565b610624565b60405190151581526020015b60405180910390f35b61027261026d366004614cde565b610635565b005b610272610282366004614da3565b610cfc565b61028f611046565b6040516102569190614e15565b6102726102aa366004614e28565b6110d8565b6102c26102bd366004614e28565b611813565b6040516001600160a01b039091168152602001610256565b6102726102e8366004614e56565b61183a565b610163546102c2906001600160a01b031681565b60cd545b604051908152602001610256565b610272610321366004614e82565b611954565b610272610334366004614e9f565b6119c7565b610305610347366004614e56565b6119f9565b610272611a8f565b610272610362366004614fd9565b611aa1565b610272610375366004614e9f565b611ede565b610305610388366004614e28565b611ef9565b60fd5460ff1661024a565b6102c26103a6366004614e28565b611f8c565b6102726103b936600461501f565b611fec565b6103056103cc366004614e82565b612156565b6102726121dc565b6102726103e7366004614e28565b6121ee565b610162546102c2906001600160a01b031681565b6104d961040e366004614e28565b610165602090815260009182526040918290208054835161016081018552600183015481526002830154938101939093526003820154938301939093526004810154606083015260058101546080830152600681015460a0830152600781015460c0830152600881015460e0830152600981015460ff9081161515610100840152600a820154610120840152600b820154610140840152600c820154600d830154600e840154600f9094015491936001600160a01b0391821693909291821691600160a01b90041687565b60405161025697969594939291906150f4565b610272612537565b61012f546001600160a01b03166102c2565b61028f612547565b61027261051c3660046151df565b612556565b61030561052f366004614e28565b6101996020526000908152604090205481565b610272610550366004615218565b612565565b610272610563366004614e28565b61259d565b61028f610576366004614e28565b612864565b610305610589366004614e28565b6101986020526000908152604090205481565b6102726105aa366004614e82565b612883565b6102726105bd366004615320565b6128f6565b61024a6105d036600461542e565b6001600160a01b039182166000908152609e6020908152604080832093909416825291909152205460ff1690565b61030561060c366004614e28565b61300d565b61027261061f366004614e82565b61302c565b600061062f826130a5565b92915050565b6000828152610165602052604090206001015482906106675760405163223da47360e21b815260040160405180910390fd5b6518d85b98d95b60d21b60005261016460209081527f81062d4f7ca92921b22616119900c96f98bed102c24746a50196946c312490ea8054604080518285028101850190915281815286939092919083018282801561071557602002820191906000526020600020906000905b82829054906101000a900460ff1660078111156106f3576106f36150bc565b8152602060019283018181049485019490930390920291018084116106d45790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156107a2578381815181106107575761075761545c565b60200260200101516007811115610770576107706150bc565b826007811115610782576107826150bc565b0361079057600192506107a2565b8061079a81615488565b91505061073c565b50816001146107c457604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600d8101543391906001600160a01b03168214610803576040516308ffd32360e41b815260040160405180910390fd5b61016254604051630bb2c35960e21b81526b18db185a5b57dc195c9a5bd960a21b6004820152610889916001600160a01b031690632ecb0d6490602401602060405180830381865afa15801561085d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088191906154a1565b8254906130ca565b4210156108a95760405163e340eb8560e01b815260040160405180910390fd5b600f8101805460ff60a01b198116600160a21b17909155600160a01b900460ff166108d38a6130dd565b60008160078111156108e7576108e76150bc565b0361099157600f820154600d830154600e84015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af115801561094b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f91906154ba565b61098c5760405163244743ff60e01b815260040160405180910390fd5b610cbd565b60018160078111156109a5576109a56150bc565b1480156109b55750600a82015442105b15610ca4576109c3896130e5565b6008830154146109e65760405163b124e96f60e01b815260040160405180910390fd5b60008060005b8b51811015610a9e578b8181518110610a0757610a0761545c565b6020026020010151600001514210158015610a465750821580610a465750828c8281518110610a3857610a3861545c565b602002602001015160000151105b15610a8c578b8181518110610a5d57610a5d61545c565b60200260200101516000015192508b8181518110610a7d57610a7d61545c565b60200260200101516020015191505b80610a9681615488565b9150506109ec565b506064811115610aac575060645b6000610abc85600e015483613194565b600f860154600d870154600e8801549293506001600160a01b039182169263a9059cbb9290911690610aee90856131db565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d91906154ba565b610b7a5760405163244743ff60e01b815260040160405180910390fd5b600081118015610c7e5750600f8501546101635460038701546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0691906154d7565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610c58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7c91906154ba565b155b15610c9c5760405163244743ff60e01b815260040160405180910390fd5b505050610cbd565b604051632adde06f60e21b815260040160405180910390fd5b6000805160206159518339815191528a600485604051610cdf9392919061555e565b60405180910390a1610cf08a6131e7565b50505050505050505050565b600082815261016560205260409020600101548290610d2e5760405163223da47360e21b815260040160405180910390fd5b6101635460008481526101656020526040908190206003015490516329db379b60e11b8152600481019190915284916001600160a01b0316906353b66f369060240160a060405180830381865afa158015610d8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db191906154d7565b608001516001600160a01b0316336001600160a01b031614610de6576040516308ffd32360e41b815260040160405180910390fd5b651c995a9958dd60d21b60005261016460209081527fc46af9fb757a5392b04e96a191cee5d6fe9386d767a56a820e480e8cd4dd9fd980546040805182850281018501909152818152879390929190830182828015610e9457602002820191906000526020600020906000905b82829054906101000a900460ff166007811115610e7257610e726150bc565b815260206001928301818104948501949093039092029101808411610e535790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015610f2157838181518110610ed657610ed661545c565b60200260200101516007811115610eef57610eef6150bc565b826007811115610f0157610f016150bc565b03610f0f5760019250610f21565b80610f1981615488565b915050610ebb565b5081600114610f4357604051632adde06f60e21b815260040160405180910390fd5b600088815261016560205260409020600f8101805460ff60a01b1916600160a11b179055610f718989613231565b600f810154600d820154600e83015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff491906154ba565b6110115760405163244743ff60e01b815260040160405180910390fd5b600080516020615951833981519152896002336040516110339392919061555e565b60405180910390a1505050505050505050565b6060609980546110559061558b565b80601f01602080910402602001604051908101604052809291908181526020018280546110819061558b565b80156110ce5780601f106110a3576101008083540402835291602001916110ce565b820191906000526020600020905b8154815290600101906020018083116110b157829003601f168201915b5050505050905090565b60008181526101656020526040902060010154819061110a5760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa158015611169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118d91906154d7565b608001516001600160a01b0316336001600160a01b0316146111c2576040516308ffd32360e41b815260040160405180910390fd5b6718da1958dad3dd5d60c21b60005261016460209081527fc1dd3999e8023eaa9ce335ac20c9f0911c06155bdf47040ab8df5eebc20004ba8054604080518285028101850190915281815286939092919083018282801561127257602002820191906000526020600020906000905b82829054906101000a900460ff166007811115611250576112506150bc565b8152602060019283018181049485019490930390920291018084116112315790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156112ff578381815181106112b4576112b461545c565b602002602001015160078111156112cd576112cd6150bc565b8260078111156112df576112df6150bc565b036112ed57600192506112ff565b806112f781615488565b915050611299565b508160011461132157604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600b8101544210156113555760405163e340eb8560e01b815260040160405180910390fd5b600f8101805460ff60a01b1916600360a11b179055611373886130dd565b600e81015461016254604051630bb2c35960e21b81526b70726f746f636f6c5f66656560a01b60048201526000928392839261140492916001600160a01b031690632ecb0d64906024015b602060405180830381865afa1580156113db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ff91906154a1565b613194565b600c8501549093501561145c57600e84015461016254604051630bb2c35960e21b81526b72657461696c65725f66656560a01b600482015261145992916001600160a01b031690632ecb0d64906024016113be565b91505b61147d826114778587600e01546131db90919063ffffffff16565b906131db565b90506000831180156115875750600f840154610162546040516321f8a72160e01b81526c19995957dc9958da5c1a595b9d609a1b60048201526001600160a01b039283169263a9059cbb9216906321f8a72190602401602060405180830381865afa1580156114f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151491906155c5565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018690526044016020604051808303816000875af1158015611561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158591906154ba565b155b156115a55760405163244743ff60e01b815260040160405180910390fd5b6000821180156116a95750600f84015461016354600c8601546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa15801561160d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163191906154d7565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af1158015611683573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a791906154ba565b155b156116c75760405163244743ff60e01b815260040160405180910390fd5b600f8401546101635460038601546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa158015611724573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174891906154d7565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af115801561179a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117be91906154ba565b6117db5760405163244743ff60e01b815260040160405180910390fd5b6000805160206159518339815191528b6006336040516117fd9392919061555e565b60405180910390a15b5050505050505050505050565b600061181e82613239565b506000908152609d60205260409020546001600160a01b031690565b600061184582611f8c565b9050806001600160a01b0316836001600160a01b0316036118b75760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806118d357506118d381336105d0565b6119455760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016118ae565b61194f8383613298565b505050565b61195c613306565b61016254604080516001600160a01b03928316815291831660208301527fbd7986d31c086d8cc2901a1c41d1edc0af6e8a7a5c6fc1b8283919c1b2122c38910160405180910390a161016280546001600160a01b0319166001600160a01b0392909216919091179055565b6119d2335b82613361565b6119ee5760405162461bcd60e51b81526004016118ae906155e2565b61194f8383836133e0565b6000611a0483612156565b8210611a665760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016118ae565b506001600160a01b0391909116600090815260cb60209081526040808320938352929052205490565b611a97613306565b611a9f613551565b565b600082815261016560205260409020600101548290611ad35760405163223da47360e21b815260040160405180910390fd5b6631b432b1b5a4b760c91b60005261016460209081527fc78e0758b723b136c59844f7da34685e7f27894489b1657d97b9b8e3e8e19ced80546040805182850281018501909152818152869390929190830182828015611b8257602002820191906000526020600020906000905b82829054906101000a900460ff166007811115611b6057611b606150bc565b815260206001928301818104948501949093039092029101808411611b415790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015611c0f57838181518110611bc457611bc461545c565b60200260200101516007811115611bdd57611bdd6150bc565b826007811115611bef57611bef6150bc565b03611bfd5760019250611c0f565b80611c0781615488565b915050611ba9565b5081600114611c3157604051632adde06f60e21b815260040160405180910390fd5b6000878152610165602052604080822061016354600382015492516329db379b60e11b81529193926001600160a01b03909116916353b66f3691611c7b9160040190815260200190565b60a060405180830381865afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc91906154d7565b608081015190915033906000906001600160a01b03168203611dd757611cf5611cf0856001016000015485608001516135a3565b613607565b9050611d33818b600081518110611d0e57611d0e61545c565b602002602001015185608001516001600160a01b031661361a9092919063ffffffff16565b611d505760405163a2fb840f60e01b815260040160405180910390fd5b600a840154421015611dd2576001840154600d850154611d7c91611cf0916001600160a01b03166135a3565b9050611db5818b600181518110611d9557611d9561545c565b6020908102919091010151600d8701546001600160a01b0316919061361a565b611dd25760405163a2fb840f60e01b815260040160405180910390fd5b611e8f565b600d8401546001600160a01b0390811690831603611e76576001840154600d850154611e0f91611cf0916001600160a01b03166135a3565b9050611e28818b600081518110611d9557611d9561545c565b611e455760405163a2fb840f60e01b815260040160405180910390fd5b611e5d611cf0856001016000015485608001516135a3565b9050611db5818b600181518110611d0e57611d0e61545c565b6040516308ffd32360e41b815260040160405180910390fd5b611e998b8b613231565b600f8401805460ff60a01b1916600560a01b17905560405160008051602061595183398151915290611ed1908d90600590869061555e565b60405180910390a1611806565b61194f83838360405180602001604052806000815250612565565b6000611f0460cd5490565b8210611f675760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016118ae565b60cd8281548110611f7a57611f7a61545c565b90600052602060002001549050919050565b6000818152609b60205260408120546001600160a01b03168061062f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016118ae565b600054610100900460ff161580801561200c5750600054600160ff909116105b806120265750303b158015612026575060005460ff166001145b6120895760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016118ae565b6000805460ff1916600117905580156120ac576000805461ff0019166101001790555b6120b58661375c565b6120fc604051806040016040528060098152602001682232b0b62a37b5b2b760b91b815250604051806040016040528060048152602001631111505360e21b8152506137af565b612108858585856137f0565b801561214e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006001600160a01b0382166121c05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016118ae565b506001600160a01b03166000908152609c602052604090205490565b6121e4613306565b611a9f600061375c565b6000818152610165602052604090206001015481906122205760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa15801561227f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a391906154d7565b608001516001600160a01b0316336001600160a01b0316146122d8576040516308ffd32360e41b815260040160405180910390fd5b651c99599d5b9960d21b60005261016460209081527f07a4462434a8663ef8cbef768cea3239b3345cd5f028a224e47a7db4a71138368054604080518285028101850190915281815286939092919083018282801561238657602002820191906000526020600020906000905b82829054906101000a900460ff166007811115612364576123646150bc565b8152602060019283018181049485019490930390920291018084116123455790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015612413578381815181106123c8576123c861545c565b602002602001015160078111156123e1576123e16150bc565b8260078111156123f3576123f36150bc565b036124015760019250612413565b8061240b81615488565b9150506123ad565b508160011461243557604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600f8101805460ff60a01b1916600360a01b179055612462886130dd565b600f810154600d820154600e83015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156124c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e591906154ba565b6125025760405163244743ff60e01b815260040160405180910390fd5b600080516020615951833981519152886003336040516125249392919061555e565b60405180910390a15b5050505050505050565b61253f613306565b611a9f613aad565b6060609a80546110559061558b565b612561338383613aea565b5050565b61256f3383613361565b61258b5760405162461bcd60e51b81526004016118ae906155e2565b61259784848484613bb8565b50505050565b6000818152610165602052604090206001015481906125cf5760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa15801561262e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265291906154d7565b608001516001600160a01b0316336001600160a01b031614612687576040516308ffd32360e41b815260040160405180910390fd5b64636c61696d60d81b60005261016460209081527f8fded9216611b5e46bf52fe515d6ddc32059da80463e1a4891e5dc68d5c1a8a88054604080518285028101850190915281815286939092919083018282801561273457602002820191906000526020600020906000905b82829054906101000a900460ff166007811115612712576127126150bc565b8152602060019283018181049485019490930390920291018084116126f35790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156127c1578381815181106127765761277661545c565b6020026020010151600781111561278f5761278f6150bc565b8260078111156127a1576127a16150bc565b036127af57600192506127c1565b806127b981615488565b91505061275b565b50816001146127e357604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600d81015461280b9089906001600160a01b0316613231565b600f8101805460ff60a01b1916600160a01b17905560405160008051602061595183398151915290612843908a90600190339061555e565b60405180910390a1600d81015461252d9089906001600160a01b0316613beb565b606061286f82613239565b505060408051602081019091526000815290565b61288b613306565b61016354604080516001600160a01b03928316815291831660208301527fb468923d3f8581bd45345fed844c850e4c681b7170a99d4b47a7f92f66e226d2910160405180910390a161016380546001600160a01b0319166001600160a01b0392909216919091179055565b336000612905611cf088613c1f565b610163546040808a015190516329db379b60e11b81529293506000926001600160a01b03909216916353b66f36916129439160040190815260200190565b60a060405180830381865afa158015612960573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298491906154d7565b90506129c2828560008151811061299d5761299d61545c565b602002602001015183608001516001600160a01b031661361a9092919063ffffffff16565b6129df5760405163a2fb840f60e01b815260040160405180910390fd5b610163546040808a0151905163a241f54d60e01b81526001600160a01b039092169163a241f54d91612a179160040190815260200190565b602060405180830381865afa158015612a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5891906154ba565b612a755760405163e1040adb60e01b815260040160405180910390fd5b8415612ba557610163546040516329db379b60e11b8152600481018790526000916001600160a01b0316906353b66f369060240160a060405180830381865afa158015612ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aea91906154d7565b60408101519091506001600160a01b0316612b18576040516301e8b0f960e51b815260040160405180910390fd5b6101635460405163a241f54d60e01b8152600481018890526001600160a01b039091169063a241f54d90602401602060405180830381865afa158015612b62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8691906154ba565b612ba357604051630620118d60e51b815260040160405180910390fd5b505b87516000818152610165602052604090206001015403612bd857604051635d341dcb60e11b815260040160405180910390fd5b6000612be388613cf8565b90508860c001518114612c09576040516304b1ffc560e51b815260040160405180910390fd5b50505060008060005b8751811015612c965786888281518110612c2e57612c2e61545c565b60200260200101516000015103612c8457878181518110612c5157612c5161545c565b6020026020010151602001519250878181518110612c7157612c7161545c565b6020026020010151604001519150612c96565b80612c8e81615488565b915050612c12565b506001600160a01b038116612cbe57604051632c46fa3160e21b815260040160405180910390fd5b612cca88838387613d9d565b87516000818152610165602052604090206001015403612cfd5760405163a00179fd60e01b815260040160405180910390fd5b6040518060e00160405280428152602001898152602001868152602001846001600160a01b03168152602001838152602001826001600160a01b0316815260200160006007811115612d5157612d516150bc565b90528851600090815261016560209081526040918290208351815583820151805160018301559182015160028201558183015160038201556060808301516004830155608080840151600584015560a080850151600685015560c08086015160078087019190915560e0870151600887015561010087015160098701805491151560ff19909216919091179055610120870151600a87015561014090960151600b86015595870151600c85015591860151600d840180546001600160a01b039283166001600160a01b03199182161790915591870151600e85015591860151600f840180549190931691811682178355948601519294929391926001600160a81b0319161790600160a01b908490811115612e6e57612e6e6150bc565b0217905550905050600184511115612f40576000806000612ea887600181518110612e9b57612e9b61545c565b6020026020010151613db1565b60208e015160405163d505accf60e01b81526001600160a01b038b81166004830152306024830152604482018b9052606482019290925260ff8516608482015260a4810184905260c48101839052939650919450925085169063d505accf9060e401600060405180830381600087803b158015612f2457600080fd5b505af1158015612f38573d6000803e3d6000fd5b505050505050505b6040516323b872dd60e01b81526001600160a01b038481166004830152306024830152604482018490528216906323b872dd906064016020604051808303816000875af1158015612f95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb991906154ba565b612fd65760405163244743ff60e01b815260040160405180910390fd5b875160405160008051602061595183398151915291612ff991600090879061555e565b60405180910390a161252d88838387613e12565b600061301882613239565b506000908152610198602052604090205490565b613034613306565b6001600160a01b0381166130995760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016118ae565b6130a28161375c565b50565b60006001600160e01b0319821663780e9d6360e01b148061062f575061062f82613e17565b60006130d6828461562f565b9392505050565b6130a2613e67565b60008082516001600160401b0381111561310157613101614c08565b60405190808252806020026020018201604052801561312a578160200160208202803683370190505b50905060005b835181101561318a5761315b84828151811061314e5761314e61545c565b6020026020010151613ead565b82828151811061316d5761316d61545c565b60209081029190910101528061318281615488565b915050613130565b506130d681613efa565b600060648211156131b857604051635c974e3d60e11b815260040160405180910390fd5b6130d66103e86131d5606481866131cf8986613f0d565b90613f0d565b90613f19565b60006130d68284615642565b6000818152610199602052604090205480156132285761320681613f25565b6000818152610198602090815260408083208390558483526101999091528120555b612561826130dd565b612561613e67565b6000818152609b60205260409020546001600160a01b03166130a25760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016118ae565b6000818152609d6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906132cd82611f8c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b61012f546001600160a01b03163314611a9f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016118ae565b60008061336d83611f8c565b9050806001600160a01b0316846001600160a01b031614806133b457506001600160a01b038082166000908152609e602090815260408083209388168352929052205460ff165b806133d85750836001600160a01b03166133cd84611813565b6001600160a01b0316145b949350505050565b826001600160a01b03166133f382611f8c565b6001600160a01b0316146134195760405162461bcd60e51b81526004016118ae90615655565b6001600160a01b03821661347b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016118ae565b6134888383836001613f53565b826001600160a01b031661349b82611f8c565b6001600160a01b0316146134c15760405162461bcd60e51b81526004016118ae90615655565b6000818152609d6020908152604080832080546001600160a01b03199081169091556001600160a01b03878116808652609c8552838620805460001901905590871680865283862080546001019055868652609b90945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b613559614039565b60fd805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080517ff811d7f3ddb148410001929e2cbfb7fea8779b9349b7c2f650fa91840528d69c60208201529081018390526001600160a01b03821660608201526000906080015b60405160208183030381529060405280519060200120905092915050565b600061062f613614614082565b83614102565b60008060006136298585614129565b90925090506000816004811115613642576136426150bc565b1480156136605750856001600160a01b0316826001600160a01b0316145b15613670576001925050506130d6565b600080876001600160a01b0316631626ba7e60e01b888860405160240161369892919061569a565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516136d691906156b3565b600060405180830381855afa9150503d8060008114613711576040519150601f19603f3d011682016040523d82523d6000602084013e613716565b606091505b5091509150818015613729575080516020145b801561375057508051630b135d3f60e11b9061374e90830160209081019084016154a1565b145b98975050505050505050565b61012f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166137d65760405162461bcd60e51b81526004016118ae906156cf565b6137e0828261416e565b6137e861419f565b6125616141c6565b600054610100900460ff166138175760405162461bcd60e51b81526004016118ae906156cf565b61382184846141f5565b6138296141c6565b61016280546001600160a01b038481166001600160a01b03199283161790925561016380549284169290911691909117905560408051602081019091528060009052651c995a9958dd60d21b6000526101646020526138ab907fc46af9fb757a5392b04e96a191cee5d6fe9386d767a56a820e480e8cd4dd9fd9906001614a97565b50604080518082019091528060008152602001600190526518d85b98d95b60d21b600052610164602052613902907f81062d4f7ca92921b22616119900c96f98bed102c24746a50196946c312490ea906002614b4b565b5060408051808201909152806001815260200160059052651c99599d5b9960d21b600052610164602052613959907f07a4462434a8663ef8cbef768cea3239b3345cd5f028a224e47a7db4a7113836906002614b4b565b506040805160208101909152806000905264636c61696d60d81b6000526101646020526139a9907f8fded9216611b5e46bf52fe515d6ddc32059da80463e1a4891e5dc68d5c1a8a8906001614a97565b50604080516020810190915280600190526631b432b1b5a4b760c91b6000526101646020526139fb907fc78e0758b723b136c59844f7da34685e7f27894489b1657d97b9b8e3e8e19ced906001614a97565b50604080516020810190915280600590526718da1958dad3dd5d60c21b600052610164602052613a4e907fc1dd3999e8023eaa9ce335ac20c9f0911c06155bdf47040ab8df5eebc20004ba906001614a97565b5060408051808201909152806005815260200160069052666469737075746560c81b600052610164602052613aa6907f755971b5036353f540d427876647973a20fcd901626978bb47564e1a4a28b6d4906002614b4b565b5050505050565b613ab5613e67565b60fd805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135863390565b816001600160a01b0316836001600160a01b031603613b4b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016118ae565b6001600160a01b038381166000818152609e6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613bc38484846133e0565b613bcf84848484614226565b6125975760405162461bcd60e51b81526004016118ae9061571a565b6000613bf682614327565b600081815261019860209081526040808320879055958252610199905293909320929092555050565b60007fcf2addd2f89a78825d3f130a17e47b4e9963adfd09837fa9c454569faa073354826000015183602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b6101200151604051602001613cdb9b9a999897969594939291909a8b5260208b019990995260408a01979097526060890195909552608088019390935260a087019190915260c086015260e085015261010084015215156101208301526101408201526101600190565b604051602081830303815290604052805190602001209050919050565b60008082516001600160401b03811115613d1457613d14614c08565b604051908082528060200260200182016040528015613d3d578160200160208202803683370190505b50905060005b835181101561318a57613d6e848281518110613d6157613d6161545c565b602002602001015161434f565b828281518110613d8057613d8061545c565b602090810291909101015280613d9581615488565b915050613d43565b613da5613e67565b612597848484846143bd565b60008060008351604103613df25750505060208101516040820151606083015160001a919082613de057601b92505b60018303613ded57601c92505b613e0b565b604051638baa579f60e01b815260040160405180910390fd5b9193909250565b612597565b60006001600160e01b031982166380ac58cd60e01b1480613e4857506001600160e01b03198216635b5e139f60e01b145b8061062f57506301ffc9a760e01b6001600160e01b031983161461062f565b60fd5460ff1615611a9f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016118ae565b8051602080830151604051600093613cdb937f8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5939192019283526020830191909152604082015260600190565b600081604051602001613cdb919061576c565b60006130d682846157a2565b60006130d682846157b9565b613f2e336119cc565b613f4a5760405162461bcd60e51b81526004016118ae906155e2565b6130a2816143c5565b613f5b613e67565b6001600160a01b03841615801590613f7b57506001600160a01b03831615155b1561402d576000828152610198602052604090205480613fae5760405163223da47360e21b815260040160405180910390fd5b600081815261016560205260409020600981015460ff161580613ff157506001600f820154600160a01b900460ff166007811115613fee57613fee6150bc565b14155b1561400f5760405163ca7cbc7760e01b815260040160405180910390fd5b600d0180546001600160a01b0319166001600160a01b038616179055505b61259784848484614468565b60fd5460ff16611a9f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016118ae565b60006140fd7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6140b160015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b905090565b60405161190160f01b602082015260228101839052604281018290526000906062016135e9565b600080825160410361415f5760208301516040840151606085015160001a6141538782858561447c565b94509450505050614167565b506000905060025b9250929050565b600054610100900460ff166141955760405162461bcd60e51b81526004016118ae906156cf565b6125618282614540565b600054610100900460ff16611a9f5760405162461bcd60e51b81526004016118ae906156cf565b600054610100900460ff166141ed5760405162461bcd60e51b81526004016118ae906156cf565b611a9f614580565b600054610100900460ff1661421c5760405162461bcd60e51b81526004016118ae906156cf565b61256182826145b3565b60006001600160a01b0384163b1561431c57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061426a9033908990889088906004016157db565b6020604051808303816000875af19250505080156142a5575060408051601f3d908101601f191682019092526142a291810190615818565b60015b614302573d8080156142d3576040519150601f19603f3d011682016040523d82523d6000602084013e6142d8565b606091505b5080516000036142fa5760405162461bcd60e51b81526004016118ae9061571a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506133d8565b506001949350505050565b6000806143346101615490565b905061434561016180546001019055565b61062f83826145f4565b60007f2f8fc0b3ad3f58f6deb367673d38e4112a3c8c64de033c5b780b84ef8f67cde6826000015183602001518460400151604051602001613cdb949392919093845260208401929092526040830152606090811b6bffffffffffffffffffffffff19169082015260740190565b612597613e67565b60006143d082611f8c565b90506143e0816000846001613f53565b6143e982611f8c565b6000838152609d6020908152604080832080546001600160a01b03199081169091556001600160a01b038516808552609c84528285208054600019019055878552609b909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b614470613e67565b6125978484848461460e565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156144b35750600090506003614537565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614507573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661453057600060019250925050614537565b9150600090505b94509492505050565b600054610100900460ff166145675760405162461bcd60e51b81526004016118ae906156cf565b6099614573838261587b565b50609a61194f828261587b565b600054610100900460ff166145a75760405162461bcd60e51b81526004016118ae906156cf565b60fd805460ff19169055565b600054610100900460ff166145da5760405162461bcd60e51b81526004016118ae906156cf565b815160209283012081519190920120600191909155600255565b61256182826040518060200160405280600081525061473b565b600181111561467d5760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b60648201526084016118ae565b816001600160a01b0385166146d9576146d48160cd8054600083815260ce60205260408120829055600182018355919091527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0155565b6146fc565b836001600160a01b0316856001600160a01b0316146146fc576146fc858261476e565b6001600160a01b038416614718576147138161480b565b613aa6565b846001600160a01b0316846001600160a01b031614613aa657613aa684826148ba565b61474583836148fe565b6147526000848484614226565b61194f5760405162461bcd60e51b81526004016118ae9061571a565b6000600161477b84612156565b6147859190615642565b600083815260cc60205260409020549091508082146147d8576001600160a01b038416600090815260cb60209081526040808320858452825280832054848452818420819055835260cc90915290208190555b50600091825260cc602090815260408084208490556001600160a01b03909416835260cb81528383209183525290812055565b60cd5460009061481d90600190615642565b600083815260ce602052604081205460cd80549394509092849081106148455761484561545c565b906000526020600020015490508060cd83815481106148665761486661545c565b600091825260208083209091019290925582815260ce909152604080822084905585825281205560cd80548061489e5761489e61593a565b6001900381819060005260206000200160009055905550505050565b60006148c583612156565b6001600160a01b03909316600090815260cb60209081526040808320868452825280832085905593825260cc9052919091209190915550565b6001600160a01b0382166149545760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016118ae565b6000818152609b60205260409020546001600160a01b0316156149b95760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016118ae565b6149c7600083836001613f53565b6000818152609b60205260409020546001600160a01b031615614a2c5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016118ae565b6001600160a01b0382166000818152609c6020908152604080832080546001019055848352609b90915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b82805482825590600052602060002090601f01602090048101928215614b3b5791602002820160005b83821115614b0c57835183826101000a81548160ff02191690836007811115614aeb57614aeb6150bc565b02179055509260200192600101602081600001049283019260010302614ac0565b8015614b395782816101000a81549060ff0219169055600101602081600001049283019260010302614b0c565b505b50614b47929150614bc0565b5090565b82805482825590600052602060002090601f01602090048101928215614b3b5791602002820160005b83821115614b0c57835183826101000a81548160ff02191690836007811115614b9f57614b9f6150bc565b02179055509260200192600101602081600001049283019260010302614b74565b5b80821115614b475760008155600101614bc1565b6001600160e01b0319811681146130a257600080fd5b600060208284031215614bfd57600080fd5b81356130d681614bd5565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614c4057614c40614c08565b60405290565b604051606081016001600160401b0381118282101715614c4057614c40614c08565b60405161016081016001600160401b0381118282101715614c4057614c40614c08565b604051601f8201601f191681016001600160401b0381118282101715614cb357614cb3614c08565b604052919050565b60006001600160401b03821115614cd457614cd4614c08565b5060051b60200190565b6000806040808486031215614cf257600080fd5b833592506020808501356001600160401b03811115614d1057600080fd5b8501601f81018713614d2157600080fd5b8035614d34614d2f82614cbb565b614c8b565b81815260069190911b82018301908381019089831115614d5357600080fd5b928401925b82841015614d935785848b031215614d705760008081fd5b614d78614c1e565b84358152858501358682015282529285019290840190614d58565b8096505050505050509250929050565b60008060408385031215614db657600080fd5b50508035926020909101359150565b60005b83811015614de0578181015183820152602001614dc8565b50506000910152565b60008151808452614e01816020860160208601614dc5565b601f01601f19169290920160200192915050565b6020815260006130d66020830184614de9565b600060208284031215614e3a57600080fd5b5035919050565b6001600160a01b03811681146130a257600080fd5b60008060408385031215614e6957600080fd5b8235614e7481614e41565b946020939093013593505050565b600060208284031215614e9457600080fd5b81356130d681614e41565b600080600060608486031215614eb457600080fd5b8335614ebf81614e41565b92506020840135614ecf81614e41565b929592945050506040919091013590565b600082601f830112614ef157600080fd5b81356001600160401b03811115614f0a57614f0a614c08565b614f1d601f8201601f1916602001614c8b565b818152846020838601011115614f3257600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614f6057600080fd5b81356020614f70614d2f83614cbb565b82815260059290921b84018101918181019086841115614f8f57600080fd5b8286015b84811015614fce5780356001600160401b03811115614fb25760008081fd5b614fc08986838b0101614ee0565b845250918301918301614f93565b509695505050505050565b60008060408385031215614fec57600080fd5b8235915060208301356001600160401b0381111561500957600080fd5b61501585828601614f4f565b9150509250929050565b600080600080600060a0868803121561503757600080fd5b853561504281614e41565b945060208601356001600160401b038082111561505e57600080fd5b61506a89838a01614ee0565b9550604088013591508082111561508057600080fd5b5061508d88828901614ee0565b935050606086013561509e81614e41565b915060808601356150ae81614e41565b809150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600881106150f057634e487b7160e01b600052602160045260246000fd5b9052565b60006102208201905088825287516020830152602088015160408301526040880151606083015260608801516080830152608088015160a083015260a088015160c083015260c088015160e083015260e08801516101008181850152808a01519150506101206151678185018315159052565b890151610140848101919091528901516101608401525061018082018790526001600160a01b0386166101a0830152846101c08301526151b36101e08301856001600160a01b03169052565b6137506102008301846150d2565b80151581146130a257600080fd5b80356151da816151c1565b919050565b600080604083850312156151f257600080fd5b82356151fd81614e41565b9150602083013561520d816151c1565b809150509250929050565b6000806000806080858703121561522e57600080fd5b843561523981614e41565b9350602085013561524981614e41565b92506040850135915060608501356001600160401b0381111561526b57600080fd5b61527787828801614ee0565b91505092959194509250565b600082601f83011261529457600080fd5b813560206152a4614d2f83614cbb565b828152606092830285018201928282019190878511156152c357600080fd5b8387015b858110156153135781818a0312156152df5760008081fd5b6152e7614c46565b81358152858201358682015260408083013561530281614e41565b9082015284529284019281016152c7565b5090979650505050505050565b60008060008060008587036101e081121561533a57600080fd5b6101608082121561534a57600080fd5b615352614c68565b9150873582526020880135602083015260408801356040830152606088013560608301526080880135608083015260a088013560a083015260c088013560c083015260e088013560e08301526101006153ac818a016151cf565b90830152610120888101359083015261014080890135908301529095508601356001600160401b03808211156153e157600080fd5b6153ed89838a01615283565b955061018088013594506101a088013593506101c088013591508082111561541457600080fd5b5061542188828901614f4f565b9150509295509295909350565b6000806040838503121561544157600080fd5b823561544c81614e41565b9150602083013561520d81614e41565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161549a5761549a615472565b5060010190565b6000602082840312156154b357600080fd5b5051919050565b6000602082840312156154cc57600080fd5b81516130d6816151c1565b600060a082840312156154e957600080fd5b60405160a081018181106001600160401b038211171561550b5761550b614c08565b80604052508251815260208301516020820152604083015161552c81614e41565b6040820152606083015161553f816151c1565b6060820152608083015161555281614e41565b60808201529392505050565b8381526060810161557260208301856150d2565b6001600160a01b03929092166040919091015292915050565b600181811c9082168061559f57607f821691505b6020821081036155bf57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156155d757600080fd5b81516130d681614e41565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b8082018082111561062f5761062f615472565b8181038181111561062f5761062f615472565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b8281526040602082015260006133d86040830184614de9565b600082516156c5818460208701614dc5565b9190910192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b815160009082906020808601845b838110156157965781518552938201939082019060010161577a565b50929695505050505050565b808202811582820484141761062f5761062f615472565b6000826157d657634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061580e90830184614de9565b9695505050505050565b60006020828403121561582a57600080fd5b81516130d681614bd5565b601f82111561194f57600081815260208120601f850160051c8101602086101561585c5750805b601f850160051c820191505b8181101561214e57828155600101615868565b81516001600160401b0381111561589457615894614c08565b6158a8816158a2845461558b565b84615835565b602080601f8311600181146158dd57600084156158c55750858301515b600019600386901b1c1916600185901b17855561214e565b600085815260208120601f198616915b8281101561590c578886015182559484019460019091019084016158ed565b508582101561592a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603160045260246000fdfe9249b5b023ae28b94b85dd92d6432cec63267a9d5c52f82a83da2f987b142cc9a264697066735822122065e58bc47c219f2a466d9848ffe681866cd01b1ef41e420d16231fb9137303ff64736f6c63430008130033", + "numDeployments": 2, + "solcInputHash": "21eac61dc4f78e216bbddc7cc9f68411", + "metadata": "{\"compiler\":{\"version\":\"0.8.19+commit.7dd6d404\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"DealAlreadyCreated\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DealExists\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DealFundsTransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DealNotFound\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisabledRetailer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DisabledSupplier\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidCancelOptions\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidOfferSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPaymentId\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPaymentOptions\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidPercent\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidRetailer\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotAllowedAuth\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotAllowedStatus\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotAllowedTime\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TokenTransferNotAllowed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"approved\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"ApprovalForAll\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetConfig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"oldAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAddress\",\"type\":\"address\"}],\"name\":\"SetEntities\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"enum Utils.DealStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"Status\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"penalty\",\"type\":\"uint256\"}],\"internalType\":\"struct Utils.CancelOption[]\",\"name\":\"_cancelOptions\",\"type\":\"tuple[]\"}],\"name\":\"cancel\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"signs\",\"type\":\"bytes[]\"}],\"name\":\"checkIn\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"}],\"name\":\"checkOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"config\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expire\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"supplierId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"requestHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"optionsHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"paymentHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"cancelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"checkIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"checkOut\",\"type\":\"uint256\"}],\"internalType\":\"struct Utils.Offer\",\"name\":\"offer\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"}],\"internalType\":\"struct Utils.PaymentOption[]\",\"name\":\"paymentOptions\",\"type\":\"tuple[]\"},{\"internalType\":\"bytes32\",\"name\":\"paymentId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"retailerId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes[]\",\"name\":\"signs\",\"type\":\"bytes[]\"}],\"name\":\"deal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deals\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"created\",\"type\":\"uint256\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"id\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expire\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"supplierId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"requestHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"optionsHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"paymentHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"cancelHash\",\"type\":\"bytes32\"},{\"internalType\":\"bool\",\"name\":\"transferable\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"checkIn\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"checkOut\",\"type\":\"uint256\"}],\"internalType\":\"struct Utils.Offer\",\"name\":\"offer\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"retailerId\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"buyer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"enum Utils.DealStatus\",\"name\":\"status\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"entities\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"getApproved\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"_version\",\"type\":\"string\"},{\"internalType\":\"address\",\"name\":\"_config\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_entities\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"}],\"name\":\"isApprovedForAll\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"offerTokens\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"ownerOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"reason\",\"type\":\"bytes32\"}],\"name\":\"reject\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"resolveTokenId\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"offerId\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"safeTransferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"operator\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"}],\"name\":\"setApprovalForAll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_config\",\"type\":\"address\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_entities\",\"type\":\"address\"}],\"name\":\"setEntities\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"tokenOfOwnerByIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"tokenOffers\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"tokenURI\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"tokenId\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"custom:security-contact\":\"security@windingtree.com\",\"details\":\"This contract enables the creation and management of deals\",\"errors\":{\"DealAlreadyCreated()\":[{\"details\":\"Thrown when Deal was created in the `_beforeCreate` hook\"}],\"DealExists()\":[{\"details\":\"Thrown when a user attempts to create an already existing Deal\"}],\"DealFundsTransferFailed()\":[{\"details\":\"Thrown when a Deal funds transfer is failed\"}],\"DealNotFound()\":[{\"details\":\"Thrown when the Deal is not found\"}],\"DisabledRetailer()\":[{\"details\":\"Thrown when the retailer is not enabled\"}],\"DisabledSupplier()\":[{\"details\":\"Thrown when the supplier of the offer is not enabled\"}],\"InvalidCancelOptions()\":[{\"details\":\"Thrown when a user attempts to cancel the deal using invalid cancellation options\"}],\"InvalidOfferSignature()\":[{\"details\":\"Thrown when a user attempts to create a deal using an offer with an invalid signature\"}],\"InvalidPaymentId()\":[{\"details\":\"Thrown when a user attempts to create a deal providing an invalid payment option Id\"}],\"InvalidPaymentOptions()\":[{\"details\":\"Thrown when a user attempts to create a deal providing an invalid payment options\"}],\"InvalidPercent()\":[{\"details\":\"Thrown when percents value greater than 100\"}],\"InvalidRetailer()\":[{\"details\":\"Thrown when the retailer of the offer is not found\"}],\"NotAllowedAuth()\":[{\"details\":\"Thrown when a function call is not allowed for current user\"}],\"NotAllowedStatus()\":[{\"details\":\"Thrown when a user attempts to claim the deal in non-created status\"}],\"NotAllowedTime()\":[{\"details\":\"Thrown when a user attempts to do something that not allowed at a moment\"}]},\"events\":{\"Approval(address,address,uint256)\":{\"details\":\"Emitted when `owner` enables `approved` to manage the `tokenId` token.\"},\"ApprovalForAll(address,address,bool)\":{\"details\":\"Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\"},\"Initialized(uint8)\":{\"details\":\"Triggered when the contract has been initialized or reinitialized.\"},\"Paused(address)\":{\"details\":\"Emitted when the pause is triggered by `account`.\"},\"SetConfig(address,address)\":{\"details\":\"Emitted when updated an address of the protocol config contract\"},\"SetEntities(address,address)\":{\"details\":\"Emitted when updated an address of the Entities registry contract\"},\"Status(bytes32,uint8,address)\":{\"details\":\"Emitted when a Deal status is updated\"},\"Transfer(address,address,uint256)\":{\"details\":\"Emitted when `tokenId` token is transferred from `from` to `to`.\"},\"Unpaused(address)\":{\"details\":\"Emitted when the pause is lifted by `account`.\"}},\"kind\":\"dev\",\"methods\":{\"approve(address,uint256)\":{\"details\":\"See {IERC721-approve}.\"},\"balanceOf(address)\":{\"details\":\"See {IERC721-balanceOf}.\"},\"cancel(bytes32,(uint256,uint256)[])\":{\"details\":\"Cancels the deal\",\"params\":{\"_cancelOptions\":\"Cancellation options from offer Requirements: - the deal must exists - the deal must be in status DealStatus.Created or DealStatus.Claimed - must be called by buyer - if the deal in DealStatus.Claimed status: - if block.timestamp > checkIn time then zero refund - cancellation rules must follow the rules defined by offer\",\"offerId\":\"The deal offer Id\"}},\"checkIn(bytes32,bytes[])\":{\"details\":\"Checks in the deal\",\"params\":{\"offerId\":\"The deal offer Id\",\"signs\":\"Signatures Requirements: - the deal must exists - the deal must be in status DealStatus.Claimed - must be called by the supplier's signer or buyer's address - if called by the supplier's signer: - a valid signature of suppliers's signer must be provided in signs[0] - if before sign-in time: a valid signature of the buyer must be provided in signs[1] - if called buy buyer: - a valid signature of the buyer must be provided in signs[0] - a valid signature of suppliers's signer must be provided in signs[1]\"}},\"checkOut(bytes32)\":{\"details\":\"Checks out the deal and sends funds to the supplier\",\"params\":{\"offerId\":\"The deal offer Id Requirements: - the deal must exists - must be called by the supplier's signer only - the deal must be in status DealStatus.CheckIn - must be called after checkOut time only\"}},\"claim(bytes32)\":{\"details\":\"Claims the deal\",\"params\":{\"offerId\":\"The deal offer Id Requirements: - the deal must exists - the deal must be in status DealStatus.Created - must be called by the signer address of the deal offer supplier\"}},\"constructor\":{\"custom:oz-upgrades-unsafe-allow\":\"constructor\"},\"deal((bytes32,uint256,bytes32,uint256,bytes32,bytes32,bytes32,bytes32,bool,uint256,uint256),(bytes32,uint256,address)[],bytes32,bytes32,bytes[])\":{\"details\":\"Creates a Deal on a base of an offer\",\"params\":{\"offer\":\"An offer payload\",\"paymentId\":\"Payment option Id\",\"paymentOptions\":\"Raw offered payment options array\",\"retailerId\":\"Retailer Id\",\"signs\":\"Signatures: [0] - offer: ECDSA/ERC1271; [1] - asset permit: ECDSA (optional) Requirements: - supplier of the offer must be registered - offer must be signed with a proper signer - the deal should not be created before - the deal should not be created inside the _before hook - payment options must be valid (equal to those from the offer) - payment Id must exists in payment options - the contract must be able to make transfer of funds NOTE: `permit` signature can be ECDSA of type only\"}},\"getApproved(uint256)\":{\"details\":\"See {IERC721-getApproved}.\"},\"initialize(address,string,string,address,address)\":{\"details\":\"Initializes the Market contract with the given arguments\",\"params\":{\"_config\":\"The protocol config contract address\",\"_entities\":\"Entities registry contract address\",\"_name\":\"The name of the contract\",\"_owner\":\"The owner of the contract\",\"_version\":\"The version of the contract\"}},\"isApprovedForAll(address,address)\":{\"details\":\"See {IERC721-isApprovedForAll}.\"},\"name()\":{\"details\":\"See {IERC721Metadata-name}.\"},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"ownerOf(uint256)\":{\"details\":\"See {IERC721-ownerOf}.\"},\"pause()\":{\"details\":\"Pauses the contract\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"refund(bytes32)\":{\"details\":\"Refunds the deal\",\"params\":{\"offerId\":\"The deal offer Id Requirements: - the deal must exists - the deal must be in status DealStatus.CheckedIn - must be called by the signer address of the deal offer supplier\"}},\"reject(bytes32,bytes32)\":{\"details\":\"Rejects the deal\",\"params\":{\"offerId\":\"The deal offer Id\",\"reason\":\"Rejection reason Requirements: - the deal must exists - the deal must be in status DealStatus.Created - must be called by the signer address of the deal offer supplier\"}},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"resolveTokenId(uint256)\":{\"details\":\"Returns offerId linked to the token\",\"params\":{\"tokenId\":\"The ID of the token\"},\"returns\":{\"offerId\":\"The ID of the offer linked to the token\"}},\"safeTransferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"safeTransferFrom(address,address,uint256,bytes)\":{\"details\":\"See {IERC721-safeTransferFrom}.\"},\"setApprovalForAll(address,bool)\":{\"details\":\"See {IERC721-setApprovalForAll}.\"},\"setConfig(address)\":{\"details\":\"Sets the new address of the protocol config contract address\",\"params\":{\"_config\":\"The new protocol config contract address\"}},\"setEntities(address)\":{\"details\":\"Sets the new address of the entities registry\",\"params\":{\"_entities\":\"The new protocol config contract address\"}},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"symbol()\":{\"details\":\"See {IERC721Metadata-symbol}.\"},\"tokenByIndex(uint256)\":{\"details\":\"See {IERC721Enumerable-tokenByIndex}.\"},\"tokenOfOwnerByIndex(address,uint256)\":{\"details\":\"See {IERC721Enumerable-tokenOfOwnerByIndex}.\"},\"tokenURI(uint256)\":{\"details\":\"Returns the token URI of the given token ID\",\"params\":{\"tokenId\":\"The ID of the token\"},\"returns\":{\"_0\":\"The token URI of the given token ID\"}},\"totalSupply()\":{\"details\":\"See {IERC721Enumerable-totalSupply}.\"},\"transferFrom(address,address,uint256)\":{\"details\":\"See {IERC721-transferFrom}.\"},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"},\"unpause()\":{\"details\":\"Unpauses the contract\"}},\"stateVariables\":{\"offerTokens\":{\"details\":\"Mapping of offer Id on token Id\"},\"tokenOffers\":{\"details\":\"Mapping of token Id on offer Id\"}},\"title\":\"Market\",\"version\":1},\"userdoc\":{\"errors\":{\"TokenTransferNotAllowed()\":[{\"notice\":\"Throws when NFT transfer is not allowed by offer rule\"}]},\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/Market.sol\":\"Market\"},\"evmVersion\":\"paris\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/interfaces/IERC1271Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC1271 standard signature validation method for\\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC1271Upgradeable {\\n /**\\n * @dev Should return whether the signature provided is valid for the provided data\\n * @param hash Hash of the data to be signed\\n * @param signature Signature byte array associated with _data\\n */\\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\\n}\\n\",\"keccak256\":\"0x4473c09c087ee1a48c5547b23799c0474b2e08cde6fec5921c628171c4ebcdc0\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\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 proxied contracts do not make use of 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 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\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 *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 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 Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts.\\n *\\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\\n * constructor.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\\n * are added through upgrades and that require initialization.\\n *\\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\\n * cannot be nested. If one is invoked in the context of another, execution will revert.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n *\\n * WARNING: setting the version to 255 will prevent any future reinitialization.\\n *\\n * Emits an {Initialized} event.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n *\\n * Emits an {Initialized} event the first time it is successfully executed.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n\\n /**\\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\\n */\\n function _getInitializedVersion() internal view returns (uint8) {\\n return _initialized;\\n }\\n\\n /**\\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\\n */\\n function _isInitializing() internal view returns (bool) {\\n return _initializing;\\n }\\n}\\n\",\"keccak256\":\"0x037c334add4b033ad3493038c25be1682d78c00992e1acb0e2795caff3925271\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n function __Pausable_init() internal onlyInitializing {\\n __Pausable_init_unchained();\\n }\\n\\n function __Pausable_init_unchained() internal onlyInitializing {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x40c636b4572ff5f1dc50cf22097e93c0723ee14eff87e99ac2b02636eeca1250\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721ReceiverUpgradeable.sol\\\";\\nimport \\\"./extensions/IERC721MetadataUpgradeable.sol\\\";\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\nimport \\\"../../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../../utils/StringsUpgradeable.sol\\\";\\nimport \\\"../../utils/introspection/ERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\\n * {ERC721Enumerable}.\\n */\\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\\n using AddressUpgradeable for address;\\n using StringsUpgradeable for uint256;\\n\\n // Token name\\n string private _name;\\n\\n // Token symbol\\n string private _symbol;\\n\\n // Mapping from token ID to owner address\\n mapping(uint256 => address) private _owners;\\n\\n // Mapping owner address to token count\\n mapping(address => uint256) private _balances;\\n\\n // Mapping from token ID to approved address\\n mapping(uint256 => address) private _tokenApprovals;\\n\\n // Mapping from owner to operator approvals\\n mapping(address => mapping(address => bool)) private _operatorApprovals;\\n\\n /**\\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\\n */\\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\\n __ERC721_init_unchained(name_, symbol_);\\n }\\n\\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\\n _name = name_;\\n _symbol = symbol_;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\\n return\\n interfaceId == type(IERC721Upgradeable).interfaceId ||\\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\\n super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721-balanceOf}.\\n */\\n function balanceOf(address owner) public view virtual override returns (uint256) {\\n require(owner != address(0), \\\"ERC721: address zero is not a valid owner\\\");\\n return _balances[owner];\\n }\\n\\n /**\\n * @dev See {IERC721-ownerOf}.\\n */\\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\\n address owner = _ownerOf(tokenId);\\n require(owner != address(0), \\\"ERC721: invalid token ID\\\");\\n return owner;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-name}.\\n */\\n function name() public view virtual override returns (string memory) {\\n return _name;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-symbol}.\\n */\\n function symbol() public view virtual override returns (string memory) {\\n return _symbol;\\n }\\n\\n /**\\n * @dev See {IERC721Metadata-tokenURI}.\\n */\\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\\n _requireMinted(tokenId);\\n\\n string memory baseURI = _baseURI();\\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \\\"\\\";\\n }\\n\\n /**\\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\\n * by default, can be overridden in child contracts.\\n */\\n function _baseURI() internal view virtual returns (string memory) {\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev See {IERC721-approve}.\\n */\\n function approve(address to, uint256 tokenId) public virtual override {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n require(to != owner, \\\"ERC721: approval to current owner\\\");\\n\\n require(\\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\\n \\\"ERC721: approve caller is not token owner or approved for all\\\"\\n );\\n\\n _approve(to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-getApproved}.\\n */\\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\\n _requireMinted(tokenId);\\n\\n return _tokenApprovals[tokenId];\\n }\\n\\n /**\\n * @dev See {IERC721-setApprovalForAll}.\\n */\\n function setApprovalForAll(address operator, bool approved) public virtual override {\\n _setApprovalForAll(_msgSender(), operator, approved);\\n }\\n\\n /**\\n * @dev See {IERC721-isApprovedForAll}.\\n */\\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\\n return _operatorApprovals[owner][operator];\\n }\\n\\n /**\\n * @dev See {IERC721-transferFrom}.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n //solhint-disable-next-line max-line-length\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n\\n _transfer(from, to, tokenId);\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) public virtual override {\\n safeTransferFrom(from, to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev See {IERC721-safeTransferFrom}.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) public virtual override {\\n require(_isApprovedOrOwner(_msgSender(), tokenId), \\\"ERC721: caller is not token owner or approved\\\");\\n _safeTransfer(from, to, tokenId, data);\\n }\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\\n *\\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\\n * implement alternative mechanisms to perform token transfer, such as signature-based.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _transfer(from, to, tokenId);\\n require(_checkOnERC721Received(from, to, tokenId, data), \\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n }\\n\\n /**\\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\\n */\\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\\n return _owners[tokenId];\\n }\\n\\n /**\\n * @dev Returns whether `tokenId` exists.\\n *\\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\\n *\\n * Tokens start existing when they are minted (`_mint`),\\n * and stop existing when they are burned (`_burn`).\\n */\\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\\n return _ownerOf(tokenId) != address(0);\\n }\\n\\n /**\\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\\n }\\n\\n /**\\n * @dev Safely mints `tokenId` and transfers it to `to`.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _safeMint(address to, uint256 tokenId) internal virtual {\\n _safeMint(to, tokenId, \\\"\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\\n */\\n function _safeMint(\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) internal virtual {\\n _mint(to, tokenId);\\n require(\\n _checkOnERC721Received(address(0), to, tokenId, data),\\n \\\"ERC721: transfer to non ERC721Receiver implementer\\\"\\n );\\n }\\n\\n /**\\n * @dev Mints `tokenId` and transfers it to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\\n *\\n * Requirements:\\n *\\n * - `tokenId` must not exist.\\n * - `to` cannot be the zero address.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _mint(address to, uint256 tokenId) internal virtual {\\n require(to != address(0), \\\"ERC721: mint to the zero address\\\");\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n _beforeTokenTransfer(address(0), to, tokenId, 1);\\n\\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\\n require(!_exists(tokenId), \\\"ERC721: token already minted\\\");\\n\\n unchecked {\\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\\n // Given that tokens are minted one by one, it is impossible in practice that\\n // this ever happens. Might change if we allow batch minting.\\n // The ERC fails to describe this case.\\n _balances[to] += 1;\\n }\\n\\n _owners[tokenId] = to;\\n\\n emit Transfer(address(0), to, tokenId);\\n\\n _afterTokenTransfer(address(0), to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Destroys `tokenId`.\\n * The approval is cleared when the token is burned.\\n * This is an internal function that does not check if the sender is authorized to operate on the token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _burn(uint256 tokenId) internal virtual {\\n address owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\\n\\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\\n owner = ERC721Upgradeable.ownerOf(tokenId);\\n\\n // Clear approvals\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // Cannot overflow, as that would require more tokens to be burned/transferred\\n // out than the owner initially received through minting and transferring in.\\n _balances[owner] -= 1;\\n }\\n delete _owners[tokenId];\\n\\n emit Transfer(owner, address(0), tokenId);\\n\\n _afterTokenTransfer(owner, address(0), tokenId, 1);\\n }\\n\\n /**\\n * @dev Transfers `tokenId` from `from` to `to`.\\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\\n *\\n * Requirements:\\n *\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n *\\n * Emits a {Transfer} event.\\n */\\n function _transfer(\\n address from,\\n address to,\\n uint256 tokenId\\n ) internal virtual {\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n require(to != address(0), \\\"ERC721: transfer to the zero address\\\");\\n\\n _beforeTokenTransfer(from, to, tokenId, 1);\\n\\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \\\"ERC721: transfer from incorrect owner\\\");\\n\\n // Clear approvals from the previous owner\\n delete _tokenApprovals[tokenId];\\n\\n unchecked {\\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\\n // `from`'s balance is the number of token held, which is at least one before the current\\n // transfer.\\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\\n // all 2**256 token ids to be minted, which in practice is impossible.\\n _balances[from] -= 1;\\n _balances[to] += 1;\\n }\\n _owners[tokenId] = to;\\n\\n emit Transfer(from, to, tokenId);\\n\\n _afterTokenTransfer(from, to, tokenId, 1);\\n }\\n\\n /**\\n * @dev Approve `to` to operate on `tokenId`\\n *\\n * Emits an {Approval} event.\\n */\\n function _approve(address to, uint256 tokenId) internal virtual {\\n _tokenApprovals[tokenId] = to;\\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\\n }\\n\\n /**\\n * @dev Approve `operator` to operate on all of `owner` tokens\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function _setApprovalForAll(\\n address owner,\\n address operator,\\n bool approved\\n ) internal virtual {\\n require(owner != operator, \\\"ERC721: approve to caller\\\");\\n _operatorApprovals[owner][operator] = approved;\\n emit ApprovalForAll(owner, operator, approved);\\n }\\n\\n /**\\n * @dev Reverts if the `tokenId` has not been minted yet.\\n */\\n function _requireMinted(uint256 tokenId) internal view virtual {\\n require(_exists(tokenId), \\\"ERC721: invalid token ID\\\");\\n }\\n\\n /**\\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\\n * The call is not executed if the target address is not a contract.\\n *\\n * @param from address representing the previous owner of the given token ID\\n * @param to target address that will receive the tokens\\n * @param tokenId uint256 ID of the token to be transferred\\n * @param data bytes optional data to send along with the call\\n * @return bool whether the call correctly returned the expected magic value\\n */\\n function _checkOnERC721Received(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes memory data\\n ) private returns (bool) {\\n if (to.isContract()) {\\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\\n } catch (bytes memory reason) {\\n if (reason.length == 0) {\\n revert(\\\"ERC721: transfer to non ERC721Receiver implementer\\\");\\n } else {\\n /// @solidity memory-safe-assembly\\n assembly {\\n revert(add(32, reason), mload(reason))\\n }\\n }\\n }\\n } else {\\n return true;\\n }\\n }\\n\\n /**\\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\\n * - When `from` is zero, the tokens will be minted for `to`.\\n * - When `to` is zero, ``from``'s tokens will be burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\\n *\\n * Calling conditions:\\n *\\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\\n * - When `from` is zero, the tokens were minted for `to`.\\n * - When `to` is zero, ``from``'s tokens were burned.\\n * - `from` and `to` are never both zero.\\n * - `batchSize` is non-zero.\\n *\\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\\n */\\n function _afterTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual {}\\n\\n /**\\n * @dev Unsafe write access to the balances, used by extensions that \\\"mint\\\" tokens using an {ownerOf} override.\\n *\\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\\n * that `ownerOf(tokenId)` is `a`.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\\n _balances[account] += amount;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[44] private __gap;\\n}\\n\",\"keccak256\":\"0xac29c453f4cf43afe4c9599374b6e1ed493c18644d814554e8a5969aaa6f3486\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title ERC721 token receiver interface\\n * @dev Interface for any contract that wants to support safeTransfers\\n * from ERC721 asset contracts.\\n */\\ninterface IERC721ReceiverUpgradeable {\\n /**\\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\\n * by `operator` from `from`, this function is called.\\n *\\n * It must return its Solidity selector to confirm the token transfer.\\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\\n *\\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\\n */\\n function onERC721Received(\\n address operator,\\n address from,\\n uint256 tokenId,\\n bytes calldata data\\n ) external returns (bytes4);\\n}\\n\",\"keccak256\":\"0xbb2ed8106d94aeae6858e2551a1e7174df73994b77b13ebd120ccaaef80155f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165Upgradeable.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721Upgradeable is IERC165Upgradeable {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2c0b89cef83f353c6f9488c013d8a5968587ffdd6dfc26aad53774214b97e229\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC721Upgradeable.sol\\\";\\nimport \\\"./IERC721EnumerableUpgradeable.sol\\\";\\nimport \\\"../../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\\n * enumerability of all the token ids in the contract as well as all token ids owned by each\\n * account.\\n */\\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\\n function __ERC721Enumerable_init() internal onlyInitializing {\\n }\\n\\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\\n }\\n // Mapping from owner to list of owned token IDs\\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\\n\\n // Mapping from token ID to index of the owner tokens list\\n mapping(uint256 => uint256) private _ownedTokensIndex;\\n\\n // Array with all token ids, used for enumeration\\n uint256[] private _allTokens;\\n\\n // Mapping from token id to position in the allTokens array\\n mapping(uint256 => uint256) private _allTokensIndex;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\\n */\\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\\n require(index < ERC721Upgradeable.balanceOf(owner), \\\"ERC721Enumerable: owner index out of bounds\\\");\\n return _ownedTokens[owner][index];\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-totalSupply}.\\n */\\n function totalSupply() public view virtual override returns (uint256) {\\n return _allTokens.length;\\n }\\n\\n /**\\n * @dev See {IERC721Enumerable-tokenByIndex}.\\n */\\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \\\"ERC721Enumerable: global index out of bounds\\\");\\n return _allTokens[index];\\n }\\n\\n /**\\n * @dev See {ERC721-_beforeTokenTransfer}.\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 firstTokenId,\\n uint256 batchSize\\n ) internal virtual override {\\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\\n\\n if (batchSize > 1) {\\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\\n revert(\\\"ERC721Enumerable: consecutive transfers not supported\\\");\\n }\\n\\n uint256 tokenId = firstTokenId;\\n\\n if (from == address(0)) {\\n _addTokenToAllTokensEnumeration(tokenId);\\n } else if (from != to) {\\n _removeTokenFromOwnerEnumeration(from, tokenId);\\n }\\n if (to == address(0)) {\\n _removeTokenFromAllTokensEnumeration(tokenId);\\n } else if (to != from) {\\n _addTokenToOwnerEnumeration(to, tokenId);\\n }\\n }\\n\\n /**\\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\\n * @param to address representing the new owner of the given token ID\\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\\n */\\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\\n uint256 length = ERC721Upgradeable.balanceOf(to);\\n _ownedTokens[to][length] = tokenId;\\n _ownedTokensIndex[tokenId] = length;\\n }\\n\\n /**\\n * @dev Private function to add a token to this extension's token tracking data structures.\\n * @param tokenId uint256 ID of the token to be added to the tokens list\\n */\\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\\n _allTokensIndex[tokenId] = _allTokens.length;\\n _allTokens.push(tokenId);\\n }\\n\\n /**\\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\\n * @param from address representing the previous owner of the given token ID\\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\\n */\\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary\\n if (tokenIndex != lastTokenIndex) {\\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\\n\\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n }\\n\\n // This also deletes the contents at the last position of the array\\n delete _ownedTokensIndex[tokenId];\\n delete _ownedTokens[from][lastTokenIndex];\\n }\\n\\n /**\\n * @dev Private function to remove a token from this extension's token tracking data structures.\\n * This has O(1) time complexity, but alters the order of the _allTokens array.\\n * @param tokenId uint256 ID of the token to be removed from the tokens list\\n */\\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\\n // then delete the last slot (swap and pop).\\n\\n uint256 lastTokenIndex = _allTokens.length - 1;\\n uint256 tokenIndex = _allTokensIndex[tokenId];\\n\\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\\n uint256 lastTokenId = _allTokens[lastTokenIndex];\\n\\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\\n\\n // This also deletes the contents at the last position of the array\\n delete _allTokensIndex[tokenId];\\n _allTokens.pop();\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[46] private __gap;\\n}\\n\",\"keccak256\":\"0x2c98457c4171d86094adf9a4fd8cd2402b7e3e309e961f07910a60a576dd100f\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\\n /**\\n * @dev Returns the total amount of tokens stored by the contract.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\\n */\\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\\n\\n /**\\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\\n * Use along with {totalSupply} to enumerate all tokens.\\n */\\n function tokenByIndex(uint256 index) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xf1870306db8391db9cf14b41be0da76857a88df0e5c623d2b2338fb30a3bd5ff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC721Upgradeable.sol\\\";\\n\\n/**\\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\\n * @dev See https://eips.ethereum.org/EIPS/eip-721\\n */\\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\\n /**\\n * @dev Returns the token collection name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token collection symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\\n */\\n function tokenURI(uint256 tokenId) external view returns (string memory);\\n}\\n\",\"keccak256\":\"0x95a471796eb5f030fdc438660bebec121ad5d063763e64d92376ffb4b5ce8b70\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 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 (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 functionCallWithValue(target, data, 0, \\\"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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) 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(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResultFromTarget(target, 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(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\\n *\\n * _Available since v4.8._\\n */\\n function verifyCallResultFromTarget(\\n address target,\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n if (success) {\\n if (returndata.length == 0) {\\n // only check isContract if the call was successful and the return data is empty\\n // otherwise we already know that it was a contract\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n }\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n /**\\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason or using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n _revert(returndata, errorMessage);\\n }\\n }\\n\\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\\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 /// @solidity memory-safe-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\",\"keccak256\":\"0x2edcb41c121abc510932e8d83ff8b82cf9cdde35e7c297622f5c29ef0af25183\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @title Counters\\n * @author Matt Condon (@shrugs)\\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\\n *\\n * Include with `using Counters for Counters.Counter;`\\n */\\nlibrary CountersUpgradeable {\\n struct Counter {\\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\\n // this feature: see https://github.com/ethereum/solidity/issues/4637\\n uint256 _value; // default: 0\\n }\\n\\n function current(Counter storage counter) internal view returns (uint256) {\\n return counter._value;\\n }\\n\\n function increment(Counter storage counter) internal {\\n unchecked {\\n counter._value += 1;\\n }\\n }\\n\\n function decrement(Counter storage counter) internal {\\n uint256 value = counter._value;\\n require(value > 0, \\\"Counter: decrement overflow\\\");\\n unchecked {\\n counter._value = value - 1;\\n }\\n }\\n\\n function reset(Counter storage counter) internal {\\n counter._value = 0;\\n }\\n}\\n\",\"keccak256\":\"0x798741e231b22b81e2dd2eddaaf8832dee4baf5cd8e2dbaa5c1dd12a1c053c4d\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./math/MathUpgradeable.sol\\\";\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary StringsUpgradeable {\\n bytes16 private constant _SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n uint256 length = MathUpgradeable.log10(value) + 1;\\n string memory buffer = new string(length);\\n uint256 ptr;\\n /// @solidity memory-safe-assembly\\n assembly {\\n ptr := add(buffer, add(32, length))\\n }\\n while (true) {\\n ptr--;\\n /// @solidity memory-safe-assembly\\n assembly {\\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\\n }\\n value /= 10;\\n if (value == 0) break;\\n }\\n return buffer;\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n unchecked {\\n return toHexString(value, MathUpgradeable.log256(value) + 1);\\n }\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0x6b9a5d35b744b25529a2856a8093e7c03fb35a34b1c4fb5499e560f8ade140da\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../StringsUpgradeable.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSAUpgradeable {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV // Deprecated in v4.8\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", StringsUpgradeable.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0x12f297cafe6e2847ae0378502f155654d0764b532a9873c8afe4350950fa7971\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\\n *\\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\\n *\\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\\n * ({_hashTypedDataV4}).\\n *\\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\\n * the chain id to protect against replay attacks on an eventual fork of the chain.\\n *\\n * NOTE: This contract implements the version of the encoding known as \\\"v4\\\", as implemented by the JSON RPC method\\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\\n *\\n * _Available since v3.4._\\n *\\n * @custom:storage-size 52\\n */\\nabstract contract EIP712Upgradeable is Initializable {\\n /* solhint-disable var-name-mixedcase */\\n bytes32 private _HASHED_NAME;\\n bytes32 private _HASHED_VERSION;\\n bytes32 private constant _TYPE_HASH = keccak256(\\\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\\\");\\n\\n /* solhint-enable var-name-mixedcase */\\n\\n /**\\n * @dev Initializes the domain separator and parameter caches.\\n *\\n * The meaning of `name` and `version` is specified in\\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\\n *\\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\\n * - `version`: the current major version of the signing domain.\\n *\\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\\n * contract upgrade].\\n */\\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\\n __EIP712_init_unchained(name, version);\\n }\\n\\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\\n bytes32 hashedName = keccak256(bytes(name));\\n bytes32 hashedVersion = keccak256(bytes(version));\\n _HASHED_NAME = hashedName;\\n _HASHED_VERSION = hashedVersion;\\n }\\n\\n /**\\n * @dev Returns the domain separator for the current chain.\\n */\\n function _domainSeparatorV4() internal view returns (bytes32) {\\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\\n }\\n\\n function _buildDomainSeparator(\\n bytes32 typeHash,\\n bytes32 nameHash,\\n bytes32 versionHash\\n ) private view returns (bytes32) {\\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\\n }\\n\\n /**\\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\\n * function returns the hash of the fully encoded EIP712 message for this domain.\\n *\\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\\n *\\n * ```solidity\\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\\n * keccak256(\\\"Mail(address to,string contents)\\\"),\\n * mailTo,\\n * keccak256(bytes(mailContents))\\n * )));\\n * address signer = ECDSA.recover(digest, signature);\\n * ```\\n */\\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\\n }\\n\\n /**\\n * @dev The hash of the name parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712NameHash() internal virtual view returns (bytes32) {\\n return _HASHED_NAME;\\n }\\n\\n /**\\n * @dev The hash of the version parameter for the EIP712 domain.\\n *\\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\\n * are a concern.\\n */\\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\\n return _HASHED_VERSION;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x3017aded62c4a2b9707f5f06f92934e592c1c9b6f384b91b51340a6d5f841931\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/SignatureChecker.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./ECDSAUpgradeable.sol\\\";\\nimport \\\"../AddressUpgradeable.sol\\\";\\nimport \\\"../../interfaces/IERC1271Upgradeable.sol\\\";\\n\\n/**\\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\\n * Argent and Gnosis Safe.\\n *\\n * _Available since v4.1._\\n */\\nlibrary SignatureCheckerUpgradeable {\\n /**\\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\\n *\\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\\n */\\n function isValidSignatureNow(\\n address signer,\\n bytes32 hash,\\n bytes memory signature\\n ) internal view returns (bool) {\\n (address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hash, signature);\\n if (error == ECDSAUpgradeable.RecoverError.NoError && recovered == signer) {\\n return true;\\n }\\n\\n (bool success, bytes memory result) = signer.staticcall(\\n abi.encodeWithSelector(IERC1271Upgradeable.isValidSignature.selector, hash, signature)\\n );\\n return (success &&\\n result.length == 32 &&\\n abi.decode(result, (bytes32)) == bytes32(IERC1271Upgradeable.isValidSignature.selector));\\n }\\n}\\n\",\"keccak256\":\"0x5f6f34a77bdf88981d8985a33ebdb727df972172df6bdbb2a1bd480ce0bd43cb\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165Upgradeable.sol\\\";\\nimport \\\"../../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\\n function __ERC165_init() internal onlyInitializing {\\n }\\n\\n function __ERC165_init_unchained() internal onlyInitializing {\\n }\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165Upgradeable).interfaceId;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x9a3b990bd56d139df3e454a9edf1c64668530b5a77fc32eb063bc206f958274a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165Upgradeable {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xc6cef87559d0aeffdf0a99803de655938a7779ec0a3cd5d4383483ad85565a09\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Standard math utilities missing in the Solidity language.\\n */\\nlibrary MathUpgradeable {\\n enum Rounding {\\n Down, // Toward negative infinity\\n Up, // Toward infinity\\n Zero // Toward zero\\n }\\n\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the average of two numbers. The result is rounded towards\\n * zero.\\n */\\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b) / 2 can overflow.\\n return (a & b) + (a ^ b) / 2;\\n }\\n\\n /**\\n * @dev Returns the ceiling of the division of two numbers.\\n *\\n * This differs from standard division with `/` in that it rounds up instead\\n * of rounding down.\\n */\\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\\n // (a + b - 1) / b can overflow on addition, so we distribute.\\n return a == 0 ? 0 : (a - 1) / b + 1;\\n }\\n\\n /**\\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\\n * with further edits by Uniswap Labs also under MIT license.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator\\n ) internal pure returns (uint256 result) {\\n unchecked {\\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\\n // variables such that product = prod1 * 2^256 + prod0.\\n uint256 prod0; // Least significant 256 bits of the product\\n uint256 prod1; // Most significant 256 bits of the product\\n assembly {\\n let mm := mulmod(x, y, not(0))\\n prod0 := mul(x, y)\\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\\n }\\n\\n // Handle non-overflow cases, 256 by 256 division.\\n if (prod1 == 0) {\\n return prod0 / denominator;\\n }\\n\\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\\n require(denominator > prod1);\\n\\n ///////////////////////////////////////////////\\n // 512 by 256 division.\\n ///////////////////////////////////////////////\\n\\n // Make division exact by subtracting the remainder from [prod1 prod0].\\n uint256 remainder;\\n assembly {\\n // Compute remainder using mulmod.\\n remainder := mulmod(x, y, denominator)\\n\\n // Subtract 256 bit number from 512 bit number.\\n prod1 := sub(prod1, gt(remainder, prod0))\\n prod0 := sub(prod0, remainder)\\n }\\n\\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\\n // See https://cs.stackexchange.com/q/138556/92363.\\n\\n // Does not overflow because the denominator cannot be zero at this stage in the function.\\n uint256 twos = denominator & (~denominator + 1);\\n assembly {\\n // Divide denominator by twos.\\n denominator := div(denominator, twos)\\n\\n // Divide [prod1 prod0] by twos.\\n prod0 := div(prod0, twos)\\n\\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\\n twos := add(div(sub(0, twos), twos), 1)\\n }\\n\\n // Shift in bits from prod1 into prod0.\\n prod0 |= prod1 * twos;\\n\\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\\n // four bits. That is, denominator * inv = 1 mod 2^4.\\n uint256 inverse = (3 * denominator) ^ 2;\\n\\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\\n // in modular arithmetic, doubling the correct bits in each step.\\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\\n\\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\\n // is no longer required.\\n result = prod0 * inverse;\\n return result;\\n }\\n }\\n\\n /**\\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\\n */\\n function mulDiv(\\n uint256 x,\\n uint256 y,\\n uint256 denominator,\\n Rounding rounding\\n ) internal pure returns (uint256) {\\n uint256 result = mulDiv(x, y, denominator);\\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\\n result += 1;\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\\n *\\n * Inspired by Henry S. Warren, Jr.'s \\\"Hacker's Delight\\\" (Chapter 11).\\n */\\n function sqrt(uint256 a) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\\n //\\n // We know that the \\\"msb\\\" (most significant bit) of our target number `a` is a power of 2 such that we have\\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\\n //\\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\\n // \\u2192 `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\\n // \\u2192 `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\\n //\\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\\n uint256 result = 1 << (log2(a) >> 1);\\n\\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\\n // into the expected uint128 result.\\n unchecked {\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n result = (result + a / result) >> 1;\\n return min(result, a / result);\\n }\\n }\\n\\n /**\\n * @notice Calculates sqrt(a), following the selected rounding direction.\\n */\\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = sqrt(a);\\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 2, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 128;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 64;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 32;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 16;\\n }\\n if (value >> 8 > 0) {\\n value >>= 8;\\n result += 8;\\n }\\n if (value >> 4 > 0) {\\n value >>= 4;\\n result += 4;\\n }\\n if (value >> 2 > 0) {\\n value >>= 2;\\n result += 2;\\n }\\n if (value >> 1 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log2(value);\\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 10, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >= 10**64) {\\n value /= 10**64;\\n result += 64;\\n }\\n if (value >= 10**32) {\\n value /= 10**32;\\n result += 32;\\n }\\n if (value >= 10**16) {\\n value /= 10**16;\\n result += 16;\\n }\\n if (value >= 10**8) {\\n value /= 10**8;\\n result += 8;\\n }\\n if (value >= 10**4) {\\n value /= 10**4;\\n result += 4;\\n }\\n if (value >= 10**2) {\\n value /= 10**2;\\n result += 2;\\n }\\n if (value >= 10**1) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log10(value);\\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\\n }\\n }\\n\\n /**\\n * @dev Return the log in base 256, rounded down, of a positive value.\\n * Returns 0 if given 0.\\n *\\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\\n */\\n function log256(uint256 value) internal pure returns (uint256) {\\n uint256 result = 0;\\n unchecked {\\n if (value >> 128 > 0) {\\n value >>= 128;\\n result += 16;\\n }\\n if (value >> 64 > 0) {\\n value >>= 64;\\n result += 8;\\n }\\n if (value >> 32 > 0) {\\n value >>= 32;\\n result += 4;\\n }\\n if (value >> 16 > 0) {\\n value >>= 16;\\n result += 2;\\n }\\n if (value >> 8 > 0) {\\n result += 1;\\n }\\n }\\n return result;\\n }\\n\\n /**\\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\\n * Returns 0 if given 0.\\n */\\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\\n unchecked {\\n uint256 result = log256(value);\\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xc1bd5b53319c68f84e3becd75694d941e8f4be94049903232cd8bc7c535aaa5a\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)\\n\\npragma solidity ^0.8.0;\\n\\n// CAUTION\\n// This version of SafeMath should only be used with Solidity 0.8 or later,\\n// because it relies on the compiler's built in overflow checks.\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations.\\n *\\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\\n * now has built in overflow checking.\\n */\\nlibrary SafeMathUpgradeable {\\n /**\\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n uint256 c = a + b;\\n if (c < a) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b > a) return (false, 0);\\n return (true, a - b);\\n }\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) return (true, 0);\\n uint256 c = a * b;\\n if (c / a != b) return (false, 0);\\n return (true, c);\\n }\\n }\\n\\n /**\\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a / b);\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\\n *\\n * _Available since v3.4._\\n */\\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\\n unchecked {\\n if (b == 0) return (false, 0);\\n return (true, a % b);\\n }\\n }\\n\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a + b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - b;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a * b;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator.\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a / b;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a % b;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {trySub}.\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b <= a, errorMessage);\\n return a - b;\\n }\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a / b;\\n }\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * reverting with custom message when dividing by zero.\\n *\\n * CAUTION: This function is deprecated because it requires allocating memory for the error\\n * message unnecessarily. For custom revert reasons use {tryMod}.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(\\n uint256 a,\\n uint256 b,\\n string memory errorMessage\\n ) internal pure returns (uint256) {\\n unchecked {\\n require(b > 0, errorMessage);\\n return a % b;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xcaa8b7861115ea691c77ddbeac140a444e0edcd1d9812a43942c0f6b42b36a49\",\"license\":\"MIT\"},\"contracts/DealsRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\\\";\\nimport \\\"./interfaces/IEntitiesRegistry.sol\\\";\\nimport \\\"./interfaces/IConfig.sol\\\";\\nimport \\\"./libraries/Utils.sol\\\";\\nimport \\\"./libraries/SignatureUtils.sol\\\";\\nimport \\\"./utils/IERC20.sol\\\";\\n\\n/**\\n * @title DealsRegistry\\n * @dev A smart contract for creating and managing deals between buyers and sellers.\\n * The contract stores offers made by suppliers, and allows buyers to create deals based on those offers.\\n * Each deal specifies the payment and cancellation terms, and can be tracked on-chain using its unique Id.\\n */\\nabstract contract DealsRegistry is\\n EIP712Upgradeable,\\n PausableUpgradeable,\\n OwnableUpgradeable\\n{\\n using SignatureCheckerUpgradeable for address;\\n using SignatureUtils for bytes;\\n using SafeMathUpgradeable for uint256;\\n\\n /// @dev The protocol config contract address\\n address public config;\\n\\n /// @dev Entities registry contract address\\n address public entities;\\n\\n /// @dev Mapping of context to allowed statuses list\\n mapping(bytes32 => Utils.DealStatus[]) private allowedStatuses;\\n\\n /// @dev Mapping of an offer Id on a Deal\\n mapping(bytes32 => Utils.Deal) public deals;\\n\\n /// @dev Emitted when a Deal status is updated\\n event Status(bytes32 offerId, Utils.DealStatus status, address sender);\\n\\n /// @dev Emitted when updated an address of the protocol config contract\\n event SetConfig(address oldAddress, address newAddress);\\n\\n /// @dev Emitted when updated an address of the Entities registry contract\\n event SetEntities(address oldAddress, address newAddress);\\n\\n /// @dev Thrown when a user attempts to create a deal using an offer with an invalid signature\\n error InvalidOfferSignature();\\n\\n /// @dev Thrown when a user attempts to create an already existing Deal\\n error DealExists();\\n\\n /// @dev Thrown when Deal was created in the `_beforeCreate` hook\\n error DealAlreadyCreated();\\n\\n /// @dev Thrown when the Deal is not found\\n error DealNotFound();\\n\\n /// @dev Thrown when a user attempts to create a deal providing an invalid payment options\\n error InvalidPaymentOptions();\\n\\n /// @dev Thrown when a user attempts to create a deal providing an invalid payment option Id\\n error InvalidPaymentId();\\n\\n /// @dev Thrown when a Deal funds transfer is failed\\n error DealFundsTransferFailed();\\n\\n /// @dev Thrown when the retailer of the offer is not found\\n error InvalidRetailer();\\n\\n /// @dev Thrown when the supplier of the offer is not enabled\\n error DisabledSupplier();\\n\\n /// @dev Thrown when the retailer is not enabled\\n error DisabledRetailer();\\n\\n /// @dev Thrown when a function call is not allowed for current user\\n error NotAllowedAuth();\\n\\n /// @dev Thrown when a user attempts to claim the deal in non-created status\\n error NotAllowedStatus();\\n\\n /// @dev Thrown when a user attempts to do something that not allowed at a moment\\n error NotAllowedTime();\\n\\n /// @dev Thrown when a user attempts to cancel the deal using invalid cancellation options\\n error InvalidCancelOptions();\\n\\n /**\\n * @dev DealsRegistry initializer\\n * @param _name The name of the contract\\n * @param _version The version of the contract\\n * @param _config The protocol config contract address\\n * @param _entities Entities registry contract address\\n */\\n function __DealsRegistry_init(\\n string memory _name,\\n string memory _version,\\n address _config,\\n address _entities\\n ) internal onlyInitializing {\\n __EIP712_init(_name, _version);\\n __Pausable_init();\\n\\n // Save the protocol config contract address\\n config = _config;\\n\\n // Save entities registry address\\n entities = _entities;\\n\\n // Allowed statuses for functions execution\\n allowedStatuses[\\\"reject\\\"] = [Utils.DealStatus.Created];\\n allowedStatuses[\\\"cancel\\\"] = [\\n Utils.DealStatus.Created,\\n Utils.DealStatus.Claimed\\n ];\\n allowedStatuses[\\\"refund\\\"] = [\\n Utils.DealStatus.Claimed,\\n Utils.DealStatus.CheckedIn\\n ];\\n allowedStatuses[\\\"claim\\\"] = [Utils.DealStatus.Created];\\n allowedStatuses[\\\"checkIn\\\"] = [Utils.DealStatus.Claimed];\\n allowedStatuses[\\\"checkOut\\\"] = [Utils.DealStatus.CheckedIn];\\n allowedStatuses[\\\"dispute\\\"] = [\\n Utils.DealStatus.CheckedIn,\\n Utils.DealStatus.CheckedOut\\n ];\\n }\\n\\n /// Modifiers\\n\\n /**\\n * @dev Modifier to make a function callable only when deal is exists\\n *\\n * Requirements:\\n *\\n * - the deal of the `offerId` must exists\\n */\\n modifier dealExists(bytes32 offerId) {\\n if (deals[offerId].offer.id == bytes32(0)) {\\n revert DealNotFound();\\n }\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when deal in specific statuses.\\n *\\n * Requirements:\\n *\\n * - the deal of the `offerId` must exists\\n * - the deal is in `statuses`\\n */\\n modifier inStatuses(bytes32 offerId, Utils.DealStatus[] memory statuses) {\\n uint256 allowed;\\n Utils.DealStatus currentStatus = deals[offerId].status;\\n\\n for (uint256 i = 0; i < statuses.length; i++) {\\n if (currentStatus == statuses[i]) {\\n allowed = 1;\\n break;\\n }\\n }\\n\\n if (allowed != 1) {\\n revert NotAllowedStatus();\\n }\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only by supplier's signer.\\n *\\n * Requirements:\\n *\\n * - the function called by the supplier's signer\\n */\\n modifier onlySigner(bytes32 offerId) {\\n if (\\n _msgSender() !=\\n IEntitiesRegistry(entities)\\n .getEntity(deals[offerId].offer.supplierId)\\n .signer\\n ) {\\n revert NotAllowedAuth();\\n }\\n _;\\n }\\n\\n /// Utilities\\n\\n /**\\n * @dev Sets the new address of the protocol config contract address\\n * @param _config The new protocol config contract address\\n */\\n function setConfig(address _config) external onlyOwner {\\n emit SetConfig(config, _config);\\n config = _config;\\n }\\n\\n /**\\n * @dev Sets the new address of the entities registry\\n * @param _entities The new protocol config contract address\\n */\\n function setEntities(address _entities) external onlyOwner {\\n emit SetEntities(entities, _entities);\\n entities = _entities;\\n }\\n\\n /// Workflow hooks\\n\\n /**\\n * @dev Hook function that runs before a new deal is created.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offer The offer used to create the deal\\n * @param price The price of the asset in wei\\n * @param asset The address of the ERC20 token used for payment\\n * @param signs An array of signatures authorizing the creation of the deal\\n */\\n function _beforeCreate(\\n Utils.Offer memory offer,\\n uint256 price,\\n address asset,\\n bytes[] memory signs\\n ) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after a new deal is created.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offer The offer used to create the deal\\n * @param price The price of the asset in wei\\n * @param asset The address of the ERC20 token used for payment\\n * @param signs An array of signatures authorizing the creation of the deal\\n */\\n function _afterCreate(\\n Utils.Offer memory offer,\\n uint256 price,\\n address asset,\\n bytes[] memory signs\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is rejected by a supplier.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param reason Rejection reason\\n */\\n function _beforeReject(\\n bytes32 offerId,\\n bytes32 reason\\n ) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is rejected by s supplier.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param reason Rejection reason\\n */\\n function _afterReject(bytes32 offerId, bytes32 reason) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is canceled.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _beforeCancel(bytes32 offerId) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is canceled.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _afterCancel(bytes32 offerId) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is refunded.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _beforeRefund(bytes32 offerId) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is refunded.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _afterRefund(bytes32 offerId) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is claimed.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param buyer Address of the deal buyer\\n */\\n function _beforeClaim(\\n bytes32 offerId,\\n address buyer\\n ) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is claimed.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param buyer Address of the deal buyer\\n */\\n function _afterClaim(bytes32 offerId, address buyer) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is checked in.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param signs An array of signatures authorizing the check in of the deal\\n */\\n function _beforeCheckIn(\\n bytes32 offerId,\\n bytes[] memory signs\\n ) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is checked in.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n * @param signs An array of signatures authorizing the check in of the deal\\n */\\n function _afterCheckIn(\\n bytes32 offerId,\\n bytes[] memory signs\\n ) internal virtual {}\\n\\n /**\\n * @dev Hook function that runs before the deal is checked out.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _beforeCheckOut(bytes32 offerId) internal virtual whenNotPaused {}\\n\\n /**\\n * @dev Hook function that runs after the deal is checked out.\\n * Allows inheriting smart contracts to perform custom logic.\\n * @param offerId The offerId of the deal\\n */\\n function _afterCheckOut(bytes32 offerId) internal virtual {}\\n\\n /// Features\\n\\n /**\\n * @dev Creates a Deal on a base of an offer\\n * @param offer An offer payload\\n * @param paymentOptions Raw offered payment options array\\n * @param paymentId Payment option Id\\n * @param retailerId Retailer Id\\n * @param signs Signatures: [0] - offer: ECDSA/ERC1271; [1] - asset permit: ECDSA (optional)\\n *\\n * Requirements:\\n *\\n * - supplier of the offer must be registered\\n * - offer must be signed with a proper signer\\n * - the deal should not be created before\\n * - the deal should not be created inside the _before hook\\n * - payment options must be valid (equal to those from the offer)\\n * - payment Id must exists in payment options\\n * - the contract must be able to make transfer of funds\\n *\\n * NOTE: `permit` signature can be ECDSA of type only\\n */\\n function deal(\\n Utils.Offer memory offer,\\n Utils.PaymentOption[] memory paymentOptions,\\n bytes32 paymentId,\\n bytes32 retailerId,\\n bytes[] memory signs\\n ) external {\\n address buyer = _msgSender();\\n\\n /// @dev variable scoping used to avoid stack too deep errors\\n /// The `supplier` storage variable is required is the frame of this scope only\\n {\\n bytes32 offerHash = _hashTypedDataV4(Utils.hash(offer));\\n IEntitiesRegistry.Entity memory supplier = IEntitiesRegistry(entities)\\n .getEntity(offer.supplierId);\\n\\n // Checking ECDSA/AA signature is valid\\n if (!supplier.signer.isValidSignatureNow(offerHash, signs[0])) {\\n revert InvalidOfferSignature();\\n }\\n\\n // Not-enabled suppliers are not allowed to accept deals\\n // So, we cannot allow to create such a deal\\n if (!IEntitiesRegistry(entities).isEntityEnabled(offer.supplierId)) {\\n revert DisabledSupplier();\\n }\\n\\n // The retailer is optional, so we validate its rules only if retailerId is defined\\n if (retailerId != bytes32(0)) {\\n IEntitiesRegistry.Entity memory retailer = IEntitiesRegistry(entities)\\n .getEntity(retailerId);\\n\\n // Retailer must be registered\\n if (retailer.owner == address(0)) {\\n revert InvalidRetailer();\\n }\\n\\n // Not-enabled retailer are not allowed\\n if (!IEntitiesRegistry(entities).isEntityEnabled(retailerId)) {\\n revert DisabledRetailer();\\n }\\n }\\n\\n // Deal can be created only once\\n if (deals[offer.id].offer.id == offer.id) {\\n revert DealExists();\\n }\\n\\n bytes32 paymentHash = Utils.hash(paymentOptions);\\n\\n // payment options provided with argument must be the same\\n // as signed in the offer\\n if (paymentHash != offer.paymentHash) {\\n revert InvalidPaymentOptions();\\n }\\n }\\n\\n uint256 price;\\n address asset;\\n\\n for (uint256 i = 0; i < paymentOptions.length; i++) {\\n // Payment id must be one of the defined in payment options\\n if (paymentOptions[i].id == paymentId) {\\n price = paymentOptions[i].price;\\n asset = paymentOptions[i].asset;\\n break;\\n }\\n }\\n\\n if (asset == address(0)) {\\n revert InvalidPaymentId();\\n }\\n\\n _beforeCreate(offer, price, asset, signs);\\n\\n // Check that the deal was not created by `_beforeCreate` hook\\n if (deals[offer.id].offer.id == offer.id) {\\n revert DealAlreadyCreated();\\n }\\n\\n // Creating the deal before any external call to avoid reentrancy\\n deals[offer.id] = Utils.Deal(\\n block.timestamp,\\n offer,\\n retailerId,\\n buyer,\\n price,\\n asset,\\n Utils.DealStatus.Created\\n );\\n\\n if (signs.length > 1) {\\n // Use permit function to transfer tokens from the sender to the contract\\n (uint8 v, bytes32 r, bytes32 s) = signs[1].split();\\n IERC20(asset).permit(buyer, address(this), price, offer.expire, v, r, s);\\n }\\n\\n // Use transferFrom function to transfer tokens from the sender to the contract\\n if (!IERC20(asset).transferFrom(buyer, address(this), price)) {\\n revert DealFundsTransferFailed();\\n }\\n\\n emit Status(offer.id, Utils.DealStatus.Created, buyer);\\n\\n _afterCreate(offer, price, asset, signs);\\n }\\n\\n /**\\n * @dev Rejects the deal\\n * @param offerId The deal offer Id\\n * @param reason Rejection reason\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.Created\\n * - must be called by the signer address of the deal offer supplier\\n */\\n function reject(\\n bytes32 offerId,\\n bytes32 reason\\n )\\n external\\n dealExists(offerId)\\n onlySigner(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"reject\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n // Moving to the Rejected status before all to avoid reentrancy\\n storedDeal.status = Utils.DealStatus.Rejected;\\n\\n _beforeReject(offerId, reason);\\n\\n if (\\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n emit Status(offerId, Utils.DealStatus.Rejected, _msgSender());\\n\\n _afterReject(offerId, reason);\\n }\\n\\n /**\\n * @dev Refunds the deal\\n * @param offerId The deal offer Id\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.CheckedIn\\n * - must be called by the signer address of the deal offer supplier\\n */\\n function refund(\\n bytes32 offerId\\n )\\n external\\n dealExists(offerId)\\n onlySigner(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"refund\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n // Moving to the Refunded status before all to avoid reentrancy\\n storedDeal.status = Utils.DealStatus.Refunded;\\n\\n _beforeRefund(offerId);\\n\\n if (\\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n emit Status(offerId, Utils.DealStatus.Refunded, _msgSender());\\n\\n _afterRefund(offerId);\\n }\\n\\n /**\\n * @dev Cancels the deal\\n * @param offerId The deal offer Id\\n * @param _cancelOptions Cancellation options from offer\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.Created or DealStatus.Claimed\\n * - must be called by buyer\\n * - if the deal in DealStatus.Claimed status:\\n * - if block.timestamp > checkIn time then zero refund\\n * - cancellation rules must follow the rules defined by offer\\n */\\n function cancel(\\n bytes32 offerId,\\n Utils.CancelOption[] memory _cancelOptions\\n )\\n external\\n dealExists(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"cancel\\\"])\\n {\\n address sender = _msgSender();\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n if (sender != storedDeal.buyer) {\\n revert NotAllowedAuth();\\n }\\n\\n // Buyer is not able to cancel the deal during `claim_period`\\n // This time is given to the supplier to claim the deal\\n if (\\n block.timestamp <\\n storedDeal.created.add(IConfig(config).getNumber(\\\"claim_period\\\"))\\n ) {\\n revert NotAllowedTime();\\n }\\n\\n Utils.DealStatus callStatus = storedDeal.status;\\n\\n // Moving to the Cancelled status before all to avoid reentrancy\\n storedDeal.status = Utils.DealStatus.Cancelled;\\n\\n _beforeCancel(offerId);\\n\\n if (callStatus == Utils.DealStatus.Created) {\\n // Full refund\\n if (\\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n } else if (\\n callStatus == Utils.DealStatus.Claimed &&\\n block.timestamp < storedDeal.offer.checkIn\\n ) {\\n if (storedDeal.offer.cancelHash != Utils.hash(_cancelOptions)) {\\n revert InvalidCancelOptions();\\n }\\n\\n // Using offer cancellation rules\\n uint256 selectedTime;\\n uint256 selectedPenalty;\\n\\n for (uint256 i = 0; i < _cancelOptions.length; i++) {\\n if (\\n block.timestamp >= _cancelOptions[i].time &&\\n (selectedTime == 0 || _cancelOptions[i].time < selectedTime)\\n ) {\\n selectedTime = _cancelOptions[i].time;\\n selectedPenalty = _cancelOptions[i].penalty;\\n }\\n }\\n\\n if (selectedPenalty > 100) {\\n selectedPenalty = 100;\\n }\\n\\n uint256 penaltyValue = Utils._percentage(\\n storedDeal.price,\\n selectedPenalty\\n );\\n\\n if (\\n !IERC20(storedDeal.asset).transfer(\\n storedDeal.buyer,\\n storedDeal.price.sub(penaltyValue)\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n if (\\n penaltyValue > 0 &&\\n !IERC20(storedDeal.asset).transfer(\\n IEntitiesRegistry(entities)\\n .getEntity(storedDeal.offer.supplierId)\\n .owner,\\n penaltyValue\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n } else {\\n revert NotAllowedStatus();\\n }\\n\\n emit Status(offerId, Utils.DealStatus.Cancelled, sender);\\n\\n _afterCancel(offerId);\\n }\\n\\n /**\\n * @dev Claims the deal\\n * @param offerId The deal offer Id\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.Created\\n * - must be called by the signer address of the deal offer supplier\\n */\\n function claim(\\n bytes32 offerId\\n )\\n external\\n dealExists(offerId)\\n onlySigner(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"claim\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n _beforeClaim(offerId, storedDeal.buyer);\\n\\n storedDeal.status = Utils.DealStatus.Claimed;\\n emit Status(offerId, Utils.DealStatus.Claimed, _msgSender());\\n\\n _afterClaim(offerId, storedDeal.buyer);\\n }\\n\\n /**\\n * @dev Checks in the deal\\n * @param offerId The deal offer Id\\n * @param signs Signatures\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - the deal must be in status DealStatus.Claimed\\n * - must be called by the supplier's signer or buyer's address\\n * - if called by the supplier's signer:\\n * - a valid signature of suppliers's signer must be provided in signs[0]\\n * - if before sign-in time: a valid signature of the buyer must be provided in signs[1]\\n * - if called buy buyer:\\n * - a valid signature of the buyer must be provided in signs[0]\\n * - a valid signature of suppliers's signer must be provided in signs[1]\\n */\\n function checkIn(\\n bytes32 offerId,\\n bytes[] memory signs\\n )\\n external\\n dealExists(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"checkIn\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n IEntitiesRegistry.Entity memory supplier = IEntitiesRegistry(entities)\\n .getEntity(storedDeal.offer.supplierId);\\n\\n address sender = _msgSender();\\n bytes32 signInHash;\\n\\n if (sender == supplier.signer) {\\n // The function is called by the supplier's signer\\n signInHash = _hashTypedDataV4(\\n Utils.hashCheckInOut(storedDeal.offer.id, supplier.signer)\\n );\\n\\n // Checking ECDSA/AA signature of the suppliers's signer is valid\\n if (!supplier.signer.isValidSignatureNow(signInHash, signs[0])) {\\n revert InvalidOfferSignature();\\n }\\n\\n // Before checkIn time of the offer a signature of the buyer is required\\n if (block.timestamp < storedDeal.offer.checkIn) {\\n signInHash = _hashTypedDataV4(\\n Utils.hashCheckInOut(storedDeal.offer.id, storedDeal.buyer)\\n );\\n\\n // Checking ECDSA/AA signature of the buyer is valid\\n if (!storedDeal.buyer.isValidSignatureNow(signInHash, signs[1])) {\\n revert InvalidOfferSignature();\\n }\\n }\\n } else if (sender == storedDeal.buyer) {\\n signInHash = _hashTypedDataV4(\\n Utils.hashCheckInOut(storedDeal.offer.id, storedDeal.buyer)\\n );\\n\\n // Checking ECDSA/AA signature of the suppliers's signer is valid\\n if (!storedDeal.buyer.isValidSignatureNow(signInHash, signs[0])) {\\n revert InvalidOfferSignature();\\n }\\n\\n signInHash = _hashTypedDataV4(\\n Utils.hashCheckInOut(storedDeal.offer.id, supplier.signer)\\n );\\n\\n // Checking ECDSA/AA signature of the buyer is valid\\n if (!supplier.signer.isValidSignatureNow(signInHash, signs[1])) {\\n revert InvalidOfferSignature();\\n }\\n } else {\\n revert NotAllowedAuth();\\n }\\n\\n // Execute before checkIn hook\\n _beforeCheckIn(offerId, signs);\\n\\n storedDeal.status = Utils.DealStatus.CheckedIn;\\n emit Status(offerId, Utils.DealStatus.CheckedIn, sender);\\n\\n // Execute after checkIn hook\\n _afterCheckIn(offerId, signs);\\n }\\n\\n /**\\n * @dev Checks out the deal and sends funds to the supplier\\n * @param offerId The deal offer Id\\n *\\n * Requirements:\\n *\\n * - the deal must exists\\n * - must be called by the supplier's signer only\\n * - the deal must be in status DealStatus.CheckIn\\n * - must be called after checkOut time only\\n */\\n function checkOut(\\n bytes32 offerId\\n )\\n external\\n dealExists(offerId)\\n onlySigner(offerId)\\n inStatuses(offerId, allowedStatuses[\\\"checkOut\\\"])\\n {\\n Utils.Deal storage storedDeal = deals[offerId];\\n\\n if (block.timestamp < storedDeal.offer.checkOut) {\\n revert NotAllowedTime();\\n }\\n\\n // Moving to CheckedOut status before all to avoid reentrancy\\n storedDeal.status = Utils.DealStatus.CheckedOut;\\n\\n // Execute before checkOut hook\\n _beforeCheckOut(offerId);\\n\\n uint256 protocolFee;\\n uint256 retailerFee;\\n uint256 supplierValue;\\n\\n protocolFee = Utils._percentage(\\n storedDeal.price,\\n IConfig(config).getNumber(\\\"protocol_fee\\\")\\n );\\n\\n if (storedDeal.retailerId != bytes32(0)) {\\n retailerFee = Utils._percentage(\\n storedDeal.price,\\n IConfig(config).getNumber(\\\"retailer_fee\\\")\\n );\\n }\\n\\n supplierValue = storedDeal.price.sub(protocolFee).sub(retailerFee);\\n\\n if (\\n protocolFee > 0 &&\\n // Sends fee to the protocol recipient\\n !IERC20(storedDeal.asset).transfer(\\n IConfig(config).getAddress(\\\"fee_recipient\\\"),\\n protocolFee\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n if (\\n retailerFee > 0 &&\\n // Send fee to the deal retailer\\n !IERC20(storedDeal.asset).transfer(\\n IEntitiesRegistry(entities).getEntity(storedDeal.retailerId).owner,\\n retailerFee\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n if (\\n // Sends value to the supplier\\n !IERC20(storedDeal.asset).transfer(\\n IEntitiesRegistry(entities)\\n .getEntity(storedDeal.offer.supplierId)\\n .owner,\\n supplierValue\\n )\\n ) {\\n revert DealFundsTransferFailed();\\n }\\n\\n emit Status(offerId, Utils.DealStatus.CheckedOut, _msgSender());\\n\\n // Execute after checkOut hook\\n _afterCheckOut(offerId);\\n }\\n\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x0cae627472d2521a751ef0c9242ce97cecbc4625a7947c11b4f3009394442e74\",\"license\":\"MIT\"},\"contracts/ERC721Token.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\\\";\\n\\n/**\\n * @title ERC721Token\\n * @dev Abstract contract that defines an ERC721 token\\n * with additional functionality for enumeration and pausing\\n */\\nabstract contract ERC721Token is\\n ERC721Upgradeable,\\n ERC721EnumerableUpgradeable,\\n PausableUpgradeable,\\n OwnableUpgradeable\\n{\\n using CountersUpgradeable for CountersUpgradeable.Counter;\\n\\n /// @dev Internal counter to keep track of tokenIds\\n CountersUpgradeable.Counter private _tokenIdCounter;\\n\\n /**\\n * @dev Initializer that sets the name and symbol of the token\\n * @param name The name of the token\\n * @param symbol The symbol of the token\\n */\\n function __ERC721Token_init(\\n string memory name,\\n string memory symbol\\n ) internal onlyInitializing {\\n __ERC721_init(name, symbol);\\n __ERC721Enumerable_init();\\n __Pausable_init();\\n }\\n\\n /**\\n * @dev Internal function to safely mint an NFT to an address with custom URI\\n * @param to The address that will receive the minted NFT\\n */\\n function safeMint(address to) internal returns (uint256) {\\n uint256 tokenId = _tokenIdCounter.current();\\n _tokenIdCounter.increment();\\n _safeMint(to, tokenId);\\n return tokenId;\\n }\\n\\n /**\\n * @dev Internal function to safely burn an NFT\\n * @param tokenId The ID of the NFT to be burnt\\n */\\n function safeBurn(uint256 tokenId) internal {\\n require(\\n _isApprovedOrOwner(_msgSender(), tokenId),\\n \\\"ERC721: caller is not token owner or approved\\\"\\n );\\n _burn(tokenId);\\n }\\n\\n /// @inheritdoc ERC721Upgradeable\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n uint256 batchSize\\n )\\n internal\\n virtual\\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\\n whenNotPaused\\n {\\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\\n }\\n\\n /// @inheritdoc ERC721Upgradeable\\n function supportsInterface(\\n bytes4 interfaceId\\n )\\n public\\n view\\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\\n returns (bool)\\n {\\n return super.supportsInterface(interfaceId);\\n }\\n}\\n\",\"keccak256\":\"0x6c68f9f78d2994add0bf3ea8529ac99e0347eedcde91243a414a4cd02d424bdc\",\"license\":\"MIT\"},\"contracts/Market.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport \\\"./ERC721Token.sol\\\";\\nimport \\\"./DealsRegistry.sol\\\";\\nimport \\\"./libraries/Utils.sol\\\";\\n\\n/**\\n * @title Market\\n * @dev This contract enables the creation and management of deals\\n * @custom:security-contact security@windingtree.com\\n */\\ncontract Market is ERC721Token, DealsRegistry {\\n /// @dev Mapping of token Id on offer Id\\n mapping(uint256 => bytes32) public tokenOffers;\\n\\n /// @dev Mapping of offer Id on token Id\\n mapping(bytes32 => uint256) public offerTokens;\\n\\n /// Throws when NFT transfer is not allowed by offer rule\\n error TokenTransferNotAllowed();\\n\\n /**\\n * @dev Constructor of ERC721Token\\n */\\n /// @custom:oz-upgrades-unsafe-allow constructor\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the Market contract with the given arguments\\n * @param _owner The owner of the contract\\n * @param _name The name of the contract\\n * @param _version The version of the contract\\n * @param _config The protocol config contract address\\n * @param _entities Entities registry contract address\\n */\\n function initialize(\\n address _owner,\\n string memory _name,\\n string memory _version,\\n address _config,\\n address _entities\\n ) external initializer {\\n _transferOwnership(_owner);\\n\\n // Initialize ERC721 token\\n __ERC721Token_init(\\\"DealToken\\\", \\\"DEAL\\\");\\n\\n // Initialize Deals registry\\n __DealsRegistry_init(_name, _version, _config, _entities);\\n }\\n\\n /// Getters\\n\\n /**\\n * @dev Returns offerId linked to the token\\n * @param tokenId The ID of the token\\n * @return offerId The ID of the offer linked to the token\\n */\\n function resolveTokenId(\\n uint256 tokenId\\n ) external view returns (bytes32 offerId) {\\n _requireMinted(tokenId);\\n offerId = tokenOffers[tokenId];\\n }\\n\\n /// Pausable features\\n\\n /**\\n * @dev Pauses the contract\\n */\\n function pause() public onlyOwner {\\n _pause();\\n }\\n\\n /**\\n * @dev Unpauses the contract\\n */\\n function unpause() public onlyOwner {\\n _unpause();\\n }\\n\\n /// Features\\n\\n /**\\n * @dev Executes logic before a deal is created\\n * @param offer The details of the offer\\n * @param price The price of the offer\\n * @param asset The address of the asset\\n * @param signs The signatures of the offer\\n */\\n function _beforeCreate(\\n Utils.Offer memory offer,\\n uint256 price,\\n address asset,\\n bytes[] memory signs\\n ) internal override(DealsRegistry) whenNotPaused {\\n super._beforeCreate(offer, price, asset, signs);\\n }\\n\\n /**\\n * @dev Executes logic after a deal is created\\n * @param offer The details of the offer\\n * @param price The price of the offer\\n * @param asset The address of the asset\\n * @param signs The signatures of the offer\\n */\\n function _afterCreate(\\n Utils.Offer memory offer,\\n uint256 price,\\n address asset,\\n bytes[] memory signs\\n ) internal override(DealsRegistry) {\\n // After-deal logic\\n super._afterCreate(offer, price, asset, signs);\\n }\\n\\n /**\\n * @dev Executes logic after a deal is claimed\\n * @param offerId The ID of the offer\\n * @param buyer The address of the buyer\\n */\\n function _afterClaim(\\n bytes32 offerId,\\n address buyer\\n ) internal override(DealsRegistry) {\\n // Minting of a token\\n uint256 tokenId = safeMint(buyer);\\n // Create a map of token Id on offer Id\\n tokenOffers[tokenId] = offerId;\\n // Create a map of offer Id on token Id\\n offerTokens[offerId] = tokenId;\\n super._afterClaim(offerId, buyer);\\n }\\n\\n /**\\n * @dev Executes logic after a deal is canceled\\n * @param offerId The ID of the offer\\n */\\n function _afterCancel(bytes32 offerId) internal override(DealsRegistry) {\\n uint256 tokenId = offerTokens[offerId];\\n\\n // If token has been minted we must burn it\\n if (tokenId != 0) {\\n safeBurn(tokenId);\\n delete tokenOffers[tokenId];\\n delete offerTokens[offerId];\\n }\\n\\n super._beforeCancel(offerId);\\n }\\n\\n /// ERC721 features\\n\\n /**\\n * @dev Returns the token URI of the given token ID\\n * @param tokenId The ID of the token\\n * @return The token URI of the given token ID\\n */\\n function tokenURI(\\n uint256 tokenId\\n ) public view override(ERC721Upgradeable) returns (string memory) {\\n _requireMinted(tokenId);\\n // TODO: Generate data-uri that depends on the id\\n return \\\"\\\";\\n }\\n\\n /**\\n * @dev Executes before a token transfer\\n * @param from The address to transfer the token from\\n * @param to The address to transfer the token to\\n * @param tokenId The ID of the token being transferred\\n * @param batchSize The size of the batch being transferred\\n *\\n * NOTE: Initially minted token is transferred to his owner without any restrictions\\n * All other transfers are managed according the following requirements:\\n *\\n * - token must be linked to an offerId\\n * - token can be transferred or not according to the configuration of offer\\n * - token can not be transferred when the deal status is `Claimed` only\\n */\\n function _beforeTokenTransfer(\\n address from,\\n address to,\\n uint256 tokenId,\\n uint256 batchSize\\n ) internal override(ERC721Token) whenNotPaused {\\n // Execute the logic when the function called not from `_mint` or `_burn`\\n if (from != address(0) && to != address(0)) {\\n bytes32 offerId = tokenOffers[tokenId];\\n\\n if (offerId == bytes32(0)) {\\n revert DealNotFound();\\n }\\n\\n Utils.Deal storage offerDeal = deals[offerId];\\n\\n // Prevent transfer of token when this is not allowed by the offer\\n // or the deal is in the non-transferrable status\\n if (\\n !offerDeal.offer.transferable ||\\n offerDeal.status != Utils.DealStatus.Claimed\\n ) {\\n revert TokenTransferNotAllowed();\\n }\\n\\n // Change the deal buyer to the new token owner\\n offerDeal.buyer = to;\\n }\\n\\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\\n }\\n\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x21d01e263b41cf342eba12f17f7382a6d9f4261e58834af078087b57aba78aa1\",\"license\":\"MIT\"},\"contracts/interfaces/IConfig.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\n/**\\n * @title Configurable contract interface\\n * @dev Interface for a contract that allows for dynamic configuration of uint256 and address values.\\n */\\ninterface IConfig {\\n /**\\n * @dev Returns a number by name\\n * @param _name A number name\\n * @return The value of the number\\n */\\n function getNumber(bytes32 _name) external view returns (uint256);\\n\\n /**\\n * @dev Returns an address by name\\n * @param _name An address name\\n * @return The address value\\n */\\n function getAddress(bytes32 _name) external view returns (address);\\n\\n /**\\n * @dev Returns a list of registered config variables names\\n * @return Array of registered variables names\\n */\\n function variables() external view returns (bytes32[] memory);\\n\\n /**\\n * @dev Returns a minDeposit value of the entity\\n * @param _name An entity name\\n * @return The value of the number\\n */\\n function getMinDeposit(bytes32 _name) external view returns (uint256);\\n\\n /**\\n * @dev Changes variable uint256 of value\\n * @param name Name of variable\\n * @param value Value of variable\\n */\\n function config(bytes32 name, uint256 value) external;\\n\\n /**\\n * @dev Changes variable address of value\\n * @param name Name of variable\\n * @param value Value of variable\\n */\\n function config(bytes32 name, address value) external;\\n\\n /**\\n * @dev Sets minimum deposits values\\n * @param _kinds Supported entity types\\n * @param _minDeposits Minimum value of deposit\\n */\\n function setMinDeposits(\\n bytes32[] memory _kinds,\\n uint256[] memory _minDeposits\\n ) external;\\n}\\n\",\"keccak256\":\"0x47c6b566e13ed415ae815097092e0482b39832a76aeadccfd8a889d9d03b8518\",\"license\":\"MIT\"},\"contracts/interfaces/IEntitiesRegistry.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\n/**\\n * @title IEntitiesRegistry\\n * @dev A smart contract interface for registering and managing entities who can participate in the protocol.\\n */\\ninterface IEntitiesRegistry {\\n /**\\n * @dev Entity storage struct\\n * @param id Unique entity Id\\n * @param owner Owner of the entity entity\\n * @param enabled The entity entity activity flag\\n * @param signer Offers signer\\n */\\n struct Entity {\\n bytes32 kind;\\n bytes32 id;\\n address owner;\\n bool enabled;\\n address signer;\\n }\\n\\n /**\\n * @dev Returns entity by Id\\n * @param _id The entity Id\\n */\\n function getEntity(bytes32 _id) external view returns (Entity memory);\\n\\n /**\\n * @dev Returns the value of the entity's deposit\\n * @param _id The entity Id\\n */\\n function balanceOfEntity(bytes32 _id) external view returns (uint256);\\n\\n /**\\n * @dev Returns the value of `enabled` entity status\\n * @param _id The entity Id\\n */\\n function isEntityEnabled(bytes32 _id) external view returns (bool);\\n\\n /**\\n * @dev Sets the new address of the protocol config contract address\\n */\\n function setConfig(address _config) external;\\n\\n /**\\n * @dev Registers a new entity\\n * @param _kind Type of entity\\n * @param _salt Unique bytes32 string that allows off-chain calculation of the entity Id\\n * @param _signer Account address that authorized by the entity owner to sign offers\\n *\\n * If registering of the entity is succeeded:\\n * - the function emits `EntityRegistered(bytes32 id, bytes32 id)` event\\n *\\n * Requirements:\\n *\\n * - `salt` can be used only once. If a `salt` has been used and the entity is registered\\n * the next attempt will results in the error `EntityExists()`\\n * - an entity type provided with `_kind` must be registered\\n *\\n * NOTE: When the entity is registered its initial `enabled` status is set to `false`.\\n * This means that to start accepting deals the entity must be enabled\\n */\\n function register(bytes32 _kind, bytes32 _salt, address _signer) external;\\n\\n /**\\n * @dev Changes signer account of the entity\\n * @param _id The entity Id\\n * @param _signer Account authorized by the entity to sign offers\\n *\\n * If changing of the signer is succeeded:\\n * - the function emits `SignerChanged(bytes32 id, address sender, address oldSigner, address new Signer)` event\\n *\\n * Requirements:\\n *\\n * - can be called by the entity owner only\\n */\\n function changeSigner(bytes32 _id, address _signer) external;\\n\\n /**\\n * @dev Toggles an enabled status of the entity\\n * @param _id The entity Id\\n *\\n * This function inverts a value of the `enabled` parameter of the entity\\n *\\n * If toggling is succeeded:\\n * - the function emits `ToggleEnabled(bytes32 id, address sender, bool enabled)` event\\n *\\n * Requirements:\\n *\\n * - can be called by the entity owner only\\n */\\n function toggleEntity(bytes32 _id) external;\\n\\n /**\\n * @dev See {EntitiesRegistry._addDeposit}.\\n */\\n function addDeposit(bytes32 _id, uint256 _value) external;\\n\\n /**\\n * @dev Makes deposit of `asset` tokens with permit\\n * @param _id The entity Id\\n * @param _value Amount of `asset` tokens that must be deposited\\n * @param _deadline Deadline time of permit\\n * @param _sign Permit signature (EIP712)\\n *\\n * If `_sign` argument is provided the function will use the `permit` function\\n * to transfer tokens from the sender to the contract, overwise the usual\\n * `transferFrom` will be used.\\n *\\n * If the tokens transfer is succeeded:\\n * - the function emits `Deposit(bytes32 id, address sender, uint256 value)` event\\n *\\n * Requirements:\\n *\\n * - can be called by the entity owner only\\n */\\n function addDeposit(\\n bytes32 _id,\\n uint256 _value,\\n uint256 _deadline,\\n bytes memory _sign\\n ) external;\\n\\n /**\\n * @dev Makes deposit withdrawal of the entity\\n * @param _id The entity Id\\n * @param _value Amount of `asset` tokens that must be withdrawn\\n *\\n * If the tokens withdrawal is succeeded:\\n * - the function emits `Withdraw(bytes32 id, address sender, uint256 value)` event\\n *\\n * Requirements:\\n *\\n * - can be called by the entity owner only\\n */\\n function withdrawDeposit(bytes32 _id, uint256 _value) external;\\n}\\n\",\"keccak256\":\"0x3f48925046ed3c45e1bd041ddf7c64bcebbb82ef30dc88532ea4c136265a30b8\",\"license\":\"MIT\"},\"contracts/libraries/SignatureUtils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nlibrary SignatureUtils {\\n error InvalidSignature();\\n\\n /// @dev Splits signature into v/r/s form\\n function split(\\n bytes memory signature\\n ) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\\n if (signature.length == 65) {\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n\\n if eq(v, 0) {\\n v := 27\\n }\\n\\n if eq(v, 1) {\\n v := 28\\n }\\n }\\n } else {\\n revert InvalidSignature();\\n }\\n }\\n}\\n\",\"keccak256\":\"0xb20f713cacd073216c4a1be4af5649de3eabdcb46cffcaf2b60c59b58ae10e1f\",\"license\":\"MIT\"},\"contracts/libraries/Utils.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\\\";\\n\\nlibrary Utils {\\n using SafeMathUpgradeable for uint256;\\n\\n /// Constants\\n\\n bytes32 public constant PAYMENT_OPTION_TYPE_HASH =\\n keccak256(\\\"PaymentOption(bytes32 id,uint256 price,address asset)\\\");\\n\\n bytes32 public constant CANCEL_OPTION_TYPE_HASH =\\n keccak256(\\\"CancelOption(uint256 time,uint256 penalty)\\\");\\n\\n bytes32 public constant OFFER_TYPE_HASH =\\n keccak256(\\n // solhint-disable-next-line max-line-length\\n \\\"Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn,uint256 checkOut)\\\"\\n );\\n\\n bytes32 public constant CHECK_IN_TYPE_HASH =\\n keccak256(\\\"Voucher(bytes32 id,address signer)\\\");\\n\\n /// Errors\\n\\n /// @dev Thrown when percents value greater than 100\\n error InvalidPercent();\\n\\n /// Data structures\\n\\n /**\\n * @dev Payment option\\n * @param id Unique ID of the payment option\\n * @param price The price of the asset in wei\\n * @param asset The address of the ERC20 token used for payment\\n */\\n struct PaymentOption {\\n bytes32 id;\\n uint256 price;\\n address asset;\\n }\\n\\n /**\\n * @dev Deal cancellation option\\n * @param time The number of seconds before checkIn\\n * @param penalty The percentage of the total sum to be paid as a penalty if the deal is cancelled\\n */\\n struct CancelOption {\\n uint256 time;\\n uint256 penalty;\\n }\\n\\n /**\\n * @dev Offer payload\\n * @param id The unique ID of the offer\\n * @param expire The time when the offer expires (in seconds since the Unix epoch)\\n * @param supplierId The unique ID of the supplier offering the deal\\n * @param chainId The ID of the network chain where the deal is to be executed\\n * @param requestHash The hash of the request made by the buyer\\n * @param optionsHash The hash of the payment and cancellation options for the deal\\n * @param paymentHash The hash of the payment option used for the deal\\n * @param cancelHash The hash of the cancellation option used for the deal\\n * @param transferable Indicates whether the deal NFT is transferable or not\\n * @param checkIn The check-in time for the deal (in seconds since the Unix epoch)\\n * @param checkOut The check-out time for the deal (in seconds since the Unix epoch)\\n */\\n struct Offer {\\n bytes32 id;\\n uint256 expire;\\n bytes32 supplierId;\\n uint256 chainId;\\n bytes32 requestHash;\\n bytes32 optionsHash;\\n bytes32 paymentHash;\\n bytes32 cancelHash;\\n bool transferable;\\n uint256 checkIn;\\n uint256 checkOut;\\n }\\n\\n /**\\n * @dev Deal status\\n */\\n enum DealStatus {\\n Created, // Just created\\n Claimed, // Claimed by the supplier\\n Rejected, // Rejected by the supplier\\n Refunded, // Refunded by the supplier\\n Cancelled, // Cancelled by the buyer\\n CheckedIn, // Checked In\\n CheckedOut, // Checked Out\\n Disputed // Dispute started\\n }\\n\\n /**\\n * @dev Deal storage struct\\n * @param offer Offer payload\\n * @param price Deal price\\n * @param asset Deal asset\\n * @param status Current deal status\\n */\\n struct Deal {\\n uint256 created;\\n Offer offer;\\n bytes32 retailerId;\\n address buyer;\\n uint256 price;\\n address asset;\\n DealStatus status;\\n }\\n\\n /// @dev Create a has of bytes32 array\\n function hash(bytes32[] memory _hashes) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(_hashes));\\n }\\n\\n /// @dev Creates a hash of a PaymentOption\\n function hash(\\n PaymentOption memory _paymentOptions\\n ) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(\\n PAYMENT_OPTION_TYPE_HASH,\\n _paymentOptions.id,\\n _paymentOptions.price,\\n _paymentOptions.asset\\n )\\n );\\n }\\n\\n /// @dev Creates a hash of a CancelOption\\n function hash(CancelOption memory _cancel) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encodePacked(CANCEL_OPTION_TYPE_HASH, _cancel.time, _cancel.penalty)\\n );\\n }\\n\\n /// @dev Creates a hash of an array of PaymentOption\\n function hash(\\n PaymentOption[] memory _paymentOptions\\n ) internal pure returns (bytes32) {\\n bytes32[] memory hashes = new bytes32[](_paymentOptions.length);\\n\\n for (uint256 i = 0; i < _paymentOptions.length; i++) {\\n hashes[i] = hash(_paymentOptions[i]);\\n }\\n\\n return hash(hashes);\\n }\\n\\n /// @dev Creates a hash of an array of CancelOption\\n function hash(\\n CancelOption[] memory _cancelOptions\\n ) internal pure returns (bytes32) {\\n bytes32[] memory hashes = new bytes32[](_cancelOptions.length);\\n\\n for (uint256 i = 0; i < _cancelOptions.length; i++) {\\n hashes[i] = hash(_cancelOptions[i]);\\n }\\n\\n return hash(hashes);\\n }\\n\\n /// @dev Creates a hash of an Offer\\n function hash(Offer memory _offer) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n OFFER_TYPE_HASH,\\n _offer.id,\\n _offer.expire,\\n _offer.supplierId,\\n _offer.chainId,\\n _offer.requestHash,\\n _offer.optionsHash,\\n _offer.paymentHash,\\n _offer.cancelHash,\\n _offer.transferable,\\n _offer.checkIn,\\n _offer.checkOut\\n )\\n );\\n }\\n\\n /// @dev Create a hash of check-in data\\n function hashCheckInOut(\\n bytes32 _id,\\n address _signer\\n ) internal pure returns (bytes32) {\\n return keccak256(abi.encode(CHECK_IN_TYPE_HASH, _id, _signer));\\n }\\n\\n /// @dev Calculates percentage value\\n function _percentage(\\n uint256 value,\\n uint256 percent\\n ) internal pure returns (uint256) {\\n if (percent > 100) {\\n revert InvalidPercent();\\n }\\n return value.mul(1000).mul(percent).div(100).div(1000);\\n }\\n}\\n\",\"keccak256\":\"0xdac59bcae7bbd586f7a7e942615769d500df6d677213c2303de63f5ae14ed804\",\"license\":\"MIT\"},\"contracts/utils/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.19;\\n\\n/// @dev Simple ERC20 token interface\\ninterface IERC20 {\\n function decimals() external view returns (uint256);\\n\\n function transfer(address, uint256) external returns (bool);\\n\\n function transferFrom(address, address, uint256) external returns (bool);\\n\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\",\"keccak256\":\"0x1ad28279394506573ea860d0d680098c6716a0874ad0ec0475fec44b4f4d3d0f\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6159b380620000f46000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c806370a0823111610130578063aaf741e4116100b8578063d2d849761161007c578063d2d849761461059c578063d56f7bcc146105af578063e985e9c5146105c2578063f2ca5dc5146105fe578063f2fde38b1461061157600080fd5b8063aaf741e414610521578063b88d4fde14610542578063bd66528a14610555578063c87b56dd14610568578063ca0345271461057b57600080fd5b806381cd872a116100ff57806381cd872a146104005780638456cb59146104ec5780638da5cb5b146104f457806395d89b4114610506578063a22cb4651461050e57600080fd5b806370a08231146103be578063715018a6146103d15780637249fbb6146103d957806379502c55146103ec57600080fd5b806320e3dbd4116101be57806342842e0e1161018257806342842e0e146103675780634f6ccce71461037a5780635c975abb1461038d5780636352211e146103985780636cf1dbed146103ab57600080fd5b806320e3dbd41461031357806323b872dd146103265780632f745c59146103395780633f4ba83a1461034c5780634246c1b71461035457600080fd5b806308122cc71161020557806308122cc71461029c578063081812fc146102af578063095ea7b3146102da5780631615fd03146102ed57806318160ddd1461030157600080fd5b806301ffc9a714610237578063042bc95b1461025f57806304f999c71461027457806306fdde0314610287575b600080fd5b61024a610245366004614bf8565b610624565b60405190151581526020015b60405180910390f35b61027261026d366004614ceb565b610635565b005b610272610282366004614db0565b610cfc565b61028f611046565b6040516102569190614e22565b6102726102aa366004614e35565b6110d8565b6102c26102bd366004614e35565b611813565b6040516001600160a01b039091168152602001610256565b6102726102e8366004614e63565b61183a565b610163546102c2906001600160a01b031681565b60cd545b604051908152602001610256565b610272610321366004614e8f565b611954565b610272610334366004614eac565b6119c7565b610305610347366004614e63565b6119f9565b610272611a8f565b610272610362366004614fe6565b611aa1565b610272610375366004614eac565b611ede565b610305610388366004614e35565b611ef9565b60fd5460ff1661024a565b6102c26103a6366004614e35565b611f8c565b6102726103b936600461502c565b611fec565b6103056103cc366004614e8f565b612156565b6102726121dc565b6102726103e7366004614e35565b6121ee565b610162546102c2906001600160a01b031681565b6104d961040e366004614e35565b610165602090815260009182526040918290208054835161016081018552600183015481526002830154938101939093526003820154938301939093526004810154606083015260058101546080830152600681015460a0830152600781015460c0830152600881015460e0830152600981015460ff9081161515610100840152600a820154610120840152600b820154610140840152600c820154600d830154600e840154600f9094015491936001600160a01b0391821693909291821691600160a01b90041687565b6040516102569796959493929190615101565b610272612537565b61012f546001600160a01b03166102c2565b61028f612547565b61027261051c3660046151ec565b612556565b61030561052f366004614e35565b6101996020526000908152604090205481565b610272610550366004615225565b612565565b610272610563366004614e35565b61259d565b61028f610576366004614e35565b612864565b610305610589366004614e35565b6101986020526000908152604090205481565b6102726105aa366004614e8f565b612883565b6102726105bd36600461532d565b6128f6565b61024a6105d036600461543b565b6001600160a01b039182166000908152609e6020908152604080832093909416825291909152205460ff1690565b61030561060c366004614e35565b61300d565b61027261061f366004614e8f565b61302c565b600061062f826130a5565b92915050565b6000828152610165602052604090206001015482906106675760405163223da47360e21b815260040160405180910390fd5b6518d85b98d95b60d21b60005261016460209081527f81062d4f7ca92921b22616119900c96f98bed102c24746a50196946c312490ea8054604080518285028101850190915281815286939092919083018282801561071557602002820191906000526020600020906000905b82829054906101000a900460ff1660078111156106f3576106f36150c9565b8152602060019283018181049485019490930390920291018084116106d45790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156107a25783818151811061075757610757615469565b60200260200101516007811115610770576107706150c9565b826007811115610782576107826150c9565b0361079057600192506107a2565b8061079a81615495565b91505061073c565b50816001146107c457604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600d8101543391906001600160a01b03168214610803576040516308ffd32360e41b815260040160405180910390fd5b61016254604051630bb2c35960e21b81526b18db185a5b57dc195c9a5bd960a21b6004820152610889916001600160a01b031690632ecb0d6490602401602060405180830381865afa15801561085d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088191906154ae565b8254906130ca565b4210156108a95760405163e340eb8560e01b815260040160405180910390fd5b600f8101805460ff60a01b198116600160a21b17909155600160a01b900460ff166108d38a6130dd565b60008160078111156108e7576108e76150c9565b0361099157600f820154600d830154600e84015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af115801561094b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f91906154c7565b61098c5760405163244743ff60e01b815260040160405180910390fd5b610cbd565b60018160078111156109a5576109a56150c9565b1480156109b55750600a82015442105b15610ca4576109c3896130e5565b6008830154146109e65760405163b124e96f60e01b815260040160405180910390fd5b60008060005b8b51811015610a9e578b8181518110610a0757610a07615469565b6020026020010151600001514210158015610a465750821580610a465750828c8281518110610a3857610a38615469565b602002602001015160000151105b15610a8c578b8181518110610a5d57610a5d615469565b60200260200101516000015192508b8181518110610a7d57610a7d615469565b60200260200101516020015191505b80610a9681615495565b9150506109ec565b506064811115610aac575060645b6000610abc85600e015483613194565b600f860154600d870154600e8801549293506001600160a01b039182169263a9059cbb9290911690610aee90856131db565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d91906154c7565b610b7a5760405163244743ff60e01b815260040160405180910390fd5b600081118015610c7e5750600f8501546101635460038701546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0691906154e4565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610c58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7c91906154c7565b155b15610c9c5760405163244743ff60e01b815260040160405180910390fd5b505050610cbd565b604051632adde06f60e21b815260040160405180910390fd5b60008051602061595e8339815191528a600485604051610cdf9392919061556b565b60405180910390a1610cf08a6131e7565b50505050505050505050565b600082815261016560205260409020600101548290610d2e5760405163223da47360e21b815260040160405180910390fd5b6101635460008481526101656020526040908190206003015490516329db379b60e11b8152600481019190915284916001600160a01b0316906353b66f369060240160a060405180830381865afa158015610d8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db191906154e4565b608001516001600160a01b0316336001600160a01b031614610de6576040516308ffd32360e41b815260040160405180910390fd5b651c995a9958dd60d21b60005261016460209081527fc46af9fb757a5392b04e96a191cee5d6fe9386d767a56a820e480e8cd4dd9fd980546040805182850281018501909152818152879390929190830182828015610e9457602002820191906000526020600020906000905b82829054906101000a900460ff166007811115610e7257610e726150c9565b815260206001928301818104948501949093039092029101808411610e535790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015610f2157838181518110610ed657610ed6615469565b60200260200101516007811115610eef57610eef6150c9565b826007811115610f0157610f016150c9565b03610f0f5760019250610f21565b80610f1981615495565b915050610ebb565b5081600114610f4357604051632adde06f60e21b815260040160405180910390fd5b600088815261016560205260409020600f8101805460ff60a01b1916600160a11b179055610f718989613231565b600f810154600d820154600e83015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff491906154c7565b6110115760405163244743ff60e01b815260040160405180910390fd5b60008051602061595e833981519152896002336040516110339392919061556b565b60405180910390a1505050505050505050565b60606099805461105590615598565b80601f016020809104026020016040519081016040528092919081815260200182805461108190615598565b80156110ce5780601f106110a3576101008083540402835291602001916110ce565b820191906000526020600020905b8154815290600101906020018083116110b157829003601f168201915b5050505050905090565b60008181526101656020526040902060010154819061110a5760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa158015611169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118d91906154e4565b608001516001600160a01b0316336001600160a01b0316146111c2576040516308ffd32360e41b815260040160405180910390fd5b6718da1958dad3dd5d60c21b60005261016460209081527fc1dd3999e8023eaa9ce335ac20c9f0911c06155bdf47040ab8df5eebc20004ba8054604080518285028101850190915281815286939092919083018282801561127257602002820191906000526020600020906000905b82829054906101000a900460ff166007811115611250576112506150c9565b8152602060019283018181049485019490930390920291018084116112315790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156112ff578381815181106112b4576112b4615469565b602002602001015160078111156112cd576112cd6150c9565b8260078111156112df576112df6150c9565b036112ed57600192506112ff565b806112f781615495565b915050611299565b508160011461132157604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600b8101544210156113555760405163e340eb8560e01b815260040160405180910390fd5b600f8101805460ff60a01b1916600360a11b179055611373886130dd565b600e81015461016254604051630bb2c35960e21b81526b70726f746f636f6c5f66656560a01b60048201526000928392839261140492916001600160a01b031690632ecb0d64906024015b602060405180830381865afa1580156113db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ff91906154ae565b613194565b600c8501549093501561145c57600e84015461016254604051630bb2c35960e21b81526b72657461696c65725f66656560a01b600482015261145992916001600160a01b031690632ecb0d64906024016113be565b91505b61147d826114778587600e01546131db90919063ffffffff16565b906131db565b90506000831180156115875750600f840154610162546040516321f8a72160e01b81526c19995957dc9958da5c1a595b9d609a1b60048201526001600160a01b039283169263a9059cbb9216906321f8a72190602401602060405180830381865afa1580156114f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151491906155d2565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018690526044016020604051808303816000875af1158015611561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158591906154c7565b155b156115a55760405163244743ff60e01b815260040160405180910390fd5b6000821180156116a95750600f84015461016354600c8601546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa15801561160d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163191906154e4565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af1158015611683573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a791906154c7565b155b156116c75760405163244743ff60e01b815260040160405180910390fd5b600f8401546101635460038601546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa158015611724573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174891906154e4565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af115801561179a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117be91906154c7565b6117db5760405163244743ff60e01b815260040160405180910390fd5b60008051602061595e8339815191528b6006336040516117fd9392919061556b565b60405180910390a15b5050505050505050505050565b600061181e82613239565b506000908152609d60205260409020546001600160a01b031690565b600061184582611f8c565b9050806001600160a01b0316836001600160a01b0316036118b75760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806118d357506118d381336105d0565b6119455760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016118ae565b61194f8383613298565b505050565b61195c613306565b61016254604080516001600160a01b03928316815291831660208301527fbd7986d31c086d8cc2901a1c41d1edc0af6e8a7a5c6fc1b8283919c1b2122c38910160405180910390a161016280546001600160a01b0319166001600160a01b0392909216919091179055565b6119d2335b82613361565b6119ee5760405162461bcd60e51b81526004016118ae906155ef565b61194f8383836133e0565b6000611a0483612156565b8210611a665760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016118ae565b506001600160a01b0391909116600090815260cb60209081526040808320938352929052205490565b611a97613306565b611a9f613551565b565b600082815261016560205260409020600101548290611ad35760405163223da47360e21b815260040160405180910390fd5b6631b432b1b5a4b760c91b60005261016460209081527fc78e0758b723b136c59844f7da34685e7f27894489b1657d97b9b8e3e8e19ced80546040805182850281018501909152818152869390929190830182828015611b8257602002820191906000526020600020906000905b82829054906101000a900460ff166007811115611b6057611b606150c9565b815260206001928301818104948501949093039092029101808411611b415790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015611c0f57838181518110611bc457611bc4615469565b60200260200101516007811115611bdd57611bdd6150c9565b826007811115611bef57611bef6150c9565b03611bfd5760019250611c0f565b80611c0781615495565b915050611ba9565b5081600114611c3157604051632adde06f60e21b815260040160405180910390fd5b6000878152610165602052604080822061016354600382015492516329db379b60e11b81529193926001600160a01b03909116916353b66f3691611c7b9160040190815260200190565b60a060405180830381865afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc91906154e4565b608081015190915033906000906001600160a01b03168203611dd757611cf5611cf0856001016000015485608001516135a3565b613607565b9050611d33818b600081518110611d0e57611d0e615469565b602002602001015185608001516001600160a01b031661361a9092919063ffffffff16565b611d505760405163a2fb840f60e01b815260040160405180910390fd5b600a840154421015611dd2576001840154600d850154611d7c91611cf0916001600160a01b03166135a3565b9050611db5818b600181518110611d9557611d95615469565b6020908102919091010151600d8701546001600160a01b0316919061361a565b611dd25760405163a2fb840f60e01b815260040160405180910390fd5b611e8f565b600d8401546001600160a01b0390811690831603611e76576001840154600d850154611e0f91611cf0916001600160a01b03166135a3565b9050611e28818b600081518110611d9557611d95615469565b611e455760405163a2fb840f60e01b815260040160405180910390fd5b611e5d611cf0856001016000015485608001516135a3565b9050611db5818b600181518110611d0e57611d0e615469565b6040516308ffd32360e41b815260040160405180910390fd5b611e998b8b613231565b600f8401805460ff60a01b1916600560a01b17905560405160008051602061595e83398151915290611ed1908d90600590869061556b565b60405180910390a1611806565b61194f83838360405180602001604052806000815250612565565b6000611f0460cd5490565b8210611f675760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016118ae565b60cd8281548110611f7a57611f7a615469565b90600052602060002001549050919050565b6000818152609b60205260408120546001600160a01b03168061062f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016118ae565b600054610100900460ff161580801561200c5750600054600160ff909116105b806120265750303b158015612026575060005460ff166001145b6120895760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016118ae565b6000805460ff1916600117905580156120ac576000805461ff0019166101001790555b6120b58661375c565b6120fc604051806040016040528060098152602001682232b0b62a37b5b2b760b91b815250604051806040016040528060048152602001631111505360e21b8152506137af565b612108858585856137f0565b801561214e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006001600160a01b0382166121c05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016118ae565b506001600160a01b03166000908152609c602052604090205490565b6121e4613306565b611a9f600061375c565b6000818152610165602052604090206001015481906122205760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa15801561227f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a391906154e4565b608001516001600160a01b0316336001600160a01b0316146122d8576040516308ffd32360e41b815260040160405180910390fd5b651c99599d5b9960d21b60005261016460209081527f07a4462434a8663ef8cbef768cea3239b3345cd5f028a224e47a7db4a71138368054604080518285028101850190915281815286939092919083018282801561238657602002820191906000526020600020906000905b82829054906101000a900460ff166007811115612364576123646150c9565b8152602060019283018181049485019490930390920291018084116123455790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015612413578381815181106123c8576123c8615469565b602002602001015160078111156123e1576123e16150c9565b8260078111156123f3576123f36150c9565b036124015760019250612413565b8061240b81615495565b9150506123ad565b508160011461243557604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600f8101805460ff60a01b1916600360a01b179055612462886130dd565b600f810154600d820154600e83015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156124c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e591906154c7565b6125025760405163244743ff60e01b815260040160405180910390fd5b60008051602061595e833981519152886003336040516125249392919061556b565b60405180910390a15b5050505050505050565b61253f613306565b611a9f613aad565b6060609a805461105590615598565b612561338383613aea565b5050565b61256f3383613361565b61258b5760405162461bcd60e51b81526004016118ae906155ef565b61259784848484613bb8565b50505050565b6000818152610165602052604090206001015481906125cf5760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa15801561262e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265291906154e4565b608001516001600160a01b0316336001600160a01b031614612687576040516308ffd32360e41b815260040160405180910390fd5b64636c61696d60d81b60005261016460209081527f8fded9216611b5e46bf52fe515d6ddc32059da80463e1a4891e5dc68d5c1a8a88054604080518285028101850190915281815286939092919083018282801561273457602002820191906000526020600020906000905b82829054906101000a900460ff166007811115612712576127126150c9565b8152602060019283018181049485019490930390920291018084116126f35790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156127c15783818151811061277657612776615469565b6020026020010151600781111561278f5761278f6150c9565b8260078111156127a1576127a16150c9565b036127af57600192506127c1565b806127b981615495565b91505061275b565b50816001146127e357604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600d81015461280b9089906001600160a01b0316613231565b600f8101805460ff60a01b1916600160a01b17905560405160008051602061595e83398151915290612843908a90600190339061556b565b60405180910390a1600d81015461252d9089906001600160a01b0316613beb565b606061286f82613239565b505060408051602081019091526000815290565b61288b613306565b61016354604080516001600160a01b03928316815291831660208301527fb468923d3f8581bd45345fed844c850e4c681b7170a99d4b47a7f92f66e226d2910160405180910390a161016380546001600160a01b0319166001600160a01b0392909216919091179055565b336000612905611cf088613c1f565b610163546040808a015190516329db379b60e11b81529293506000926001600160a01b03909216916353b66f36916129439160040190815260200190565b60a060405180830381865afa158015612960573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298491906154e4565b90506129c2828560008151811061299d5761299d615469565b602002602001015183608001516001600160a01b031661361a9092919063ffffffff16565b6129df5760405163a2fb840f60e01b815260040160405180910390fd5b610163546040808a0151905163a241f54d60e01b81526001600160a01b039092169163a241f54d91612a179160040190815260200190565b602060405180830381865afa158015612a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5891906154c7565b612a755760405163e1040adb60e01b815260040160405180910390fd5b8415612ba557610163546040516329db379b60e11b8152600481018790526000916001600160a01b0316906353b66f369060240160a060405180830381865afa158015612ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aea91906154e4565b60408101519091506001600160a01b0316612b18576040516301e8b0f960e51b815260040160405180910390fd5b6101635460405163a241f54d60e01b8152600481018890526001600160a01b039091169063a241f54d90602401602060405180830381865afa158015612b62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8691906154c7565b612ba357604051630620118d60e51b815260040160405180910390fd5b505b87516000818152610165602052604090206001015403612bd857604051635d341dcb60e11b815260040160405180910390fd5b6000612be388613d05565b90508860c001518114612c09576040516304b1ffc560e51b815260040160405180910390fd5b50505060008060005b8751811015612c965786888281518110612c2e57612c2e615469565b60200260200101516000015103612c8457878181518110612c5157612c51615469565b6020026020010151602001519250878181518110612c7157612c71615469565b6020026020010151604001519150612c96565b80612c8e81615495565b915050612c12565b506001600160a01b038116612cbe57604051632c46fa3160e21b815260040160405180910390fd5b612cca88838387613daa565b87516000818152610165602052604090206001015403612cfd5760405163a00179fd60e01b815260040160405180910390fd5b6040518060e00160405280428152602001898152602001868152602001846001600160a01b03168152602001838152602001826001600160a01b0316815260200160006007811115612d5157612d516150c9565b90528851600090815261016560209081526040918290208351815583820151805160018301559182015160028201558183015160038201556060808301516004830155608080840151600584015560a080850151600685015560c08086015160078087019190915560e0870151600887015561010087015160098701805491151560ff19909216919091179055610120870151600a87015561014090960151600b86015595870151600c85015591860151600d840180546001600160a01b039283166001600160a01b03199182161790915591870151600e85015591860151600f840180549190931691811682178355948601519294929391926001600160a81b0319161790600160a01b908490811115612e6e57612e6e6150c9565b0217905550905050600184511115612f40576000806000612ea887600181518110612e9b57612e9b615469565b6020026020010151613dbe565b60208e015160405163d505accf60e01b81526001600160a01b038b81166004830152306024830152604482018b9052606482019290925260ff8516608482015260a4810184905260c48101839052939650919450925085169063d505accf9060e401600060405180830381600087803b158015612f2457600080fd5b505af1158015612f38573d6000803e3d6000fd5b505050505050505b6040516323b872dd60e01b81526001600160a01b038481166004830152306024830152604482018490528216906323b872dd906064016020604051808303816000875af1158015612f95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb991906154c7565b612fd65760405163244743ff60e01b815260040160405180910390fd5b875160405160008051602061595e83398151915291612ff991600090879061556b565b60405180910390a161252d88838387613e1f565b600061301882613239565b506000908152610198602052604090205490565b613034613306565b6001600160a01b0381166130995760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016118ae565b6130a28161375c565b50565b60006001600160e01b0319821663780e9d6360e01b148061062f575061062f82613e24565b60006130d6828461563c565b9392505050565b6130a2613e74565b60008082516001600160401b0381111561310157613101614c15565b60405190808252806020026020018201604052801561312a578160200160208202803683370190505b50905060005b835181101561318a5761315b84828151811061314e5761314e615469565b6020026020010151613eba565b82828151811061316d5761316d615469565b60209081029190910101528061318281615495565b915050613130565b506130d681613f07565b600060648211156131b857604051635c974e3d60e11b815260040160405180910390fd5b6130d66103e86131d5606481866131cf8986613f1a565b90613f1a565b90613f26565b60006130d6828461564f565b6000818152610199602052604090205480156132285761320681613f32565b6000818152610198602090815260408083208390558483526101999091528120555b612561826130dd565b612561613e74565b6000818152609b60205260409020546001600160a01b03166130a25760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016118ae565b6000818152609d6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906132cd82611f8c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b61012f546001600160a01b03163314611a9f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016118ae565b60008061336d83611f8c565b9050806001600160a01b0316846001600160a01b031614806133b457506001600160a01b038082166000908152609e602090815260408083209388168352929052205460ff165b806133d85750836001600160a01b03166133cd84611813565b6001600160a01b0316145b949350505050565b826001600160a01b03166133f382611f8c565b6001600160a01b0316146134195760405162461bcd60e51b81526004016118ae90615662565b6001600160a01b03821661347b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016118ae565b6134888383836001613f60565b826001600160a01b031661349b82611f8c565b6001600160a01b0316146134c15760405162461bcd60e51b81526004016118ae90615662565b6000818152609d6020908152604080832080546001600160a01b03199081169091556001600160a01b03878116808652609c8552838620805460001901905590871680865283862080546001019055868652609b90945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b613559614046565b60fd805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080517ff811d7f3ddb148410001929e2cbfb7fea8779b9349b7c2f650fa91840528d69c60208201529081018390526001600160a01b03821660608201526000906080015b60405160208183030381529060405280519060200120905092915050565b600061062f61361461408f565b8361410f565b60008060006136298585614136565b90925090506000816004811115613642576136426150c9565b1480156136605750856001600160a01b0316826001600160a01b0316145b15613670576001925050506130d6565b600080876001600160a01b0316631626ba7e60e01b88886040516024016136989291906156a7565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516136d691906156c0565b600060405180830381855afa9150503d8060008114613711576040519150601f19603f3d011682016040523d82523d6000602084013e613716565b606091505b5091509150818015613729575080516020145b801561375057508051630b135d3f60e11b9061374e90830160209081019084016154ae565b145b98975050505050505050565b61012f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166137d65760405162461bcd60e51b81526004016118ae906156dc565b6137e0828261417b565b6137e86141ac565b6125616141d3565b600054610100900460ff166138175760405162461bcd60e51b81526004016118ae906156dc565b6138218484614202565b6138296141d3565b61016280546001600160a01b038481166001600160a01b03199283161790925561016380549284169290911691909117905560408051602081019091528060009052651c995a9958dd60d21b6000526101646020526138ab907fc46af9fb757a5392b04e96a191cee5d6fe9386d767a56a820e480e8cd4dd9fd9906001614aa4565b50604080518082019091528060008152602001600190526518d85b98d95b60d21b600052610164602052613902907f81062d4f7ca92921b22616119900c96f98bed102c24746a50196946c312490ea906002614b58565b5060408051808201909152806001815260200160059052651c99599d5b9960d21b600052610164602052613959907f07a4462434a8663ef8cbef768cea3239b3345cd5f028a224e47a7db4a7113836906002614b58565b506040805160208101909152806000905264636c61696d60d81b6000526101646020526139a9907f8fded9216611b5e46bf52fe515d6ddc32059da80463e1a4891e5dc68d5c1a8a8906001614aa4565b50604080516020810190915280600190526631b432b1b5a4b760c91b6000526101646020526139fb907fc78e0758b723b136c59844f7da34685e7f27894489b1657d97b9b8e3e8e19ced906001614aa4565b50604080516020810190915280600590526718da1958dad3dd5d60c21b600052610164602052613a4e907fc1dd3999e8023eaa9ce335ac20c9f0911c06155bdf47040ab8df5eebc20004ba906001614aa4565b5060408051808201909152806005815260200160069052666469737075746560c81b600052610164602052613aa6907f755971b5036353f540d427876647973a20fcd901626978bb47564e1a4a28b6d4906002614b58565b5050505050565b613ab5613e74565b60fd805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135863390565b816001600160a01b0316836001600160a01b031603613b4b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016118ae565b6001600160a01b038381166000818152609e6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613bc38484846133e0565b613bcf84848484614233565b6125975760405162461bcd60e51b81526004016118ae90615727565b6000613bf682614334565b600081815261019860209081526040808320879055958252610199905293909320929092555050565b60007f4fb12343a6f44152999c71291770d97fc1eace9d7d04889330d5a6d1af4a57c7826000015183602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b61012001518c6101400151604051602001613ce89c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925260c087015260e086015261010085015215156101208401526101408301526101608201526101800190565b604051602081830303815290604052805190602001209050919050565b60008082516001600160401b03811115613d2157613d21614c15565b604051908082528060200260200182016040528015613d4a578160200160208202803683370190505b50905060005b835181101561318a57613d7b848281518110613d6e57613d6e615469565b602002602001015161435c565b828281518110613d8d57613d8d615469565b602090810291909101015280613da281615495565b915050613d50565b613db2613e74565b612597848484846143ca565b60008060008351604103613dff5750505060208101516040820151606083015160001a919082613ded57601b92505b60018303613dfa57601c92505b613e18565b604051638baa579f60e01b815260040160405180910390fd5b9193909250565b612597565b60006001600160e01b031982166380ac58cd60e01b1480613e5557506001600160e01b03198216635b5e139f60e01b145b8061062f57506301ffc9a760e01b6001600160e01b031983161461062f565b60fd5460ff1615611a9f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016118ae565b8051602080830151604051600093613ce8937f8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5939192019283526020830191909152604082015260600190565b600081604051602001613ce89190615779565b60006130d682846157af565b60006130d682846157c6565b613f3b336119cc565b613f575760405162461bcd60e51b81526004016118ae906155ef565b6130a2816143d2565b613f68613e74565b6001600160a01b03841615801590613f8857506001600160a01b03831615155b1561403a576000828152610198602052604090205480613fbb5760405163223da47360e21b815260040160405180910390fd5b600081815261016560205260409020600981015460ff161580613ffe57506001600f820154600160a01b900460ff166007811115613ffb57613ffb6150c9565b14155b1561401c5760405163ca7cbc7760e01b815260040160405180910390fd5b600d0180546001600160a01b0319166001600160a01b038616179055505b61259784848484614475565b60fd5460ff16611a9f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016118ae565b600061410a7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6140be60015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b905090565b60405161190160f01b602082015260228101839052604281018290526000906062016135e9565b600080825160410361416c5760208301516040840151606085015160001a61416087828585614489565b94509450505050614174565b506000905060025b9250929050565b600054610100900460ff166141a25760405162461bcd60e51b81526004016118ae906156dc565b612561828261454d565b600054610100900460ff16611a9f5760405162461bcd60e51b81526004016118ae906156dc565b600054610100900460ff166141fa5760405162461bcd60e51b81526004016118ae906156dc565b611a9f61458d565b600054610100900460ff166142295760405162461bcd60e51b81526004016118ae906156dc565b61256182826145c0565b60006001600160a01b0384163b1561432957604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906142779033908990889088906004016157e8565b6020604051808303816000875af19250505080156142b2575060408051601f3d908101601f191682019092526142af91810190615825565b60015b61430f573d8080156142e0576040519150601f19603f3d011682016040523d82523d6000602084013e6142e5565b606091505b5080516000036143075760405162461bcd60e51b81526004016118ae90615727565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506133d8565b506001949350505050565b6000806143416101615490565b905061435261016180546001019055565b61062f8382614601565b60007f2f8fc0b3ad3f58f6deb367673d38e4112a3c8c64de033c5b780b84ef8f67cde6826000015183602001518460400151604051602001613ce8949392919093845260208401929092526040830152606090811b6bffffffffffffffffffffffff19169082015260740190565b612597613e74565b60006143dd82611f8c565b90506143ed816000846001613f60565b6143f682611f8c565b6000838152609d6020908152604080832080546001600160a01b03199081169091556001600160a01b038516808552609c84528285208054600019019055878552609b909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61447d613e74565b6125978484848461461b565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156144c05750600090506003614544565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614514573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661453d57600060019250925050614544565b9150600090505b94509492505050565b600054610100900460ff166145745760405162461bcd60e51b81526004016118ae906156dc565b60996145808382615888565b50609a61194f8282615888565b600054610100900460ff166145b45760405162461bcd60e51b81526004016118ae906156dc565b60fd805460ff19169055565b600054610100900460ff166145e75760405162461bcd60e51b81526004016118ae906156dc565b815160209283012081519190920120600191909155600255565b612561828260405180602001604052806000815250614748565b600181111561468a5760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b60648201526084016118ae565b816001600160a01b0385166146e6576146e18160cd8054600083815260ce60205260408120829055600182018355919091527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0155565b614709565b836001600160a01b0316856001600160a01b03161461470957614709858261477b565b6001600160a01b0384166147255761472081614818565b613aa6565b846001600160a01b0316846001600160a01b031614613aa657613aa684826148c7565b614752838361490b565b61475f6000848484614233565b61194f5760405162461bcd60e51b81526004016118ae90615727565b6000600161478884612156565b614792919061564f565b600083815260cc60205260409020549091508082146147e5576001600160a01b038416600090815260cb60209081526040808320858452825280832054848452818420819055835260cc90915290208190555b50600091825260cc602090815260408084208490556001600160a01b03909416835260cb81528383209183525290812055565b60cd5460009061482a9060019061564f565b600083815260ce602052604081205460cd805493945090928490811061485257614852615469565b906000526020600020015490508060cd838154811061487357614873615469565b600091825260208083209091019290925582815260ce909152604080822084905585825281205560cd8054806148ab576148ab615947565b6001900381819060005260206000200160009055905550505050565b60006148d283612156565b6001600160a01b03909316600090815260cb60209081526040808320868452825280832085905593825260cc9052919091209190915550565b6001600160a01b0382166149615760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016118ae565b6000818152609b60205260409020546001600160a01b0316156149c65760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016118ae565b6149d4600083836001613f60565b6000818152609b60205260409020546001600160a01b031615614a395760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016118ae565b6001600160a01b0382166000818152609c6020908152604080832080546001019055848352609b90915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b82805482825590600052602060002090601f01602090048101928215614b485791602002820160005b83821115614b1957835183826101000a81548160ff02191690836007811115614af857614af86150c9565b02179055509260200192600101602081600001049283019260010302614acd565b8015614b465782816101000a81549060ff0219169055600101602081600001049283019260010302614b19565b505b50614b54929150614bcd565b5090565b82805482825590600052602060002090601f01602090048101928215614b485791602002820160005b83821115614b1957835183826101000a81548160ff02191690836007811115614bac57614bac6150c9565b02179055509260200192600101602081600001049283019260010302614b81565b5b80821115614b545760008155600101614bce565b6001600160e01b0319811681146130a257600080fd5b600060208284031215614c0a57600080fd5b81356130d681614be2565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614c4d57614c4d614c15565b60405290565b604051606081016001600160401b0381118282101715614c4d57614c4d614c15565b60405161016081016001600160401b0381118282101715614c4d57614c4d614c15565b604051601f8201601f191681016001600160401b0381118282101715614cc057614cc0614c15565b604052919050565b60006001600160401b03821115614ce157614ce1614c15565b5060051b60200190565b6000806040808486031215614cff57600080fd5b833592506020808501356001600160401b03811115614d1d57600080fd5b8501601f81018713614d2e57600080fd5b8035614d41614d3c82614cc8565b614c98565b81815260069190911b82018301908381019089831115614d6057600080fd5b928401925b82841015614da05785848b031215614d7d5760008081fd5b614d85614c2b565b84358152858501358682015282529285019290840190614d65565b8096505050505050509250929050565b60008060408385031215614dc357600080fd5b50508035926020909101359150565b60005b83811015614ded578181015183820152602001614dd5565b50506000910152565b60008151808452614e0e816020860160208601614dd2565b601f01601f19169290920160200192915050565b6020815260006130d66020830184614df6565b600060208284031215614e4757600080fd5b5035919050565b6001600160a01b03811681146130a257600080fd5b60008060408385031215614e7657600080fd5b8235614e8181614e4e565b946020939093013593505050565b600060208284031215614ea157600080fd5b81356130d681614e4e565b600080600060608486031215614ec157600080fd5b8335614ecc81614e4e565b92506020840135614edc81614e4e565b929592945050506040919091013590565b600082601f830112614efe57600080fd5b81356001600160401b03811115614f1757614f17614c15565b614f2a601f8201601f1916602001614c98565b818152846020838601011115614f3f57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614f6d57600080fd5b81356020614f7d614d3c83614cc8565b82815260059290921b84018101918181019086841115614f9c57600080fd5b8286015b84811015614fdb5780356001600160401b03811115614fbf5760008081fd5b614fcd8986838b0101614eed565b845250918301918301614fa0565b509695505050505050565b60008060408385031215614ff957600080fd5b8235915060208301356001600160401b0381111561501657600080fd5b61502285828601614f5c565b9150509250929050565b600080600080600060a0868803121561504457600080fd5b853561504f81614e4e565b945060208601356001600160401b038082111561506b57600080fd5b61507789838a01614eed565b9550604088013591508082111561508d57600080fd5b5061509a88828901614eed565b93505060608601356150ab81614e4e565b915060808601356150bb81614e4e565b809150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600881106150fd57634e487b7160e01b600052602160045260246000fd5b9052565b60006102208201905088825287516020830152602088015160408301526040880151606083015260608801516080830152608088015160a083015260a088015160c083015260c088015160e083015260e08801516101008181850152808a01519150506101206151748185018315159052565b890151610140848101919091528901516101608401525061018082018790526001600160a01b0386166101a0830152846101c08301526151c06101e08301856001600160a01b03169052565b6137506102008301846150df565b80151581146130a257600080fd5b80356151e7816151ce565b919050565b600080604083850312156151ff57600080fd5b823561520a81614e4e565b9150602083013561521a816151ce565b809150509250929050565b6000806000806080858703121561523b57600080fd5b843561524681614e4e565b9350602085013561525681614e4e565b92506040850135915060608501356001600160401b0381111561527857600080fd5b61528487828801614eed565b91505092959194509250565b600082601f8301126152a157600080fd5b813560206152b1614d3c83614cc8565b828152606092830285018201928282019190878511156152d057600080fd5b8387015b858110156153205781818a0312156152ec5760008081fd5b6152f4614c53565b81358152858201358682015260408083013561530f81614e4e565b9082015284529284019281016152d4565b5090979650505050505050565b60008060008060008587036101e081121561534757600080fd5b6101608082121561535757600080fd5b61535f614c75565b9150873582526020880135602083015260408801356040830152606088013560608301526080880135608083015260a088013560a083015260c088013560c083015260e088013560e08301526101006153b9818a016151dc565b90830152610120888101359083015261014080890135908301529095508601356001600160401b03808211156153ee57600080fd5b6153fa89838a01615290565b955061018088013594506101a088013593506101c088013591508082111561542157600080fd5b5061542e88828901614f5c565b9150509295509295909350565b6000806040838503121561544e57600080fd5b823561545981614e4e565b9150602083013561521a81614e4e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016154a7576154a761547f565b5060010190565b6000602082840312156154c057600080fd5b5051919050565b6000602082840312156154d957600080fd5b81516130d6816151ce565b600060a082840312156154f657600080fd5b60405160a081018181106001600160401b038211171561551857615518614c15565b80604052508251815260208301516020820152604083015161553981614e4e565b6040820152606083015161554c816151ce565b6060820152608083015161555f81614e4e565b60808201529392505050565b8381526060810161557f60208301856150df565b6001600160a01b03929092166040919091015292915050565b600181811c908216806155ac57607f821691505b6020821081036155cc57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156155e457600080fd5b81516130d681614e4e565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b8082018082111561062f5761062f61547f565b8181038181111561062f5761062f61547f565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b8281526040602082015260006133d86040830184614df6565b600082516156d2818460208701614dd2565b9190910192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b815160009082906020808601845b838110156157a357815185529382019390820190600101615787565b50929695505050505050565b808202811582820484141761062f5761062f61547f565b6000826157e357634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061581b90830184614df6565b9695505050505050565b60006020828403121561583757600080fd5b81516130d681614be2565b601f82111561194f57600081815260208120601f850160051c810160208610156158695750805b601f850160051c820191505b8181101561214e57828155600101615875565b81516001600160401b038111156158a1576158a1614c15565b6158b5816158af8454615598565b84615842565b602080601f8311600181146158ea57600084156158d25750858301515b600019600386901b1c1916600185901b17855561214e565b600085815260208120601f198616915b82811015615919578886015182559484019460019091019084016158fa565b50858210156159375787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603160045260246000fdfe9249b5b023ae28b94b85dd92d6432cec63267a9d5c52f82a83da2f987b142cc9a26469706673582212207674641a5814057181bbb3196b6d431a30d9433656a67fa17708078032a5d44564736f6c63430008130033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106102325760003560e01c806370a0823111610130578063aaf741e4116100b8578063d2d849761161007c578063d2d849761461059c578063d56f7bcc146105af578063e985e9c5146105c2578063f2ca5dc5146105fe578063f2fde38b1461061157600080fd5b8063aaf741e414610521578063b88d4fde14610542578063bd66528a14610555578063c87b56dd14610568578063ca0345271461057b57600080fd5b806381cd872a116100ff57806381cd872a146104005780638456cb59146104ec5780638da5cb5b146104f457806395d89b4114610506578063a22cb4651461050e57600080fd5b806370a08231146103be578063715018a6146103d15780637249fbb6146103d957806379502c55146103ec57600080fd5b806320e3dbd4116101be57806342842e0e1161018257806342842e0e146103675780634f6ccce71461037a5780635c975abb1461038d5780636352211e146103985780636cf1dbed146103ab57600080fd5b806320e3dbd41461031357806323b872dd146103265780632f745c59146103395780633f4ba83a1461034c5780634246c1b71461035457600080fd5b806308122cc71161020557806308122cc71461029c578063081812fc146102af578063095ea7b3146102da5780631615fd03146102ed57806318160ddd1461030157600080fd5b806301ffc9a714610237578063042bc95b1461025f57806304f999c71461027457806306fdde0314610287575b600080fd5b61024a610245366004614bf8565b610624565b60405190151581526020015b60405180910390f35b61027261026d366004614ceb565b610635565b005b610272610282366004614db0565b610cfc565b61028f611046565b6040516102569190614e22565b6102726102aa366004614e35565b6110d8565b6102c26102bd366004614e35565b611813565b6040516001600160a01b039091168152602001610256565b6102726102e8366004614e63565b61183a565b610163546102c2906001600160a01b031681565b60cd545b604051908152602001610256565b610272610321366004614e8f565b611954565b610272610334366004614eac565b6119c7565b610305610347366004614e63565b6119f9565b610272611a8f565b610272610362366004614fe6565b611aa1565b610272610375366004614eac565b611ede565b610305610388366004614e35565b611ef9565b60fd5460ff1661024a565b6102c26103a6366004614e35565b611f8c565b6102726103b936600461502c565b611fec565b6103056103cc366004614e8f565b612156565b6102726121dc565b6102726103e7366004614e35565b6121ee565b610162546102c2906001600160a01b031681565b6104d961040e366004614e35565b610165602090815260009182526040918290208054835161016081018552600183015481526002830154938101939093526003820154938301939093526004810154606083015260058101546080830152600681015460a0830152600781015460c0830152600881015460e0830152600981015460ff9081161515610100840152600a820154610120840152600b820154610140840152600c820154600d830154600e840154600f9094015491936001600160a01b0391821693909291821691600160a01b90041687565b6040516102569796959493929190615101565b610272612537565b61012f546001600160a01b03166102c2565b61028f612547565b61027261051c3660046151ec565b612556565b61030561052f366004614e35565b6101996020526000908152604090205481565b610272610550366004615225565b612565565b610272610563366004614e35565b61259d565b61028f610576366004614e35565b612864565b610305610589366004614e35565b6101986020526000908152604090205481565b6102726105aa366004614e8f565b612883565b6102726105bd36600461532d565b6128f6565b61024a6105d036600461543b565b6001600160a01b039182166000908152609e6020908152604080832093909416825291909152205460ff1690565b61030561060c366004614e35565b61300d565b61027261061f366004614e8f565b61302c565b600061062f826130a5565b92915050565b6000828152610165602052604090206001015482906106675760405163223da47360e21b815260040160405180910390fd5b6518d85b98d95b60d21b60005261016460209081527f81062d4f7ca92921b22616119900c96f98bed102c24746a50196946c312490ea8054604080518285028101850190915281815286939092919083018282801561071557602002820191906000526020600020906000905b82829054906101000a900460ff1660078111156106f3576106f36150c9565b8152602060019283018181049485019490930390920291018084116106d45790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156107a25783818151811061075757610757615469565b60200260200101516007811115610770576107706150c9565b826007811115610782576107826150c9565b0361079057600192506107a2565b8061079a81615495565b91505061073c565b50816001146107c457604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600d8101543391906001600160a01b03168214610803576040516308ffd32360e41b815260040160405180910390fd5b61016254604051630bb2c35960e21b81526b18db185a5b57dc195c9a5bd960a21b6004820152610889916001600160a01b031690632ecb0d6490602401602060405180830381865afa15801561085d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088191906154ae565b8254906130ca565b4210156108a95760405163e340eb8560e01b815260040160405180910390fd5b600f8101805460ff60a01b198116600160a21b17909155600160a01b900460ff166108d38a6130dd565b60008160078111156108e7576108e76150c9565b0361099157600f820154600d830154600e84015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af115801561094b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096f91906154c7565b61098c5760405163244743ff60e01b815260040160405180910390fd5b610cbd565b60018160078111156109a5576109a56150c9565b1480156109b55750600a82015442105b15610ca4576109c3896130e5565b6008830154146109e65760405163b124e96f60e01b815260040160405180910390fd5b60008060005b8b51811015610a9e578b8181518110610a0757610a07615469565b6020026020010151600001514210158015610a465750821580610a465750828c8281518110610a3857610a38615469565b602002602001015160000151105b15610a8c578b8181518110610a5d57610a5d615469565b60200260200101516000015192508b8181518110610a7d57610a7d615469565b60200260200101516020015191505b80610a9681615495565b9150506109ec565b506064811115610aac575060645b6000610abc85600e015483613194565b600f860154600d870154600e8801549293506001600160a01b039182169263a9059cbb9290911690610aee90856131db565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303816000875af1158015610b39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5d91906154c7565b610b7a5760405163244743ff60e01b815260040160405180910390fd5b600081118015610c7e5750600f8501546101635460038701546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa158015610be2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0691906154e4565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610c58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c7c91906154c7565b155b15610c9c5760405163244743ff60e01b815260040160405180910390fd5b505050610cbd565b604051632adde06f60e21b815260040160405180910390fd5b60008051602061595e8339815191528a600485604051610cdf9392919061556b565b60405180910390a1610cf08a6131e7565b50505050505050505050565b600082815261016560205260409020600101548290610d2e5760405163223da47360e21b815260040160405180910390fd5b6101635460008481526101656020526040908190206003015490516329db379b60e11b8152600481019190915284916001600160a01b0316906353b66f369060240160a060405180830381865afa158015610d8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db191906154e4565b608001516001600160a01b0316336001600160a01b031614610de6576040516308ffd32360e41b815260040160405180910390fd5b651c995a9958dd60d21b60005261016460209081527fc46af9fb757a5392b04e96a191cee5d6fe9386d767a56a820e480e8cd4dd9fd980546040805182850281018501909152818152879390929190830182828015610e9457602002820191906000526020600020906000905b82829054906101000a900460ff166007811115610e7257610e726150c9565b815260206001928301818104948501949093039092029101808411610e535790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015610f2157838181518110610ed657610ed6615469565b60200260200101516007811115610eef57610eef6150c9565b826007811115610f0157610f016150c9565b03610f0f5760019250610f21565b80610f1981615495565b915050610ebb565b5081600114610f4357604051632adde06f60e21b815260040160405180910390fd5b600088815261016560205260409020600f8101805460ff60a01b1916600160a11b179055610f718989613231565b600f810154600d820154600e83015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af1158015610fd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff491906154c7565b6110115760405163244743ff60e01b815260040160405180910390fd5b60008051602061595e833981519152896002336040516110339392919061556b565b60405180910390a1505050505050505050565b60606099805461105590615598565b80601f016020809104026020016040519081016040528092919081815260200182805461108190615598565b80156110ce5780601f106110a3576101008083540402835291602001916110ce565b820191906000526020600020905b8154815290600101906020018083116110b157829003601f168201915b5050505050905090565b60008181526101656020526040902060010154819061110a5760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa158015611169573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118d91906154e4565b608001516001600160a01b0316336001600160a01b0316146111c2576040516308ffd32360e41b815260040160405180910390fd5b6718da1958dad3dd5d60c21b60005261016460209081527fc1dd3999e8023eaa9ce335ac20c9f0911c06155bdf47040ab8df5eebc20004ba8054604080518285028101850190915281815286939092919083018282801561127257602002820191906000526020600020906000905b82829054906101000a900460ff166007811115611250576112506150c9565b8152602060019283018181049485019490930390920291018084116112315790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156112ff578381815181106112b4576112b4615469565b602002602001015160078111156112cd576112cd6150c9565b8260078111156112df576112df6150c9565b036112ed57600192506112ff565b806112f781615495565b915050611299565b508160011461132157604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600b8101544210156113555760405163e340eb8560e01b815260040160405180910390fd5b600f8101805460ff60a01b1916600360a11b179055611373886130dd565b600e81015461016254604051630bb2c35960e21b81526b70726f746f636f6c5f66656560a01b60048201526000928392839261140492916001600160a01b031690632ecb0d64906024015b602060405180830381865afa1580156113db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ff91906154ae565b613194565b600c8501549093501561145c57600e84015461016254604051630bb2c35960e21b81526b72657461696c65725f66656560a01b600482015261145992916001600160a01b031690632ecb0d64906024016113be565b91505b61147d826114778587600e01546131db90919063ffffffff16565b906131db565b90506000831180156115875750600f840154610162546040516321f8a72160e01b81526c19995957dc9958da5c1a595b9d609a1b60048201526001600160a01b039283169263a9059cbb9216906321f8a72190602401602060405180830381865afa1580156114f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151491906155d2565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018690526044016020604051808303816000875af1158015611561573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061158591906154c7565b155b156115a55760405163244743ff60e01b815260040160405180910390fd5b6000821180156116a95750600f84015461016354600c8601546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa15801561160d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163191906154e4565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af1158015611683573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116a791906154c7565b155b156116c75760405163244743ff60e01b815260040160405180910390fd5b600f8401546101635460038601546040516329db379b60e11b815260048101919091526001600160a01b039283169263a9059cbb9216906353b66f369060240160a060405180830381865afa158015611724573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174891906154e4565b60409081015190516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af115801561179a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117be91906154c7565b6117db5760405163244743ff60e01b815260040160405180910390fd5b60008051602061595e8339815191528b6006336040516117fd9392919061556b565b60405180910390a15b5050505050505050505050565b600061181e82613239565b506000908152609d60205260409020546001600160a01b031690565b600061184582611f8c565b9050806001600160a01b0316836001600160a01b0316036118b75760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b03821614806118d357506118d381336105d0565b6119455760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016118ae565b61194f8383613298565b505050565b61195c613306565b61016254604080516001600160a01b03928316815291831660208301527fbd7986d31c086d8cc2901a1c41d1edc0af6e8a7a5c6fc1b8283919c1b2122c38910160405180910390a161016280546001600160a01b0319166001600160a01b0392909216919091179055565b6119d2335b82613361565b6119ee5760405162461bcd60e51b81526004016118ae906155ef565b61194f8383836133e0565b6000611a0483612156565b8210611a665760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b60648201526084016118ae565b506001600160a01b0391909116600090815260cb60209081526040808320938352929052205490565b611a97613306565b611a9f613551565b565b600082815261016560205260409020600101548290611ad35760405163223da47360e21b815260040160405180910390fd5b6631b432b1b5a4b760c91b60005261016460209081527fc78e0758b723b136c59844f7da34685e7f27894489b1657d97b9b8e3e8e19ced80546040805182850281018501909152818152869390929190830182828015611b8257602002820191906000526020600020906000905b82829054906101000a900460ff166007811115611b6057611b606150c9565b815260206001928301818104948501949093039092029101808411611b415790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015611c0f57838181518110611bc457611bc4615469565b60200260200101516007811115611bdd57611bdd6150c9565b826007811115611bef57611bef6150c9565b03611bfd5760019250611c0f565b80611c0781615495565b915050611ba9565b5081600114611c3157604051632adde06f60e21b815260040160405180910390fd5b6000878152610165602052604080822061016354600382015492516329db379b60e11b81529193926001600160a01b03909116916353b66f3691611c7b9160040190815260200190565b60a060405180830381865afa158015611c98573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cbc91906154e4565b608081015190915033906000906001600160a01b03168203611dd757611cf5611cf0856001016000015485608001516135a3565b613607565b9050611d33818b600081518110611d0e57611d0e615469565b602002602001015185608001516001600160a01b031661361a9092919063ffffffff16565b611d505760405163a2fb840f60e01b815260040160405180910390fd5b600a840154421015611dd2576001840154600d850154611d7c91611cf0916001600160a01b03166135a3565b9050611db5818b600181518110611d9557611d95615469565b6020908102919091010151600d8701546001600160a01b0316919061361a565b611dd25760405163a2fb840f60e01b815260040160405180910390fd5b611e8f565b600d8401546001600160a01b0390811690831603611e76576001840154600d850154611e0f91611cf0916001600160a01b03166135a3565b9050611e28818b600081518110611d9557611d95615469565b611e455760405163a2fb840f60e01b815260040160405180910390fd5b611e5d611cf0856001016000015485608001516135a3565b9050611db5818b600181518110611d0e57611d0e615469565b6040516308ffd32360e41b815260040160405180910390fd5b611e998b8b613231565b600f8401805460ff60a01b1916600560a01b17905560405160008051602061595e83398151915290611ed1908d90600590869061556b565b60405180910390a1611806565b61194f83838360405180602001604052806000815250612565565b6000611f0460cd5490565b8210611f675760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b60648201526084016118ae565b60cd8281548110611f7a57611f7a615469565b90600052602060002001549050919050565b6000818152609b60205260408120546001600160a01b03168061062f5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016118ae565b600054610100900460ff161580801561200c5750600054600160ff909116105b806120265750303b158015612026575060005460ff166001145b6120895760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016118ae565b6000805460ff1916600117905580156120ac576000805461ff0019166101001790555b6120b58661375c565b6120fc604051806040016040528060098152602001682232b0b62a37b5b2b760b91b815250604051806040016040528060048152602001631111505360e21b8152506137af565b612108858585856137f0565b801561214e576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b60006001600160a01b0382166121c05760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016118ae565b506001600160a01b03166000908152609c602052604090205490565b6121e4613306565b611a9f600061375c565b6000818152610165602052604090206001015481906122205760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa15801561227f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a391906154e4565b608001516001600160a01b0316336001600160a01b0316146122d8576040516308ffd32360e41b815260040160405180910390fd5b651c99599d5b9960d21b60005261016460209081527f07a4462434a8663ef8cbef768cea3239b3345cd5f028a224e47a7db4a71138368054604080518285028101850190915281815286939092919083018282801561238657602002820191906000526020600020906000905b82829054906101000a900460ff166007811115612364576123646150c9565b8152602060019283018181049485019490930390920291018084116123455790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b8351811015612413578381815181106123c8576123c8615469565b602002602001015160078111156123e1576123e16150c9565b8260078111156123f3576123f36150c9565b036124015760019250612413565b8061240b81615495565b9150506123ad565b508160011461243557604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600f8101805460ff60a01b1916600360a01b179055612462886130dd565b600f810154600d820154600e83015460405163a9059cbb60e01b81526001600160a01b039283166004820152602481019190915291169063a9059cbb906044016020604051808303816000875af11580156124c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e591906154c7565b6125025760405163244743ff60e01b815260040160405180910390fd5b60008051602061595e833981519152886003336040516125249392919061556b565b60405180910390a15b5050505050505050565b61253f613306565b611a9f613aad565b6060609a805461105590615598565b612561338383613aea565b5050565b61256f3383613361565b61258b5760405162461bcd60e51b81526004016118ae906155ef565b61259784848484613bb8565b50505050565b6000818152610165602052604090206001015481906125cf5760405163223da47360e21b815260040160405180910390fd5b6101635460008381526101656020526040908190206003015490516329db379b60e11b8152600481019190915283916001600160a01b0316906353b66f369060240160a060405180830381865afa15801561262e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265291906154e4565b608001516001600160a01b0316336001600160a01b031614612687576040516308ffd32360e41b815260040160405180910390fd5b64636c61696d60d81b60005261016460209081527f8fded9216611b5e46bf52fe515d6ddc32059da80463e1a4891e5dc68d5c1a8a88054604080518285028101850190915281815286939092919083018282801561273457602002820191906000526020600020906000905b82829054906101000a900460ff166007811115612712576127126150c9565b8152602060019283018181049485019490930390920291018084116126f35790505b505050600084815261016560205260408120600f0154909250600160a01b900460ff169050815b83518110156127c15783818151811061277657612776615469565b6020026020010151600781111561278f5761278f6150c9565b8260078111156127a1576127a16150c9565b036127af57600192506127c1565b806127b981615495565b91505061275b565b50816001146127e357604051632adde06f60e21b815260040160405180910390fd5b600087815261016560205260409020600d81015461280b9089906001600160a01b0316613231565b600f8101805460ff60a01b1916600160a01b17905560405160008051602061595e83398151915290612843908a90600190339061556b565b60405180910390a1600d81015461252d9089906001600160a01b0316613beb565b606061286f82613239565b505060408051602081019091526000815290565b61288b613306565b61016354604080516001600160a01b03928316815291831660208301527fb468923d3f8581bd45345fed844c850e4c681b7170a99d4b47a7f92f66e226d2910160405180910390a161016380546001600160a01b0319166001600160a01b0392909216919091179055565b336000612905611cf088613c1f565b610163546040808a015190516329db379b60e11b81529293506000926001600160a01b03909216916353b66f36916129439160040190815260200190565b60a060405180830381865afa158015612960573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061298491906154e4565b90506129c2828560008151811061299d5761299d615469565b602002602001015183608001516001600160a01b031661361a9092919063ffffffff16565b6129df5760405163a2fb840f60e01b815260040160405180910390fd5b610163546040808a0151905163a241f54d60e01b81526001600160a01b039092169163a241f54d91612a179160040190815260200190565b602060405180830381865afa158015612a34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5891906154c7565b612a755760405163e1040adb60e01b815260040160405180910390fd5b8415612ba557610163546040516329db379b60e11b8152600481018790526000916001600160a01b0316906353b66f369060240160a060405180830381865afa158015612ac6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612aea91906154e4565b60408101519091506001600160a01b0316612b18576040516301e8b0f960e51b815260040160405180910390fd5b6101635460405163a241f54d60e01b8152600481018890526001600160a01b039091169063a241f54d90602401602060405180830381865afa158015612b62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b8691906154c7565b612ba357604051630620118d60e51b815260040160405180910390fd5b505b87516000818152610165602052604090206001015403612bd857604051635d341dcb60e11b815260040160405180910390fd5b6000612be388613d05565b90508860c001518114612c09576040516304b1ffc560e51b815260040160405180910390fd5b50505060008060005b8751811015612c965786888281518110612c2e57612c2e615469565b60200260200101516000015103612c8457878181518110612c5157612c51615469565b6020026020010151602001519250878181518110612c7157612c71615469565b6020026020010151604001519150612c96565b80612c8e81615495565b915050612c12565b506001600160a01b038116612cbe57604051632c46fa3160e21b815260040160405180910390fd5b612cca88838387613daa565b87516000818152610165602052604090206001015403612cfd5760405163a00179fd60e01b815260040160405180910390fd5b6040518060e00160405280428152602001898152602001868152602001846001600160a01b03168152602001838152602001826001600160a01b0316815260200160006007811115612d5157612d516150c9565b90528851600090815261016560209081526040918290208351815583820151805160018301559182015160028201558183015160038201556060808301516004830155608080840151600584015560a080850151600685015560c08086015160078087019190915560e0870151600887015561010087015160098701805491151560ff19909216919091179055610120870151600a87015561014090960151600b86015595870151600c85015591860151600d840180546001600160a01b039283166001600160a01b03199182161790915591870151600e85015591860151600f840180549190931691811682178355948601519294929391926001600160a81b0319161790600160a01b908490811115612e6e57612e6e6150c9565b0217905550905050600184511115612f40576000806000612ea887600181518110612e9b57612e9b615469565b6020026020010151613dbe565b60208e015160405163d505accf60e01b81526001600160a01b038b81166004830152306024830152604482018b9052606482019290925260ff8516608482015260a4810184905260c48101839052939650919450925085169063d505accf9060e401600060405180830381600087803b158015612f2457600080fd5b505af1158015612f38573d6000803e3d6000fd5b505050505050505b6040516323b872dd60e01b81526001600160a01b038481166004830152306024830152604482018490528216906323b872dd906064016020604051808303816000875af1158015612f95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fb991906154c7565b612fd65760405163244743ff60e01b815260040160405180910390fd5b875160405160008051602061595e83398151915291612ff991600090879061556b565b60405180910390a161252d88838387613e1f565b600061301882613239565b506000908152610198602052604090205490565b613034613306565b6001600160a01b0381166130995760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016118ae565b6130a28161375c565b50565b60006001600160e01b0319821663780e9d6360e01b148061062f575061062f82613e24565b60006130d6828461563c565b9392505050565b6130a2613e74565b60008082516001600160401b0381111561310157613101614c15565b60405190808252806020026020018201604052801561312a578160200160208202803683370190505b50905060005b835181101561318a5761315b84828151811061314e5761314e615469565b6020026020010151613eba565b82828151811061316d5761316d615469565b60209081029190910101528061318281615495565b915050613130565b506130d681613f07565b600060648211156131b857604051635c974e3d60e11b815260040160405180910390fd5b6130d66103e86131d5606481866131cf8986613f1a565b90613f1a565b90613f26565b60006130d6828461564f565b6000818152610199602052604090205480156132285761320681613f32565b6000818152610198602090815260408083208390558483526101999091528120555b612561826130dd565b612561613e74565b6000818152609b60205260409020546001600160a01b03166130a25760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016118ae565b6000818152609d6020526040902080546001600160a01b0319166001600160a01b03841690811790915581906132cd82611f8c565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b61012f546001600160a01b03163314611a9f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016118ae565b60008061336d83611f8c565b9050806001600160a01b0316846001600160a01b031614806133b457506001600160a01b038082166000908152609e602090815260408083209388168352929052205460ff165b806133d85750836001600160a01b03166133cd84611813565b6001600160a01b0316145b949350505050565b826001600160a01b03166133f382611f8c565b6001600160a01b0316146134195760405162461bcd60e51b81526004016118ae90615662565b6001600160a01b03821661347b5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016118ae565b6134888383836001613f60565b826001600160a01b031661349b82611f8c565b6001600160a01b0316146134c15760405162461bcd60e51b81526004016118ae90615662565b6000818152609d6020908152604080832080546001600160a01b03199081169091556001600160a01b03878116808652609c8552838620805460001901905590871680865283862080546001019055868652609b90945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b613559614046565b60fd805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b604080517ff811d7f3ddb148410001929e2cbfb7fea8779b9349b7c2f650fa91840528d69c60208201529081018390526001600160a01b03821660608201526000906080015b60405160208183030381529060405280519060200120905092915050565b600061062f61361461408f565b8361410f565b60008060006136298585614136565b90925090506000816004811115613642576136426150c9565b1480156136605750856001600160a01b0316826001600160a01b0316145b15613670576001925050506130d6565b600080876001600160a01b0316631626ba7e60e01b88886040516024016136989291906156a7565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516136d691906156c0565b600060405180830381855afa9150503d8060008114613711576040519150601f19603f3d011682016040523d82523d6000602084013e613716565b606091505b5091509150818015613729575080516020145b801561375057508051630b135d3f60e11b9061374e90830160209081019084016154ae565b145b98975050505050505050565b61012f80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166137d65760405162461bcd60e51b81526004016118ae906156dc565b6137e0828261417b565b6137e86141ac565b6125616141d3565b600054610100900460ff166138175760405162461bcd60e51b81526004016118ae906156dc565b6138218484614202565b6138296141d3565b61016280546001600160a01b038481166001600160a01b03199283161790925561016380549284169290911691909117905560408051602081019091528060009052651c995a9958dd60d21b6000526101646020526138ab907fc46af9fb757a5392b04e96a191cee5d6fe9386d767a56a820e480e8cd4dd9fd9906001614aa4565b50604080518082019091528060008152602001600190526518d85b98d95b60d21b600052610164602052613902907f81062d4f7ca92921b22616119900c96f98bed102c24746a50196946c312490ea906002614b58565b5060408051808201909152806001815260200160059052651c99599d5b9960d21b600052610164602052613959907f07a4462434a8663ef8cbef768cea3239b3345cd5f028a224e47a7db4a7113836906002614b58565b506040805160208101909152806000905264636c61696d60d81b6000526101646020526139a9907f8fded9216611b5e46bf52fe515d6ddc32059da80463e1a4891e5dc68d5c1a8a8906001614aa4565b50604080516020810190915280600190526631b432b1b5a4b760c91b6000526101646020526139fb907fc78e0758b723b136c59844f7da34685e7f27894489b1657d97b9b8e3e8e19ced906001614aa4565b50604080516020810190915280600590526718da1958dad3dd5d60c21b600052610164602052613a4e907fc1dd3999e8023eaa9ce335ac20c9f0911c06155bdf47040ab8df5eebc20004ba906001614aa4565b5060408051808201909152806005815260200160069052666469737075746560c81b600052610164602052613aa6907f755971b5036353f540d427876647973a20fcd901626978bb47564e1a4a28b6d4906002614b58565b5050505050565b613ab5613e74565b60fd805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586135863390565b816001600160a01b0316836001600160a01b031603613b4b5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016118ae565b6001600160a01b038381166000818152609e6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b613bc38484846133e0565b613bcf84848484614233565b6125975760405162461bcd60e51b81526004016118ae90615727565b6000613bf682614334565b600081815261019860209081526040808320879055958252610199905293909320929092555050565b60007f4fb12343a6f44152999c71291770d97fc1eace9d7d04889330d5a6d1af4a57c7826000015183602001518460400151856060015186608001518760a001518860c001518960e001518a61010001518b61012001518c6101400151604051602001613ce89c9b9a999897969594939291909b8c5260208c019a909a5260408b019890985260608a0196909652608089019490945260a088019290925260c087015260e086015261010085015215156101208401526101408301526101608201526101800190565b604051602081830303815290604052805190602001209050919050565b60008082516001600160401b03811115613d2157613d21614c15565b604051908082528060200260200182016040528015613d4a578160200160208202803683370190505b50905060005b835181101561318a57613d7b848281518110613d6e57613d6e615469565b602002602001015161435c565b828281518110613d8d57613d8d615469565b602090810291909101015280613da281615495565b915050613d50565b613db2613e74565b612597848484846143ca565b60008060008351604103613dff5750505060208101516040820151606083015160001a919082613ded57601b92505b60018303613dfa57601c92505b613e18565b604051638baa579f60e01b815260040160405180910390fd5b9193909250565b612597565b60006001600160e01b031982166380ac58cd60e01b1480613e5557506001600160e01b03198216635b5e139f60e01b145b8061062f57506301ffc9a760e01b6001600160e01b031983161461062f565b60fd5460ff1615611a9f5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016118ae565b8051602080830151604051600093613ce8937f8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5939192019283526020830191909152604082015260600190565b600081604051602001613ce89190615779565b60006130d682846157af565b60006130d682846157c6565b613f3b336119cc565b613f575760405162461bcd60e51b81526004016118ae906155ef565b6130a2816143d2565b613f68613e74565b6001600160a01b03841615801590613f8857506001600160a01b03831615155b1561403a576000828152610198602052604090205480613fbb5760405163223da47360e21b815260040160405180910390fd5b600081815261016560205260409020600981015460ff161580613ffe57506001600f820154600160a01b900460ff166007811115613ffb57613ffb6150c9565b14155b1561401c5760405163ca7cbc7760e01b815260040160405180910390fd5b600d0180546001600160a01b0319166001600160a01b038616179055505b61259784848484614475565b60fd5460ff16611a9f5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016118ae565b600061410a7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6140be60015490565b6002546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b905090565b60405161190160f01b602082015260228101839052604281018290526000906062016135e9565b600080825160410361416c5760208301516040840151606085015160001a61416087828585614489565b94509450505050614174565b506000905060025b9250929050565b600054610100900460ff166141a25760405162461bcd60e51b81526004016118ae906156dc565b612561828261454d565b600054610100900460ff16611a9f5760405162461bcd60e51b81526004016118ae906156dc565b600054610100900460ff166141fa5760405162461bcd60e51b81526004016118ae906156dc565b611a9f61458d565b600054610100900460ff166142295760405162461bcd60e51b81526004016118ae906156dc565b61256182826145c0565b60006001600160a01b0384163b1561432957604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906142779033908990889088906004016157e8565b6020604051808303816000875af19250505080156142b2575060408051601f3d908101601f191682019092526142af91810190615825565b60015b61430f573d8080156142e0576040519150601f19603f3d011682016040523d82523d6000602084013e6142e5565b606091505b5080516000036143075760405162461bcd60e51b81526004016118ae90615727565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506133d8565b506001949350505050565b6000806143416101615490565b905061435261016180546001019055565b61062f8382614601565b60007f2f8fc0b3ad3f58f6deb367673d38e4112a3c8c64de033c5b780b84ef8f67cde6826000015183602001518460400151604051602001613ce8949392919093845260208401929092526040830152606090811b6bffffffffffffffffffffffff19169082015260740190565b612597613e74565b60006143dd82611f8c565b90506143ed816000846001613f60565b6143f682611f8c565b6000838152609d6020908152604080832080546001600160a01b03199081169091556001600160a01b038516808552609c84528285208054600019019055878552609b909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61447d613e74565b6125978484848461461b565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156144c05750600090506003614544565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614514573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661453d57600060019250925050614544565b9150600090505b94509492505050565b600054610100900460ff166145745760405162461bcd60e51b81526004016118ae906156dc565b60996145808382615888565b50609a61194f8282615888565b600054610100900460ff166145b45760405162461bcd60e51b81526004016118ae906156dc565b60fd805460ff19169055565b600054610100900460ff166145e75760405162461bcd60e51b81526004016118ae906156dc565b815160209283012081519190920120600191909155600255565b612561828260405180602001604052806000815250614748565b600181111561468a5760405162461bcd60e51b815260206004820152603560248201527f455243373231456e756d657261626c653a20636f6e7365637574697665207472604482015274185b9cd9995c9cc81b9bdd081cdd5c1c1bdc9d1959605a1b60648201526084016118ae565b816001600160a01b0385166146e6576146e18160cd8054600083815260ce60205260408120829055600182018355919091527f83978b4c69c48dd978ab43fe30f077615294f938fb7f936d9eb340e51ea7db2e0155565b614709565b836001600160a01b0316856001600160a01b03161461470957614709858261477b565b6001600160a01b0384166147255761472081614818565b613aa6565b846001600160a01b0316846001600160a01b031614613aa657613aa684826148c7565b614752838361490b565b61475f6000848484614233565b61194f5760405162461bcd60e51b81526004016118ae90615727565b6000600161478884612156565b614792919061564f565b600083815260cc60205260409020549091508082146147e5576001600160a01b038416600090815260cb60209081526040808320858452825280832054848452818420819055835260cc90915290208190555b50600091825260cc602090815260408084208490556001600160a01b03909416835260cb81528383209183525290812055565b60cd5460009061482a9060019061564f565b600083815260ce602052604081205460cd805493945090928490811061485257614852615469565b906000526020600020015490508060cd838154811061487357614873615469565b600091825260208083209091019290925582815260ce909152604080822084905585825281205560cd8054806148ab576148ab615947565b6001900381819060005260206000200160009055905550505050565b60006148d283612156565b6001600160a01b03909316600090815260cb60209081526040808320868452825280832085905593825260cc9052919091209190915550565b6001600160a01b0382166149615760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016118ae565b6000818152609b60205260409020546001600160a01b0316156149c65760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016118ae565b6149d4600083836001613f60565b6000818152609b60205260409020546001600160a01b031615614a395760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016118ae565b6001600160a01b0382166000818152609c6020908152604080832080546001019055848352609b90915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b82805482825590600052602060002090601f01602090048101928215614b485791602002820160005b83821115614b1957835183826101000a81548160ff02191690836007811115614af857614af86150c9565b02179055509260200192600101602081600001049283019260010302614acd565b8015614b465782816101000a81549060ff0219169055600101602081600001049283019260010302614b19565b505b50614b54929150614bcd565b5090565b82805482825590600052602060002090601f01602090048101928215614b485791602002820160005b83821115614b1957835183826101000a81548160ff02191690836007811115614bac57614bac6150c9565b02179055509260200192600101602081600001049283019260010302614b81565b5b80821115614b545760008155600101614bce565b6001600160e01b0319811681146130a257600080fd5b600060208284031215614c0a57600080fd5b81356130d681614be2565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b0381118282101715614c4d57614c4d614c15565b60405290565b604051606081016001600160401b0381118282101715614c4d57614c4d614c15565b60405161016081016001600160401b0381118282101715614c4d57614c4d614c15565b604051601f8201601f191681016001600160401b0381118282101715614cc057614cc0614c15565b604052919050565b60006001600160401b03821115614ce157614ce1614c15565b5060051b60200190565b6000806040808486031215614cff57600080fd5b833592506020808501356001600160401b03811115614d1d57600080fd5b8501601f81018713614d2e57600080fd5b8035614d41614d3c82614cc8565b614c98565b81815260069190911b82018301908381019089831115614d6057600080fd5b928401925b82841015614da05785848b031215614d7d5760008081fd5b614d85614c2b565b84358152858501358682015282529285019290840190614d65565b8096505050505050509250929050565b60008060408385031215614dc357600080fd5b50508035926020909101359150565b60005b83811015614ded578181015183820152602001614dd5565b50506000910152565b60008151808452614e0e816020860160208601614dd2565b601f01601f19169290920160200192915050565b6020815260006130d66020830184614df6565b600060208284031215614e4757600080fd5b5035919050565b6001600160a01b03811681146130a257600080fd5b60008060408385031215614e7657600080fd5b8235614e8181614e4e565b946020939093013593505050565b600060208284031215614ea157600080fd5b81356130d681614e4e565b600080600060608486031215614ec157600080fd5b8335614ecc81614e4e565b92506020840135614edc81614e4e565b929592945050506040919091013590565b600082601f830112614efe57600080fd5b81356001600160401b03811115614f1757614f17614c15565b614f2a601f8201601f1916602001614c98565b818152846020838601011115614f3f57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614f6d57600080fd5b81356020614f7d614d3c83614cc8565b82815260059290921b84018101918181019086841115614f9c57600080fd5b8286015b84811015614fdb5780356001600160401b03811115614fbf5760008081fd5b614fcd8986838b0101614eed565b845250918301918301614fa0565b509695505050505050565b60008060408385031215614ff957600080fd5b8235915060208301356001600160401b0381111561501657600080fd5b61502285828601614f5c565b9150509250929050565b600080600080600060a0868803121561504457600080fd5b853561504f81614e4e565b945060208601356001600160401b038082111561506b57600080fd5b61507789838a01614eed565b9550604088013591508082111561508d57600080fd5b5061509a88828901614eed565b93505060608601356150ab81614e4e565b915060808601356150bb81614e4e565b809150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600881106150fd57634e487b7160e01b600052602160045260246000fd5b9052565b60006102208201905088825287516020830152602088015160408301526040880151606083015260608801516080830152608088015160a083015260a088015160c083015260c088015160e083015260e08801516101008181850152808a01519150506101206151748185018315159052565b890151610140848101919091528901516101608401525061018082018790526001600160a01b0386166101a0830152846101c08301526151c06101e08301856001600160a01b03169052565b6137506102008301846150df565b80151581146130a257600080fd5b80356151e7816151ce565b919050565b600080604083850312156151ff57600080fd5b823561520a81614e4e565b9150602083013561521a816151ce565b809150509250929050565b6000806000806080858703121561523b57600080fd5b843561524681614e4e565b9350602085013561525681614e4e565b92506040850135915060608501356001600160401b0381111561527857600080fd5b61528487828801614eed565b91505092959194509250565b600082601f8301126152a157600080fd5b813560206152b1614d3c83614cc8565b828152606092830285018201928282019190878511156152d057600080fd5b8387015b858110156153205781818a0312156152ec5760008081fd5b6152f4614c53565b81358152858201358682015260408083013561530f81614e4e565b9082015284529284019281016152d4565b5090979650505050505050565b60008060008060008587036101e081121561534757600080fd5b6101608082121561535757600080fd5b61535f614c75565b9150873582526020880135602083015260408801356040830152606088013560608301526080880135608083015260a088013560a083015260c088013560c083015260e088013560e08301526101006153b9818a016151dc565b90830152610120888101359083015261014080890135908301529095508601356001600160401b03808211156153ee57600080fd5b6153fa89838a01615290565b955061018088013594506101a088013593506101c088013591508082111561542157600080fd5b5061542e88828901614f5c565b9150509295509295909350565b6000806040838503121561544e57600080fd5b823561545981614e4e565b9150602083013561521a81614e4e565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016154a7576154a761547f565b5060010190565b6000602082840312156154c057600080fd5b5051919050565b6000602082840312156154d957600080fd5b81516130d6816151ce565b600060a082840312156154f657600080fd5b60405160a081018181106001600160401b038211171561551857615518614c15565b80604052508251815260208301516020820152604083015161553981614e4e565b6040820152606083015161554c816151ce565b6060820152608083015161555f81614e4e565b60808201529392505050565b8381526060810161557f60208301856150df565b6001600160a01b03929092166040919091015292915050565b600181811c908216806155ac57607f821691505b6020821081036155cc57634e487b7160e01b600052602260045260246000fd5b50919050565b6000602082840312156155e457600080fd5b81516130d681614e4e565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b8082018082111561062f5761062f61547f565b8181038181111561062f5761062f61547f565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b8281526040602082015260006133d86040830184614df6565b600082516156d2818460208701614dd2565b9190910192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b815160009082906020808601845b838110156157a357815185529382019390820190600101615787565b50929695505050505050565b808202811582820484141761062f5761062f61547f565b6000826157e357634e487b7160e01b600052601260045260246000fd5b500490565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061581b90830184614df6565b9695505050505050565b60006020828403121561583757600080fd5b81516130d681614be2565b601f82111561194f57600081815260208120601f850160051c810160208610156158695750805b601f850160051c820191505b8181101561214e57828155600101615875565b81516001600160401b038111156158a1576158a1614c15565b6158b5816158af8454615598565b84615842565b602080601f8311600181146158ea57600084156158d25750858301515b600019600386901b1c1916600185901b17855561214e565b600085815260208120601f198616915b82811015615919578886015182559484019460019091019084016158fa565b50858210156159375787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052603160045260246000fdfe9249b5b023ae28b94b85dd92d6432cec63267a9d5c52f82a83da2f987b142cc9a26469706673582212207674641a5814057181bbb3196b6d431a30d9433656a67fa17708078032a5d44564736f6c63430008130033", "devdoc": { "custom:security-contact": "security@windingtree.com", "details": "This contract enables the creation and management of deals", @@ -1463,7 +1463,7 @@ "type": "t_bool" }, { - "astId": 3910, + "astId": 2904, "contract": "contracts/Market.sol:Market", "label": "_HASHED_NAME", "offset": 0, @@ -1471,7 +1471,7 @@ "type": "t_bytes32" }, { - "astId": 3912, + "astId": 2906, "contract": "contracts/Market.sol:Market", "label": "_HASHED_VERSION", "offset": 0, @@ -1479,7 +1479,7 @@ "type": "t_bytes32" }, { - "astId": 4050, + "astId": 3044, "contract": "contracts/Market.sol:Market", "label": "__gap", "offset": 0, @@ -1487,7 +1487,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 3290, + "astId": 2284, "contract": "contracts/Market.sol:Market", "label": "__gap", "offset": 0, @@ -1495,7 +1495,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 4177, + "astId": 3171, "contract": "contracts/Market.sol:Market", "label": "__gap", "offset": 0, @@ -1503,7 +1503,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 1476, + "astId": 470, "contract": "contracts/Market.sol:Market", "label": "_name", "offset": 0, @@ -1511,7 +1511,7 @@ "type": "t_string_storage" }, { - "astId": 1478, + "astId": 472, "contract": "contracts/Market.sol:Market", "label": "_symbol", "offset": 0, @@ -1519,7 +1519,7 @@ "type": "t_string_storage" }, { - "astId": 1482, + "astId": 476, "contract": "contracts/Market.sol:Market", "label": "_owners", "offset": 0, @@ -1527,7 +1527,7 @@ "type": "t_mapping(t_uint256,t_address)" }, { - "astId": 1486, + "astId": 480, "contract": "contracts/Market.sol:Market", "label": "_balances", "offset": 0, @@ -1535,7 +1535,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 1490, + "astId": 484, "contract": "contracts/Market.sol:Market", "label": "_tokenApprovals", "offset": 0, @@ -1543,7 +1543,7 @@ "type": "t_mapping(t_uint256,t_address)" }, { - "astId": 1496, + "astId": 490, "contract": "contracts/Market.sol:Market", "label": "_operatorApprovals", "offset": 0, @@ -1551,7 +1551,7 @@ "type": "t_mapping(t_address,t_mapping(t_address,t_bool))" }, { - "astId": 2398, + "astId": 1392, "contract": "contracts/Market.sol:Market", "label": "__gap", "offset": 0, @@ -1559,7 +1559,7 @@ "type": "t_array(t_uint256)44_storage" }, { - "astId": 2563, + "astId": 1557, "contract": "contracts/Market.sol:Market", "label": "_ownedTokens", "offset": 0, @@ -1567,7 +1567,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" }, { - "astId": 2567, + "astId": 1561, "contract": "contracts/Market.sol:Market", "label": "_ownedTokensIndex", "offset": 0, @@ -1575,7 +1575,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 2570, + "astId": 1564, "contract": "contracts/Market.sol:Market", "label": "_allTokens", "offset": 0, @@ -1583,7 +1583,7 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 2574, + "astId": 1568, "contract": "contracts/Market.sol:Market", "label": "_allTokensIndex", "offset": 0, @@ -1591,7 +1591,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 2906, + "astId": 1900, "contract": "contracts/Market.sol:Market", "label": "__gap", "offset": 0, @@ -1631,15 +1631,15 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 7988, + "astId": 6061, "contract": "contracts/Market.sol:Market", "label": "_tokenIdCounter", "offset": 0, "slot": "353", - "type": "t_struct(Counter)3297_storage" + "type": "t_struct(Counter)2291_storage" }, { - "astId": 6319, + "astId": 4392, "contract": "contracts/Market.sol:Market", "label": "config", "offset": 0, @@ -1647,7 +1647,7 @@ "type": "t_address" }, { - "astId": 6322, + "astId": 4395, "contract": "contracts/Market.sol:Market", "label": "entities", "offset": 0, @@ -1655,23 +1655,23 @@ "type": "t_address" }, { - "astId": 6329, + "astId": 4402, "contract": "contracts/Market.sol:Market", "label": "allowedStatuses", "offset": 0, "slot": "356", - "type": "t_mapping(t_bytes32,t_array(t_enum(DealStatus)9369)dyn_storage)" + "type": "t_mapping(t_bytes32,t_array(t_enum(DealStatus)6781)dyn_storage)" }, { - "astId": 6335, + "astId": 4408, "contract": "contracts/Market.sol:Market", "label": "deals", "offset": 0, "slot": "357", - "type": "t_mapping(t_bytes32,t_struct(Deal)9386_storage)" + "type": "t_mapping(t_bytes32,t_struct(Deal)6798_storage)" }, { - "astId": 7962, + "astId": 6035, "contract": "contracts/Market.sol:Market", "label": "__gap", "offset": 0, @@ -1679,7 +1679,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 8778, + "astId": 6190, "contract": "contracts/Market.sol:Market", "label": "tokenOffers", "offset": 0, @@ -1687,7 +1687,7 @@ "type": "t_mapping(t_uint256,t_bytes32)" }, { - "astId": 8783, + "astId": 6195, "contract": "contracts/Market.sol:Market", "label": "offerTokens", "offset": 0, @@ -1695,7 +1695,7 @@ "type": "t_mapping(t_bytes32,t_uint256)" }, { - "astId": 9106, + "astId": 6518, "contract": "contracts/Market.sol:Market", "label": "__gap", "offset": 0, @@ -1709,8 +1709,8 @@ "label": "address", "numberOfBytes": "20" }, - "t_array(t_enum(DealStatus)9369)dyn_storage": { - "base": "t_enum(DealStatus)9369", + "t_array(t_enum(DealStatus)6781)dyn_storage": { + "base": "t_enum(DealStatus)6781", "encoding": "dynamic_array", "label": "enum Utils.DealStatus[]", "numberOfBytes": "32" @@ -1755,7 +1755,7 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_enum(DealStatus)9369": { + "t_enum(DealStatus)6781": { "encoding": "inplace", "label": "enum Utils.DealStatus", "numberOfBytes": "1" @@ -1788,19 +1788,19 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_mapping(t_bytes32,t_array(t_enum(DealStatus)9369)dyn_storage)": { + "t_mapping(t_bytes32,t_array(t_enum(DealStatus)6781)dyn_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => enum Utils.DealStatus[])", "numberOfBytes": "32", - "value": "t_array(t_enum(DealStatus)9369)dyn_storage" + "value": "t_array(t_enum(DealStatus)6781)dyn_storage" }, - "t_mapping(t_bytes32,t_struct(Deal)9386_storage)": { + "t_mapping(t_bytes32,t_struct(Deal)6798_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct Utils.Deal)", "numberOfBytes": "32", - "value": "t_struct(Deal)9386_storage" + "value": "t_struct(Deal)6798_storage" }, "t_mapping(t_bytes32,t_uint256)": { "encoding": "mapping", @@ -1835,12 +1835,12 @@ "label": "string", "numberOfBytes": "32" }, - "t_struct(Counter)3297_storage": { + "t_struct(Counter)2291_storage": { "encoding": "inplace", "label": "struct CountersUpgradeable.Counter", "members": [ { - "astId": 3296, + "astId": 2290, "contract": "contracts/Market.sol:Market", "label": "_value", "offset": 0, @@ -1850,12 +1850,12 @@ ], "numberOfBytes": "32" }, - "t_struct(Deal)9386_storage": { + "t_struct(Deal)6798_storage": { "encoding": "inplace", "label": "struct Utils.Deal", "members": [ { - "astId": 9371, + "astId": 6783, "contract": "contracts/Market.sol:Market", "label": "created", "offset": 0, @@ -1863,15 +1863,15 @@ "type": "t_uint256" }, { - "astId": 9374, + "astId": 6786, "contract": "contracts/Market.sol:Market", "label": "offer", "offset": 0, "slot": "1", - "type": "t_struct(Offer)9360_storage" + "type": "t_struct(Offer)6772_storage" }, { - "astId": 9376, + "astId": 6788, "contract": "contracts/Market.sol:Market", "label": "retailerId", "offset": 0, @@ -1879,7 +1879,7 @@ "type": "t_bytes32" }, { - "astId": 9378, + "astId": 6790, "contract": "contracts/Market.sol:Market", "label": "buyer", "offset": 0, @@ -1887,7 +1887,7 @@ "type": "t_address" }, { - "astId": 9380, + "astId": 6792, "contract": "contracts/Market.sol:Market", "label": "price", "offset": 0, @@ -1895,7 +1895,7 @@ "type": "t_uint256" }, { - "astId": 9382, + "astId": 6794, "contract": "contracts/Market.sol:Market", "label": "asset", "offset": 0, @@ -1903,22 +1903,22 @@ "type": "t_address" }, { - "astId": 9385, + "astId": 6797, "contract": "contracts/Market.sol:Market", "label": "status", "offset": 20, "slot": "15", - "type": "t_enum(DealStatus)9369" + "type": "t_enum(DealStatus)6781" } ], "numberOfBytes": "512" }, - "t_struct(Offer)9360_storage": { + "t_struct(Offer)6772_storage": { "encoding": "inplace", "label": "struct Utils.Offer", "members": [ { - "astId": 9339, + "astId": 6751, "contract": "contracts/Market.sol:Market", "label": "id", "offset": 0, @@ -1926,7 +1926,7 @@ "type": "t_bytes32" }, { - "astId": 9341, + "astId": 6753, "contract": "contracts/Market.sol:Market", "label": "expire", "offset": 0, @@ -1934,7 +1934,7 @@ "type": "t_uint256" }, { - "astId": 9343, + "astId": 6755, "contract": "contracts/Market.sol:Market", "label": "supplierId", "offset": 0, @@ -1942,7 +1942,7 @@ "type": "t_bytes32" }, { - "astId": 9345, + "astId": 6757, "contract": "contracts/Market.sol:Market", "label": "chainId", "offset": 0, @@ -1950,7 +1950,7 @@ "type": "t_uint256" }, { - "astId": 9347, + "astId": 6759, "contract": "contracts/Market.sol:Market", "label": "requestHash", "offset": 0, @@ -1958,7 +1958,7 @@ "type": "t_bytes32" }, { - "astId": 9349, + "astId": 6761, "contract": "contracts/Market.sol:Market", "label": "optionsHash", "offset": 0, @@ -1966,7 +1966,7 @@ "type": "t_bytes32" }, { - "astId": 9351, + "astId": 6763, "contract": "contracts/Market.sol:Market", "label": "paymentHash", "offset": 0, @@ -1974,7 +1974,7 @@ "type": "t_bytes32" }, { - "astId": 9353, + "astId": 6765, "contract": "contracts/Market.sol:Market", "label": "cancelHash", "offset": 0, @@ -1982,7 +1982,7 @@ "type": "t_bytes32" }, { - "astId": 9355, + "astId": 6767, "contract": "contracts/Market.sol:Market", "label": "transferable", "offset": 0, @@ -1990,7 +1990,7 @@ "type": "t_bool" }, { - "astId": 9357, + "astId": 6769, "contract": "contracts/Market.sol:Market", "label": "checkIn", "offset": 0, @@ -1998,7 +1998,7 @@ "type": "t_uint256" }, { - "astId": 9359, + "astId": 6771, "contract": "contracts/Market.sol:Market", "label": "checkOut", "offset": 0, @@ -2020,4 +2020,4 @@ } } } -} +} \ No newline at end of file diff --git a/deployments/polzktest/solcInputs/21eac61dc4f78e216bbddc7cc9f68411.json b/deployments/polzktest/solcInputs/21eac61dc4f78e216bbddc7cc9f68411.json new file mode 100644 index 0000000..3071281 --- /dev/null +++ b/deployments/polzktest/solcInputs/21eac61dc4f78e216bbddc7cc9f68411.json @@ -0,0 +1,119 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n function __Ownable_init() internal onlyInitializing {\n __Ownable_init_unchained();\n }\n\n function __Ownable_init_unchained() internal onlyInitializing {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/interfaces/IERC1271Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC1271 standard signature validation method for\n * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].\n *\n * _Available since v4.1._\n */\ninterface IERC1271Upgradeable {\n /**\n * @dev Should return whether the signature provided is valid for the provided data\n * @param hash Hash of the data to be signed\n * @param signature Signature byte array associated with _data\n */\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\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 proxied contracts do not make use of 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 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\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 *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 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 Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts.\n *\n * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n * constructor.\n *\n * Emits an {Initialized} event.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n * are added through upgrades and that require initialization.\n *\n * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n * cannot be nested. If one is invoked in the context of another, execution will revert.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n *\n * WARNING: setting the version to 255 will prevent any future reinitialization.\n *\n * Emits an {Initialized} event.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n *\n * Emits an {Initialized} event the first time it is successfully executed.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n\n /**\n * @dev Returns the highest version that has been initialized. See {reinitializer}.\n */\n function _getInitializedVersion() internal view returns (uint8) {\n return _initialized;\n }\n\n /**\n * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n */\n function _isInitializing() internal view returns (bool) {\n return _initializing;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract PausableUpgradeable is Initializable, ContextUpgradeable {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n function __Pausable_init() internal onlyInitializing {\n __Pausable_init_unchained();\n }\n\n function __Pausable_init_unchained() internal onlyInitializing {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC721Upgradeable.sol\";\nimport \"./IERC721ReceiverUpgradeable.sol\";\nimport \"./extensions/IERC721MetadataUpgradeable.sol\";\nimport \"../../utils/AddressUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../utils/StringsUpgradeable.sol\";\nimport \"../../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including\n * the Metadata extension, but not including the Enumerable extension, which is available separately as\n * {ERC721Enumerable}.\n */\ncontract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {\n using AddressUpgradeable for address;\n using StringsUpgradeable for uint256;\n\n // Token name\n string private _name;\n\n // Token symbol\n string private _symbol;\n\n // Mapping from token ID to owner address\n mapping(uint256 => address) private _owners;\n\n // Mapping owner address to token count\n mapping(address => uint256) private _balances;\n\n // Mapping from token ID to approved address\n mapping(uint256 => address) private _tokenApprovals;\n\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => bool)) private _operatorApprovals;\n\n /**\n * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.\n */\n function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC721_init_unchained(name_, symbol_);\n }\n\n function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {\n return\n interfaceId == type(IERC721Upgradeable).interfaceId ||\n interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||\n super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721-balanceOf}.\n */\n function balanceOf(address owner) public view virtual override returns (uint256) {\n require(owner != address(0), \"ERC721: address zero is not a valid owner\");\n return _balances[owner];\n }\n\n /**\n * @dev See {IERC721-ownerOf}.\n */\n function ownerOf(uint256 tokenId) public view virtual override returns (address) {\n address owner = _ownerOf(tokenId);\n require(owner != address(0), \"ERC721: invalid token ID\");\n return owner;\n }\n\n /**\n * @dev See {IERC721Metadata-name}.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev See {IERC721Metadata-symbol}.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev See {IERC721Metadata-tokenURI}.\n */\n function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {\n _requireMinted(tokenId);\n\n string memory baseURI = _baseURI();\n return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : \"\";\n }\n\n /**\n * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each\n * token will be the concatenation of the `baseURI` and the `tokenId`. Empty\n * by default, can be overridden in child contracts.\n */\n function _baseURI() internal view virtual returns (string memory) {\n return \"\";\n }\n\n /**\n * @dev See {IERC721-approve}.\n */\n function approve(address to, uint256 tokenId) public virtual override {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n require(to != owner, \"ERC721: approval to current owner\");\n\n require(\n _msgSender() == owner || isApprovedForAll(owner, _msgSender()),\n \"ERC721: approve caller is not token owner or approved for all\"\n );\n\n _approve(to, tokenId);\n }\n\n /**\n * @dev See {IERC721-getApproved}.\n */\n function getApproved(uint256 tokenId) public view virtual override returns (address) {\n _requireMinted(tokenId);\n\n return _tokenApprovals[tokenId];\n }\n\n /**\n * @dev See {IERC721-setApprovalForAll}.\n */\n function setApprovalForAll(address operator, bool approved) public virtual override {\n _setApprovalForAll(_msgSender(), operator, approved);\n }\n\n /**\n * @dev See {IERC721-isApprovedForAll}.\n */\n function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {\n return _operatorApprovals[owner][operator];\n }\n\n /**\n * @dev See {IERC721-transferFrom}.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n //solhint-disable-next-line max-line-length\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n\n _transfer(from, to, tokenId);\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) public virtual override {\n safeTransferFrom(from, to, tokenId, \"\");\n }\n\n /**\n * @dev See {IERC721-safeTransferFrom}.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) public virtual override {\n require(_isApprovedOrOwner(_msgSender(), tokenId), \"ERC721: caller is not token owner or approved\");\n _safeTransfer(from, to, tokenId, data);\n }\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * `data` is additional data, it has no specified format and it is sent in call to `to`.\n *\n * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.\n * implement alternative mechanisms to perform token transfer, such as signature-based.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeTransfer(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _transfer(from, to, tokenId);\n require(_checkOnERC721Received(from, to, tokenId, data), \"ERC721: transfer to non ERC721Receiver implementer\");\n }\n\n /**\n * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist\n */\n function _ownerOf(uint256 tokenId) internal view virtual returns (address) {\n return _owners[tokenId];\n }\n\n /**\n * @dev Returns whether `tokenId` exists.\n *\n * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.\n *\n * Tokens start existing when they are minted (`_mint`),\n * and stop existing when they are burned (`_burn`).\n */\n function _exists(uint256 tokenId) internal view virtual returns (bool) {\n return _ownerOf(tokenId) != address(0);\n }\n\n /**\n * @dev Returns whether `spender` is allowed to manage `tokenId`.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);\n }\n\n /**\n * @dev Safely mints `tokenId` and transfers it to `to`.\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function _safeMint(address to, uint256 tokenId) internal virtual {\n _safeMint(to, tokenId, \"\");\n }\n\n /**\n * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is\n * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.\n */\n function _safeMint(\n address to,\n uint256 tokenId,\n bytes memory data\n ) internal virtual {\n _mint(to, tokenId);\n require(\n _checkOnERC721Received(address(0), to, tokenId, data),\n \"ERC721: transfer to non ERC721Receiver implementer\"\n );\n }\n\n /**\n * @dev Mints `tokenId` and transfers it to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible\n *\n * Requirements:\n *\n * - `tokenId` must not exist.\n * - `to` cannot be the zero address.\n *\n * Emits a {Transfer} event.\n */\n function _mint(address to, uint256 tokenId) internal virtual {\n require(to != address(0), \"ERC721: mint to the zero address\");\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n _beforeTokenTransfer(address(0), to, tokenId, 1);\n\n // Check that tokenId was not minted by `_beforeTokenTransfer` hook\n require(!_exists(tokenId), \"ERC721: token already minted\");\n\n unchecked {\n // Will not overflow unless all 2**256 token ids are minted to the same owner.\n // Given that tokens are minted one by one, it is impossible in practice that\n // this ever happens. Might change if we allow batch minting.\n // The ERC fails to describe this case.\n _balances[to] += 1;\n }\n\n _owners[tokenId] = to;\n\n emit Transfer(address(0), to, tokenId);\n\n _afterTokenTransfer(address(0), to, tokenId, 1);\n }\n\n /**\n * @dev Destroys `tokenId`.\n * The approval is cleared when the token is burned.\n * This is an internal function that does not check if the sender is authorized to operate on the token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n *\n * Emits a {Transfer} event.\n */\n function _burn(uint256 tokenId) internal virtual {\n address owner = ERC721Upgradeable.ownerOf(tokenId);\n\n _beforeTokenTransfer(owner, address(0), tokenId, 1);\n\n // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook\n owner = ERC721Upgradeable.ownerOf(tokenId);\n\n // Clear approvals\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // Cannot overflow, as that would require more tokens to be burned/transferred\n // out than the owner initially received through minting and transferring in.\n _balances[owner] -= 1;\n }\n delete _owners[tokenId];\n\n emit Transfer(owner, address(0), tokenId);\n\n _afterTokenTransfer(owner, address(0), tokenId, 1);\n }\n\n /**\n * @dev Transfers `tokenId` from `from` to `to`.\n * As opposed to {transferFrom}, this imposes no restrictions on msg.sender.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n *\n * Emits a {Transfer} event.\n */\n function _transfer(\n address from,\n address to,\n uint256 tokenId\n ) internal virtual {\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n require(to != address(0), \"ERC721: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, tokenId, 1);\n\n // Check that tokenId was not transferred by `_beforeTokenTransfer` hook\n require(ERC721Upgradeable.ownerOf(tokenId) == from, \"ERC721: transfer from incorrect owner\");\n\n // Clear approvals from the previous owner\n delete _tokenApprovals[tokenId];\n\n unchecked {\n // `_balances[from]` cannot overflow for the same reason as described in `_burn`:\n // `from`'s balance is the number of token held, which is at least one before the current\n // transfer.\n // `_balances[to]` could overflow in the conditions described in `_mint`. That would require\n // all 2**256 token ids to be minted, which in practice is impossible.\n _balances[from] -= 1;\n _balances[to] += 1;\n }\n _owners[tokenId] = to;\n\n emit Transfer(from, to, tokenId);\n\n _afterTokenTransfer(from, to, tokenId, 1);\n }\n\n /**\n * @dev Approve `to` to operate on `tokenId`\n *\n * Emits an {Approval} event.\n */\n function _approve(address to, uint256 tokenId) internal virtual {\n _tokenApprovals[tokenId] = to;\n emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);\n }\n\n /**\n * @dev Approve `operator` to operate on all of `owner` tokens\n *\n * Emits an {ApprovalForAll} event.\n */\n function _setApprovalForAll(\n address owner,\n address operator,\n bool approved\n ) internal virtual {\n require(owner != operator, \"ERC721: approve to caller\");\n _operatorApprovals[owner][operator] = approved;\n emit ApprovalForAll(owner, operator, approved);\n }\n\n /**\n * @dev Reverts if the `tokenId` has not been minted yet.\n */\n function _requireMinted(uint256 tokenId) internal view virtual {\n require(_exists(tokenId), \"ERC721: invalid token ID\");\n }\n\n /**\n * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.\n * The call is not executed if the target address is not a contract.\n *\n * @param from address representing the previous owner of the given token ID\n * @param to target address that will receive the tokens\n * @param tokenId uint256 ID of the token to be transferred\n * @param data bytes optional data to send along with the call\n * @return bool whether the call correctly returned the expected magic value\n */\n function _checkOnERC721Received(\n address from,\n address to,\n uint256 tokenId,\n bytes memory data\n ) private returns (bool) {\n if (to.isContract()) {\n try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {\n return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;\n } catch (bytes memory reason) {\n if (reason.length == 0) {\n revert(\"ERC721: transfer to non ERC721Receiver implementer\");\n } else {\n /// @solidity memory-safe-assembly\n assembly {\n revert(add(32, reason), mload(reason))\n }\n }\n }\n } else {\n return true;\n }\n }\n\n /**\n * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.\n * - When `from` is zero, the tokens will be minted for `to`.\n * - When `to` is zero, ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is\n * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.\n *\n * Calling conditions:\n *\n * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.\n * - When `from` is zero, the tokens were minted for `to`.\n * - When `to` is zero, ``from``'s tokens were burned.\n * - `from` and `to` are never both zero.\n * - `batchSize` is non-zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual {}\n\n /**\n * @dev Unsafe write access to the balances, used by extensions that \"mint\" tokens using an {ownerOf} override.\n *\n * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant\n * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such\n * that `ownerOf(tokenId)` is `a`.\n */\n // solhint-disable-next-line func-name-mixedcase\n function __unsafe_increaseBalance(address account, uint256 amount) internal {\n _balances[account] += amount;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[44] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC721Upgradeable.sol\";\nimport \"./IERC721EnumerableUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev This implements an optional extension of {ERC721} defined in the EIP that adds\n * enumerability of all the token ids in the contract as well as all token ids owned by each\n * account.\n */\nabstract contract ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable {\n function __ERC721Enumerable_init() internal onlyInitializing {\n }\n\n function __ERC721Enumerable_init_unchained() internal onlyInitializing {\n }\n // Mapping from owner to list of owned token IDs\n mapping(address => mapping(uint256 => uint256)) private _ownedTokens;\n\n // Mapping from token ID to index of the owner tokens list\n mapping(uint256 => uint256) private _ownedTokensIndex;\n\n // Array with all token ids, used for enumeration\n uint256[] private _allTokens;\n\n // Mapping from token id to position in the allTokens array\n mapping(uint256 => uint256) private _allTokensIndex;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC721Upgradeable) returns (bool) {\n return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721Upgradeable.balanceOf(owner), \"ERC721Enumerable: owner index out of bounds\");\n return _ownedTokens[owner][index];\n }\n\n /**\n * @dev See {IERC721Enumerable-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _allTokens.length;\n }\n\n /**\n * @dev See {IERC721Enumerable-tokenByIndex}.\n */\n function tokenByIndex(uint256 index) public view virtual override returns (uint256) {\n require(index < ERC721EnumerableUpgradeable.totalSupply(), \"ERC721Enumerable: global index out of bounds\");\n return _allTokens[index];\n }\n\n /**\n * @dev See {ERC721-_beforeTokenTransfer}.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 firstTokenId,\n uint256 batchSize\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, firstTokenId, batchSize);\n\n if (batchSize > 1) {\n // Will only trigger during construction. Batch transferring (minting) is not available afterwards.\n revert(\"ERC721Enumerable: consecutive transfers not supported\");\n }\n\n uint256 tokenId = firstTokenId;\n\n if (from == address(0)) {\n _addTokenToAllTokensEnumeration(tokenId);\n } else if (from != to) {\n _removeTokenFromOwnerEnumeration(from, tokenId);\n }\n if (to == address(0)) {\n _removeTokenFromAllTokensEnumeration(tokenId);\n } else if (to != from) {\n _addTokenToOwnerEnumeration(to, tokenId);\n }\n }\n\n /**\n * @dev Private function to add a token to this extension's ownership-tracking data structures.\n * @param to address representing the new owner of the given token ID\n * @param tokenId uint256 ID of the token to be added to the tokens list of the given address\n */\n function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {\n uint256 length = ERC721Upgradeable.balanceOf(to);\n _ownedTokens[to][length] = tokenId;\n _ownedTokensIndex[tokenId] = length;\n }\n\n /**\n * @dev Private function to add a token to this extension's token tracking data structures.\n * @param tokenId uint256 ID of the token to be added to the tokens list\n */\n function _addTokenToAllTokensEnumeration(uint256 tokenId) private {\n _allTokensIndex[tokenId] = _allTokens.length;\n _allTokens.push(tokenId);\n }\n\n /**\n * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that\n * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for\n * gas optimizations e.g. when performing a transfer operation (avoiding double writes).\n * This has O(1) time complexity, but alters the order of the _ownedTokens array.\n * @param from address representing the previous owner of the given token ID\n * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address\n */\n function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {\n // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = ERC721Upgradeable.balanceOf(from) - 1;\n uint256 tokenIndex = _ownedTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary\n if (tokenIndex != lastTokenIndex) {\n uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];\n\n _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n }\n\n // This also deletes the contents at the last position of the array\n delete _ownedTokensIndex[tokenId];\n delete _ownedTokens[from][lastTokenIndex];\n }\n\n /**\n * @dev Private function to remove a token from this extension's token tracking data structures.\n * This has O(1) time complexity, but alters the order of the _allTokens array.\n * @param tokenId uint256 ID of the token to be removed from the tokens list\n */\n function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {\n // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and\n // then delete the last slot (swap and pop).\n\n uint256 lastTokenIndex = _allTokens.length - 1;\n uint256 tokenIndex = _allTokensIndex[tokenId];\n\n // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so\n // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding\n // an 'if' statement (like in _removeTokenFromOwnerEnumeration)\n uint256 lastTokenId = _allTokens[lastTokenIndex];\n\n _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token\n _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index\n\n // This also deletes the contents at the last position of the array\n delete _allTokensIndex[tokenId];\n _allTokens.pop();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[46] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721EnumerableUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721EnumerableUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the total amount of tokens stored by the contract.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns a token ID owned by `owner` at a given `index` of its token list.\n * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.\n */\n function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);\n\n /**\n * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.\n * Use along with {totalSupply} to enumerate all tokens.\n */\n function tokenByIndex(uint256 index) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC721Upgradeable.sol\";\n\n/**\n * @title ERC-721 Non-Fungible Token Standard, optional metadata extension\n * @dev See https://eips.ethereum.org/EIPS/eip-721\n */\ninterface IERC721MetadataUpgradeable is IERC721Upgradeable {\n /**\n * @dev Returns the token collection name.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the token collection symbol.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.\n */\n function tokenURI(uint256 tokenId) external view returns (string memory);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title ERC721 token receiver interface\n * @dev Interface for any contract that wants to support safeTransfers\n * from ERC721 asset contracts.\n */\ninterface IERC721ReceiverUpgradeable {\n /**\n * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}\n * by `operator` from `from`, this function is called.\n *\n * It must return its Solidity selector to confirm the token transfer.\n * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.\n *\n * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.\n */\n function onERC721Received(\n address operator,\n address from,\n uint256 tokenId,\n bytes calldata data\n ) external returns (bytes4);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165Upgradeable.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721Upgradeable is IERC165Upgradeable {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721\n * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must\n * understand this adds an external call which potentially creates a reentrancy vulnerability.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 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 (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 functionCallWithValue(target, data, 0, \"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(\n address target,\n bytes memory data,\n string memory errorMessage\n ) 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(\n address target,\n bytes memory data,\n uint256 value\n ) 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(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResultFromTarget(target, 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(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n *\n * _Available since v4.8._\n */\n function verifyCallResultFromTarget(\n address target,\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n if (success) {\n if (returndata.length == 0) {\n // only check isContract if the call was successful and the return data is empty\n // otherwise we already know that it was a contract\n require(isContract(target), \"Address: call to non-contract\");\n }\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n /**\n * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason or using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n _revert(returndata, errorMessage);\n }\n }\n\n function _revert(bytes memory returndata, string memory errorMessage) private pure {\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 /// @solidity memory-safe-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" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV // Deprecated in v4.8\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/SignatureChecker.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../AddressUpgradeable.sol\";\nimport \"../../interfaces/IERC1271Upgradeable.sol\";\n\n/**\n * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA\n * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like\n * Argent and Gnosis Safe.\n *\n * _Available since v4.1._\n */\nlibrary SignatureCheckerUpgradeable {\n /**\n * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the\n * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.\n *\n * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus\n * change through time. It could return true at block N and false at block N+1 (or the opposite).\n */\n function isValidSignatureNow(\n address signer,\n bytes32 hash,\n bytes memory signature\n ) internal view returns (bool) {\n (address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hash, signature);\n if (error == ECDSAUpgradeable.RecoverError.NoError && recovered == signer) {\n return true;\n }\n\n (bool success, bytes memory result) = signer.staticcall(\n abi.encodeWithSelector(IERC1271Upgradeable.isValidSignature.selector, hash, signature)\n );\n return (success &&\n result.length == 32 &&\n abi.decode(result, (bytes32)) == bytes32(IERC1271Upgradeable.isValidSignature.selector));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n function __ERC165_init() internal onlyInitializing {\n }\n\n function __ERC165_init_unchained() internal onlyInitializing {\n }\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165Upgradeable).interfaceId;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/MathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary MathUpgradeable {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns the average of two numbers. The result is rounded towards\n * zero.\n */\n function average(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b) / 2 can overflow.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n //\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.\n //\n // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`\n // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`\n // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`\n //\n // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1 << (log2(a) >> 1);\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = sqrt(a);\n return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 2, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 128;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 64;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 32;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 16;\n }\n if (value >> 8 > 0) {\n value >>= 8;\n result += 8;\n }\n if (value >> 4 > 0) {\n value >>= 4;\n result += 4;\n }\n if (value >> 2 > 0) {\n value >>= 2;\n result += 2;\n }\n if (value >> 1 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 2, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log2(value);\n return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 10, rounded down, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >= 10**64) {\n value /= 10**64;\n result += 64;\n }\n if (value >= 10**32) {\n value /= 10**32;\n result += 32;\n }\n if (value >= 10**16) {\n value /= 10**16;\n result += 16;\n }\n if (value >= 10**8) {\n value /= 10**8;\n result += 8;\n }\n if (value >= 10**4) {\n value /= 10**4;\n result += 4;\n }\n if (value >= 10**2) {\n value /= 10**2;\n result += 2;\n }\n if (value >= 10**1) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log10(value);\n return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);\n }\n }\n\n /**\n * @dev Return the log in base 256, rounded down, of a positive value.\n * Returns 0 if given 0.\n *\n * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.\n */\n function log256(uint256 value) internal pure returns (uint256) {\n uint256 result = 0;\n unchecked {\n if (value >> 128 > 0) {\n value >>= 128;\n result += 16;\n }\n if (value >> 64 > 0) {\n value >>= 64;\n result += 8;\n }\n if (value >> 32 > 0) {\n value >>= 32;\n result += 4;\n }\n if (value >> 16 > 0) {\n value >>= 16;\n result += 2;\n }\n if (value >> 8 > 0) {\n result += 1;\n }\n }\n return result;\n }\n\n /**\n * @dev Return the log in base 10, following the selected rounding direction, of a positive value.\n * Returns 0 if given 0.\n */\n function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {\n unchecked {\n uint256 result = log256(value);\n return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)\n\npragma solidity ^0.8.0;\n\n// CAUTION\n// This version of SafeMath should only be used with Solidity 0.8 or later,\n// because it relies on the compiler's built in overflow checks.\n\n/**\n * @dev Wrappers over Solidity's arithmetic operations.\n *\n * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler\n * now has built in overflow checking.\n */\nlibrary SafeMathUpgradeable {\n /**\n * @dev Returns the addition of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n uint256 c = a + b;\n if (c < a) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b > a) return (false, 0);\n return (true, a - b);\n }\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, with an overflow flag.\n *\n * _Available since v3.4._\n */\n function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\n // benefit is lost if 'b' is also tested.\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\n if (a == 0) return (true, 0);\n uint256 c = a * b;\n if (c / a != b) return (false, 0);\n return (true, c);\n }\n }\n\n /**\n * @dev Returns the division of two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a / b);\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.\n *\n * _Available since v3.4._\n */\n function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {\n unchecked {\n if (b == 0) return (false, 0);\n return (true, a % b);\n }\n }\n\n /**\n * @dev Returns the addition of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `+` operator.\n *\n * Requirements:\n *\n * - Addition cannot overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n return a + b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting on\n * overflow (when the result is negative).\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n return a - b;\n }\n\n /**\n * @dev Returns the multiplication of two unsigned integers, reverting on\n * overflow.\n *\n * Counterpart to Solidity's `*` operator.\n *\n * Requirements:\n *\n * - Multiplication cannot overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n return a * b;\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator.\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n return a / b;\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting when dividing by zero.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\n return a % b;\n }\n\n /**\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\n * overflow (when the result is negative).\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {trySub}.\n *\n * Counterpart to Solidity's `-` operator.\n *\n * Requirements:\n *\n * - Subtraction cannot overflow.\n */\n function sub(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b <= a, errorMessage);\n return a - b;\n }\n }\n\n /**\n * @dev Returns the integer division of two unsigned integers, reverting with custom message on\n * division by zero. The result is rounded towards zero.\n *\n * Counterpart to Solidity's `/` operator. Note: this function uses a\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\n * uses an invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function div(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a / b;\n }\n }\n\n /**\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\n * reverting with custom message when dividing by zero.\n *\n * CAUTION: This function is deprecated because it requires allocating memory for the error\n * message unnecessarily. For custom revert reasons use {tryMod}.\n *\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\n * opcode (which leaves remaining gas untouched) while Solidity uses an\n * invalid opcode to revert (consuming all remaining gas).\n *\n * Requirements:\n *\n * - The divisor cannot be zero.\n */\n function mod(\n uint256 a,\n uint256 b,\n string memory errorMessage\n ) internal pure returns (uint256) {\n unchecked {\n require(b > 0, errorMessage);\n return a % b;\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./math/MathUpgradeable.sol\";\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n unchecked {\n uint256 length = MathUpgradeable.log10(value) + 1;\n string memory buffer = new string(length);\n uint256 ptr;\n /// @solidity memory-safe-assembly\n assembly {\n ptr := add(buffer, add(32, length))\n }\n while (true) {\n ptr--;\n /// @solidity memory-safe-assembly\n assembly {\n mstore8(ptr, byte(mod(value, 10), _SYMBOLS))\n }\n value /= 10;\n if (value == 0) break;\n }\n return buffer;\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n unchecked {\n return toHexString(value, MathUpgradeable.log256(value) + 1);\n }\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/DealsRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\";\nimport \"./interfaces/IEntitiesRegistry.sol\";\nimport \"./interfaces/IConfig.sol\";\nimport \"./libraries/Utils.sol\";\nimport \"./libraries/SignatureUtils.sol\";\nimport \"./utils/IERC20.sol\";\n\n/**\n * @title DealsRegistry\n * @dev A smart contract for creating and managing deals between buyers and sellers.\n * The contract stores offers made by suppliers, and allows buyers to create deals based on those offers.\n * Each deal specifies the payment and cancellation terms, and can be tracked on-chain using its unique Id.\n */\nabstract contract DealsRegistry is\n EIP712Upgradeable,\n PausableUpgradeable,\n OwnableUpgradeable\n{\n using SignatureCheckerUpgradeable for address;\n using SignatureUtils for bytes;\n using SafeMathUpgradeable for uint256;\n\n /// @dev The protocol config contract address\n address public config;\n\n /// @dev Entities registry contract address\n address public entities;\n\n /// @dev Mapping of context to allowed statuses list\n mapping(bytes32 => Utils.DealStatus[]) private allowedStatuses;\n\n /// @dev Mapping of an offer Id on a Deal\n mapping(bytes32 => Utils.Deal) public deals;\n\n /// @dev Emitted when a Deal status is updated\n event Status(bytes32 offerId, Utils.DealStatus status, address sender);\n\n /// @dev Emitted when updated an address of the protocol config contract\n event SetConfig(address oldAddress, address newAddress);\n\n /// @dev Emitted when updated an address of the Entities registry contract\n event SetEntities(address oldAddress, address newAddress);\n\n /// @dev Thrown when a user attempts to create a deal using an offer with an invalid signature\n error InvalidOfferSignature();\n\n /// @dev Thrown when a user attempts to create an already existing Deal\n error DealExists();\n\n /// @dev Thrown when Deal was created in the `_beforeCreate` hook\n error DealAlreadyCreated();\n\n /// @dev Thrown when the Deal is not found\n error DealNotFound();\n\n /// @dev Thrown when a user attempts to create a deal providing an invalid payment options\n error InvalidPaymentOptions();\n\n /// @dev Thrown when a user attempts to create a deal providing an invalid payment option Id\n error InvalidPaymentId();\n\n /// @dev Thrown when a Deal funds transfer is failed\n error DealFundsTransferFailed();\n\n /// @dev Thrown when the retailer of the offer is not found\n error InvalidRetailer();\n\n /// @dev Thrown when the supplier of the offer is not enabled\n error DisabledSupplier();\n\n /// @dev Thrown when the retailer is not enabled\n error DisabledRetailer();\n\n /// @dev Thrown when a function call is not allowed for current user\n error NotAllowedAuth();\n\n /// @dev Thrown when a user attempts to claim the deal in non-created status\n error NotAllowedStatus();\n\n /// @dev Thrown when a user attempts to do something that not allowed at a moment\n error NotAllowedTime();\n\n /// @dev Thrown when a user attempts to cancel the deal using invalid cancellation options\n error InvalidCancelOptions();\n\n /**\n * @dev DealsRegistry initializer\n * @param _name The name of the contract\n * @param _version The version of the contract\n * @param _config The protocol config contract address\n * @param _entities Entities registry contract address\n */\n function __DealsRegistry_init(\n string memory _name,\n string memory _version,\n address _config,\n address _entities\n ) internal onlyInitializing {\n __EIP712_init(_name, _version);\n __Pausable_init();\n\n // Save the protocol config contract address\n config = _config;\n\n // Save entities registry address\n entities = _entities;\n\n // Allowed statuses for functions execution\n allowedStatuses[\"reject\"] = [Utils.DealStatus.Created];\n allowedStatuses[\"cancel\"] = [\n Utils.DealStatus.Created,\n Utils.DealStatus.Claimed\n ];\n allowedStatuses[\"refund\"] = [\n Utils.DealStatus.Claimed,\n Utils.DealStatus.CheckedIn\n ];\n allowedStatuses[\"claim\"] = [Utils.DealStatus.Created];\n allowedStatuses[\"checkIn\"] = [Utils.DealStatus.Claimed];\n allowedStatuses[\"checkOut\"] = [Utils.DealStatus.CheckedIn];\n allowedStatuses[\"dispute\"] = [\n Utils.DealStatus.CheckedIn,\n Utils.DealStatus.CheckedOut\n ];\n }\n\n /// Modifiers\n\n /**\n * @dev Modifier to make a function callable only when deal is exists\n *\n * Requirements:\n *\n * - the deal of the `offerId` must exists\n */\n modifier dealExists(bytes32 offerId) {\n if (deals[offerId].offer.id == bytes32(0)) {\n revert DealNotFound();\n }\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when deal in specific statuses.\n *\n * Requirements:\n *\n * - the deal of the `offerId` must exists\n * - the deal is in `statuses`\n */\n modifier inStatuses(bytes32 offerId, Utils.DealStatus[] memory statuses) {\n uint256 allowed;\n Utils.DealStatus currentStatus = deals[offerId].status;\n\n for (uint256 i = 0; i < statuses.length; i++) {\n if (currentStatus == statuses[i]) {\n allowed = 1;\n break;\n }\n }\n\n if (allowed != 1) {\n revert NotAllowedStatus();\n }\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only by supplier's signer.\n *\n * Requirements:\n *\n * - the function called by the supplier's signer\n */\n modifier onlySigner(bytes32 offerId) {\n if (\n _msgSender() !=\n IEntitiesRegistry(entities)\n .getEntity(deals[offerId].offer.supplierId)\n .signer\n ) {\n revert NotAllowedAuth();\n }\n _;\n }\n\n /// Utilities\n\n /**\n * @dev Sets the new address of the protocol config contract address\n * @param _config The new protocol config contract address\n */\n function setConfig(address _config) external onlyOwner {\n emit SetConfig(config, _config);\n config = _config;\n }\n\n /**\n * @dev Sets the new address of the entities registry\n * @param _entities The new protocol config contract address\n */\n function setEntities(address _entities) external onlyOwner {\n emit SetEntities(entities, _entities);\n entities = _entities;\n }\n\n /// Workflow hooks\n\n /**\n * @dev Hook function that runs before a new deal is created.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offer The offer used to create the deal\n * @param price The price of the asset in wei\n * @param asset The address of the ERC20 token used for payment\n * @param signs An array of signatures authorizing the creation of the deal\n */\n function _beforeCreate(\n Utils.Offer memory offer,\n uint256 price,\n address asset,\n bytes[] memory signs\n ) internal virtual whenNotPaused {}\n\n /**\n * @dev Hook function that runs after a new deal is created.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offer The offer used to create the deal\n * @param price The price of the asset in wei\n * @param asset The address of the ERC20 token used for payment\n * @param signs An array of signatures authorizing the creation of the deal\n */\n function _afterCreate(\n Utils.Offer memory offer,\n uint256 price,\n address asset,\n bytes[] memory signs\n ) internal virtual {}\n\n /**\n * @dev Hook function that runs before the deal is rejected by a supplier.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n * @param reason Rejection reason\n */\n function _beforeReject(\n bytes32 offerId,\n bytes32 reason\n ) internal virtual whenNotPaused {}\n\n /**\n * @dev Hook function that runs after the deal is rejected by s supplier.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n * @param reason Rejection reason\n */\n function _afterReject(bytes32 offerId, bytes32 reason) internal virtual {}\n\n /**\n * @dev Hook function that runs before the deal is canceled.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n */\n function _beforeCancel(bytes32 offerId) internal virtual whenNotPaused {}\n\n /**\n * @dev Hook function that runs after the deal is canceled.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n */\n function _afterCancel(bytes32 offerId) internal virtual {}\n\n /**\n * @dev Hook function that runs before the deal is refunded.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n */\n function _beforeRefund(bytes32 offerId) internal virtual whenNotPaused {}\n\n /**\n * @dev Hook function that runs after the deal is refunded.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n */\n function _afterRefund(bytes32 offerId) internal virtual {}\n\n /**\n * @dev Hook function that runs before the deal is claimed.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n * @param buyer Address of the deal buyer\n */\n function _beforeClaim(\n bytes32 offerId,\n address buyer\n ) internal virtual whenNotPaused {}\n\n /**\n * @dev Hook function that runs after the deal is claimed.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n * @param buyer Address of the deal buyer\n */\n function _afterClaim(bytes32 offerId, address buyer) internal virtual {}\n\n /**\n * @dev Hook function that runs before the deal is checked in.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n * @param signs An array of signatures authorizing the check in of the deal\n */\n function _beforeCheckIn(\n bytes32 offerId,\n bytes[] memory signs\n ) internal virtual whenNotPaused {}\n\n /**\n * @dev Hook function that runs after the deal is checked in.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n * @param signs An array of signatures authorizing the check in of the deal\n */\n function _afterCheckIn(\n bytes32 offerId,\n bytes[] memory signs\n ) internal virtual {}\n\n /**\n * @dev Hook function that runs before the deal is checked out.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n */\n function _beforeCheckOut(bytes32 offerId) internal virtual whenNotPaused {}\n\n /**\n * @dev Hook function that runs after the deal is checked out.\n * Allows inheriting smart contracts to perform custom logic.\n * @param offerId The offerId of the deal\n */\n function _afterCheckOut(bytes32 offerId) internal virtual {}\n\n /// Features\n\n /**\n * @dev Creates a Deal on a base of an offer\n * @param offer An offer payload\n * @param paymentOptions Raw offered payment options array\n * @param paymentId Payment option Id\n * @param retailerId Retailer Id\n * @param signs Signatures: [0] - offer: ECDSA/ERC1271; [1] - asset permit: ECDSA (optional)\n *\n * Requirements:\n *\n * - supplier of the offer must be registered\n * - offer must be signed with a proper signer\n * - the deal should not be created before\n * - the deal should not be created inside the _before hook\n * - payment options must be valid (equal to those from the offer)\n * - payment Id must exists in payment options\n * - the contract must be able to make transfer of funds\n *\n * NOTE: `permit` signature can be ECDSA of type only\n */\n function deal(\n Utils.Offer memory offer,\n Utils.PaymentOption[] memory paymentOptions,\n bytes32 paymentId,\n bytes32 retailerId,\n bytes[] memory signs\n ) external {\n address buyer = _msgSender();\n\n /// @dev variable scoping used to avoid stack too deep errors\n /// The `supplier` storage variable is required is the frame of this scope only\n {\n bytes32 offerHash = _hashTypedDataV4(Utils.hash(offer));\n IEntitiesRegistry.Entity memory supplier = IEntitiesRegistry(entities)\n .getEntity(offer.supplierId);\n\n // Checking ECDSA/AA signature is valid\n if (!supplier.signer.isValidSignatureNow(offerHash, signs[0])) {\n revert InvalidOfferSignature();\n }\n\n // Not-enabled suppliers are not allowed to accept deals\n // So, we cannot allow to create such a deal\n if (!IEntitiesRegistry(entities).isEntityEnabled(offer.supplierId)) {\n revert DisabledSupplier();\n }\n\n // The retailer is optional, so we validate its rules only if retailerId is defined\n if (retailerId != bytes32(0)) {\n IEntitiesRegistry.Entity memory retailer = IEntitiesRegistry(entities)\n .getEntity(retailerId);\n\n // Retailer must be registered\n if (retailer.owner == address(0)) {\n revert InvalidRetailer();\n }\n\n // Not-enabled retailer are not allowed\n if (!IEntitiesRegistry(entities).isEntityEnabled(retailerId)) {\n revert DisabledRetailer();\n }\n }\n\n // Deal can be created only once\n if (deals[offer.id].offer.id == offer.id) {\n revert DealExists();\n }\n\n bytes32 paymentHash = Utils.hash(paymentOptions);\n\n // payment options provided with argument must be the same\n // as signed in the offer\n if (paymentHash != offer.paymentHash) {\n revert InvalidPaymentOptions();\n }\n }\n\n uint256 price;\n address asset;\n\n for (uint256 i = 0; i < paymentOptions.length; i++) {\n // Payment id must be one of the defined in payment options\n if (paymentOptions[i].id == paymentId) {\n price = paymentOptions[i].price;\n asset = paymentOptions[i].asset;\n break;\n }\n }\n\n if (asset == address(0)) {\n revert InvalidPaymentId();\n }\n\n _beforeCreate(offer, price, asset, signs);\n\n // Check that the deal was not created by `_beforeCreate` hook\n if (deals[offer.id].offer.id == offer.id) {\n revert DealAlreadyCreated();\n }\n\n // Creating the deal before any external call to avoid reentrancy\n deals[offer.id] = Utils.Deal(\n block.timestamp,\n offer,\n retailerId,\n buyer,\n price,\n asset,\n Utils.DealStatus.Created\n );\n\n if (signs.length > 1) {\n // Use permit function to transfer tokens from the sender to the contract\n (uint8 v, bytes32 r, bytes32 s) = signs[1].split();\n IERC20(asset).permit(buyer, address(this), price, offer.expire, v, r, s);\n }\n\n // Use transferFrom function to transfer tokens from the sender to the contract\n if (!IERC20(asset).transferFrom(buyer, address(this), price)) {\n revert DealFundsTransferFailed();\n }\n\n emit Status(offer.id, Utils.DealStatus.Created, buyer);\n\n _afterCreate(offer, price, asset, signs);\n }\n\n /**\n * @dev Rejects the deal\n * @param offerId The deal offer Id\n * @param reason Rejection reason\n *\n * Requirements:\n *\n * - the deal must exists\n * - the deal must be in status DealStatus.Created\n * - must be called by the signer address of the deal offer supplier\n */\n function reject(\n bytes32 offerId,\n bytes32 reason\n )\n external\n dealExists(offerId)\n onlySigner(offerId)\n inStatuses(offerId, allowedStatuses[\"reject\"])\n {\n Utils.Deal storage storedDeal = deals[offerId];\n\n // Moving to the Rejected status before all to avoid reentrancy\n storedDeal.status = Utils.DealStatus.Rejected;\n\n _beforeReject(offerId, reason);\n\n if (\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\n ) {\n revert DealFundsTransferFailed();\n }\n\n emit Status(offerId, Utils.DealStatus.Rejected, _msgSender());\n\n _afterReject(offerId, reason);\n }\n\n /**\n * @dev Refunds the deal\n * @param offerId The deal offer Id\n *\n * Requirements:\n *\n * - the deal must exists\n * - the deal must be in status DealStatus.CheckedIn\n * - must be called by the signer address of the deal offer supplier\n */\n function refund(\n bytes32 offerId\n )\n external\n dealExists(offerId)\n onlySigner(offerId)\n inStatuses(offerId, allowedStatuses[\"refund\"])\n {\n Utils.Deal storage storedDeal = deals[offerId];\n\n // Moving to the Refunded status before all to avoid reentrancy\n storedDeal.status = Utils.DealStatus.Refunded;\n\n _beforeRefund(offerId);\n\n if (\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\n ) {\n revert DealFundsTransferFailed();\n }\n\n emit Status(offerId, Utils.DealStatus.Refunded, _msgSender());\n\n _afterRefund(offerId);\n }\n\n /**\n * @dev Cancels the deal\n * @param offerId The deal offer Id\n * @param _cancelOptions Cancellation options from offer\n *\n * Requirements:\n *\n * - the deal must exists\n * - the deal must be in status DealStatus.Created or DealStatus.Claimed\n * - must be called by buyer\n * - if the deal in DealStatus.Claimed status:\n * - if block.timestamp > checkIn time then zero refund\n * - cancellation rules must follow the rules defined by offer\n */\n function cancel(\n bytes32 offerId,\n Utils.CancelOption[] memory _cancelOptions\n )\n external\n dealExists(offerId)\n inStatuses(offerId, allowedStatuses[\"cancel\"])\n {\n address sender = _msgSender();\n Utils.Deal storage storedDeal = deals[offerId];\n\n if (sender != storedDeal.buyer) {\n revert NotAllowedAuth();\n }\n\n // Buyer is not able to cancel the deal during `claim_period`\n // This time is given to the supplier to claim the deal\n if (\n block.timestamp <\n storedDeal.created.add(IConfig(config).getNumber(\"claim_period\"))\n ) {\n revert NotAllowedTime();\n }\n\n Utils.DealStatus callStatus = storedDeal.status;\n\n // Moving to the Cancelled status before all to avoid reentrancy\n storedDeal.status = Utils.DealStatus.Cancelled;\n\n _beforeCancel(offerId);\n\n if (callStatus == Utils.DealStatus.Created) {\n // Full refund\n if (\n !IERC20(storedDeal.asset).transfer(storedDeal.buyer, storedDeal.price)\n ) {\n revert DealFundsTransferFailed();\n }\n } else if (\n callStatus == Utils.DealStatus.Claimed &&\n block.timestamp < storedDeal.offer.checkIn\n ) {\n if (storedDeal.offer.cancelHash != Utils.hash(_cancelOptions)) {\n revert InvalidCancelOptions();\n }\n\n // Using offer cancellation rules\n uint256 selectedTime;\n uint256 selectedPenalty;\n\n for (uint256 i = 0; i < _cancelOptions.length; i++) {\n if (\n block.timestamp >= _cancelOptions[i].time &&\n (selectedTime == 0 || _cancelOptions[i].time < selectedTime)\n ) {\n selectedTime = _cancelOptions[i].time;\n selectedPenalty = _cancelOptions[i].penalty;\n }\n }\n\n if (selectedPenalty > 100) {\n selectedPenalty = 100;\n }\n\n uint256 penaltyValue = Utils._percentage(\n storedDeal.price,\n selectedPenalty\n );\n\n if (\n !IERC20(storedDeal.asset).transfer(\n storedDeal.buyer,\n storedDeal.price.sub(penaltyValue)\n )\n ) {\n revert DealFundsTransferFailed();\n }\n\n if (\n penaltyValue > 0 &&\n !IERC20(storedDeal.asset).transfer(\n IEntitiesRegistry(entities)\n .getEntity(storedDeal.offer.supplierId)\n .owner,\n penaltyValue\n )\n ) {\n revert DealFundsTransferFailed();\n }\n } else {\n revert NotAllowedStatus();\n }\n\n emit Status(offerId, Utils.DealStatus.Cancelled, sender);\n\n _afterCancel(offerId);\n }\n\n /**\n * @dev Claims the deal\n * @param offerId The deal offer Id\n *\n * Requirements:\n *\n * - the deal must exists\n * - the deal must be in status DealStatus.Created\n * - must be called by the signer address of the deal offer supplier\n */\n function claim(\n bytes32 offerId\n )\n external\n dealExists(offerId)\n onlySigner(offerId)\n inStatuses(offerId, allowedStatuses[\"claim\"])\n {\n Utils.Deal storage storedDeal = deals[offerId];\n\n _beforeClaim(offerId, storedDeal.buyer);\n\n storedDeal.status = Utils.DealStatus.Claimed;\n emit Status(offerId, Utils.DealStatus.Claimed, _msgSender());\n\n _afterClaim(offerId, storedDeal.buyer);\n }\n\n /**\n * @dev Checks in the deal\n * @param offerId The deal offer Id\n * @param signs Signatures\n *\n * Requirements:\n *\n * - the deal must exists\n * - the deal must be in status DealStatus.Claimed\n * - must be called by the supplier's signer or buyer's address\n * - if called by the supplier's signer:\n * - a valid signature of suppliers's signer must be provided in signs[0]\n * - if before sign-in time: a valid signature of the buyer must be provided in signs[1]\n * - if called buy buyer:\n * - a valid signature of the buyer must be provided in signs[0]\n * - a valid signature of suppliers's signer must be provided in signs[1]\n */\n function checkIn(\n bytes32 offerId,\n bytes[] memory signs\n )\n external\n dealExists(offerId)\n inStatuses(offerId, allowedStatuses[\"checkIn\"])\n {\n Utils.Deal storage storedDeal = deals[offerId];\n IEntitiesRegistry.Entity memory supplier = IEntitiesRegistry(entities)\n .getEntity(storedDeal.offer.supplierId);\n\n address sender = _msgSender();\n bytes32 signInHash;\n\n if (sender == supplier.signer) {\n // The function is called by the supplier's signer\n signInHash = _hashTypedDataV4(\n Utils.hashCheckInOut(storedDeal.offer.id, supplier.signer)\n );\n\n // Checking ECDSA/AA signature of the suppliers's signer is valid\n if (!supplier.signer.isValidSignatureNow(signInHash, signs[0])) {\n revert InvalidOfferSignature();\n }\n\n // Before checkIn time of the offer a signature of the buyer is required\n if (block.timestamp < storedDeal.offer.checkIn) {\n signInHash = _hashTypedDataV4(\n Utils.hashCheckInOut(storedDeal.offer.id, storedDeal.buyer)\n );\n\n // Checking ECDSA/AA signature of the buyer is valid\n if (!storedDeal.buyer.isValidSignatureNow(signInHash, signs[1])) {\n revert InvalidOfferSignature();\n }\n }\n } else if (sender == storedDeal.buyer) {\n signInHash = _hashTypedDataV4(\n Utils.hashCheckInOut(storedDeal.offer.id, storedDeal.buyer)\n );\n\n // Checking ECDSA/AA signature of the suppliers's signer is valid\n if (!storedDeal.buyer.isValidSignatureNow(signInHash, signs[0])) {\n revert InvalidOfferSignature();\n }\n\n signInHash = _hashTypedDataV4(\n Utils.hashCheckInOut(storedDeal.offer.id, supplier.signer)\n );\n\n // Checking ECDSA/AA signature of the buyer is valid\n if (!supplier.signer.isValidSignatureNow(signInHash, signs[1])) {\n revert InvalidOfferSignature();\n }\n } else {\n revert NotAllowedAuth();\n }\n\n // Execute before checkIn hook\n _beforeCheckIn(offerId, signs);\n\n storedDeal.status = Utils.DealStatus.CheckedIn;\n emit Status(offerId, Utils.DealStatus.CheckedIn, sender);\n\n // Execute after checkIn hook\n _afterCheckIn(offerId, signs);\n }\n\n /**\n * @dev Checks out the deal and sends funds to the supplier\n * @param offerId The deal offer Id\n *\n * Requirements:\n *\n * - the deal must exists\n * - must be called by the supplier's signer only\n * - the deal must be in status DealStatus.CheckIn\n * - must be called after checkOut time only\n */\n function checkOut(\n bytes32 offerId\n )\n external\n dealExists(offerId)\n onlySigner(offerId)\n inStatuses(offerId, allowedStatuses[\"checkOut\"])\n {\n Utils.Deal storage storedDeal = deals[offerId];\n\n if (block.timestamp < storedDeal.offer.checkOut) {\n revert NotAllowedTime();\n }\n\n // Moving to CheckedOut status before all to avoid reentrancy\n storedDeal.status = Utils.DealStatus.CheckedOut;\n\n // Execute before checkOut hook\n _beforeCheckOut(offerId);\n\n uint256 protocolFee;\n uint256 retailerFee;\n uint256 supplierValue;\n\n protocolFee = Utils._percentage(\n storedDeal.price,\n IConfig(config).getNumber(\"protocol_fee\")\n );\n\n if (storedDeal.retailerId != bytes32(0)) {\n retailerFee = Utils._percentage(\n storedDeal.price,\n IConfig(config).getNumber(\"retailer_fee\")\n );\n }\n\n supplierValue = storedDeal.price.sub(protocolFee).sub(retailerFee);\n\n if (\n protocolFee > 0 &&\n // Sends fee to the protocol recipient\n !IERC20(storedDeal.asset).transfer(\n IConfig(config).getAddress(\"fee_recipient\"),\n protocolFee\n )\n ) {\n revert DealFundsTransferFailed();\n }\n\n if (\n retailerFee > 0 &&\n // Send fee to the deal retailer\n !IERC20(storedDeal.asset).transfer(\n IEntitiesRegistry(entities).getEntity(storedDeal.retailerId).owner,\n retailerFee\n )\n ) {\n revert DealFundsTransferFailed();\n }\n\n if (\n // Sends value to the supplier\n !IERC20(storedDeal.asset).transfer(\n IEntitiesRegistry(entities)\n .getEntity(storedDeal.offer.supplierId)\n .owner,\n supplierValue\n )\n ) {\n revert DealFundsTransferFailed();\n }\n\n emit Status(offerId, Utils.DealStatus.CheckedOut, _msgSender());\n\n // Execute after checkOut hook\n _afterCheckOut(offerId);\n }\n\n uint256[50] private __gap;\n}\n" + }, + "contracts/ERC721Token.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol\";\n\n/**\n * @title ERC721Token\n * @dev Abstract contract that defines an ERC721 token\n * with additional functionality for enumeration and pausing\n */\nabstract contract ERC721Token is\n ERC721Upgradeable,\n ERC721EnumerableUpgradeable,\n PausableUpgradeable,\n OwnableUpgradeable\n{\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n /// @dev Internal counter to keep track of tokenIds\n CountersUpgradeable.Counter private _tokenIdCounter;\n\n /**\n * @dev Initializer that sets the name and symbol of the token\n * @param name The name of the token\n * @param symbol The symbol of the token\n */\n function __ERC721Token_init(\n string memory name,\n string memory symbol\n ) internal onlyInitializing {\n __ERC721_init(name, symbol);\n __ERC721Enumerable_init();\n __Pausable_init();\n }\n\n /**\n * @dev Internal function to safely mint an NFT to an address with custom URI\n * @param to The address that will receive the minted NFT\n */\n function safeMint(address to) internal returns (uint256) {\n uint256 tokenId = _tokenIdCounter.current();\n _tokenIdCounter.increment();\n _safeMint(to, tokenId);\n return tokenId;\n }\n\n /**\n * @dev Internal function to safely burn an NFT\n * @param tokenId The ID of the NFT to be burnt\n */\n function safeBurn(uint256 tokenId) internal {\n require(\n _isApprovedOrOwner(_msgSender(), tokenId),\n \"ERC721: caller is not token owner or approved\"\n );\n _burn(tokenId);\n }\n\n /// @inheritdoc ERC721Upgradeable\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId,\n uint256 batchSize\n )\n internal\n virtual\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\n whenNotPaused\n {\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\n }\n\n /// @inheritdoc ERC721Upgradeable\n function supportsInterface(\n bytes4 interfaceId\n )\n public\n view\n override(ERC721Upgradeable, ERC721EnumerableUpgradeable)\n returns (bool)\n {\n return super.supportsInterface(interfaceId);\n }\n}\n" + }, + "contracts/interfaces/IConfig.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @title Configurable contract interface\n * @dev Interface for a contract that allows for dynamic configuration of uint256 and address values.\n */\ninterface IConfig {\n /**\n * @dev Returns a number by name\n * @param _name A number name\n * @return The value of the number\n */\n function getNumber(bytes32 _name) external view returns (uint256);\n\n /**\n * @dev Returns an address by name\n * @param _name An address name\n * @return The address value\n */\n function getAddress(bytes32 _name) external view returns (address);\n\n /**\n * @dev Returns a list of registered config variables names\n * @return Array of registered variables names\n */\n function variables() external view returns (bytes32[] memory);\n\n /**\n * @dev Returns a minDeposit value of the entity\n * @param _name An entity name\n * @return The value of the number\n */\n function getMinDeposit(bytes32 _name) external view returns (uint256);\n\n /**\n * @dev Changes variable uint256 of value\n * @param name Name of variable\n * @param value Value of variable\n */\n function config(bytes32 name, uint256 value) external;\n\n /**\n * @dev Changes variable address of value\n * @param name Name of variable\n * @param value Value of variable\n */\n function config(bytes32 name, address value) external;\n\n /**\n * @dev Sets minimum deposits values\n * @param _kinds Supported entity types\n * @param _minDeposits Minimum value of deposit\n */\n function setMinDeposits(\n bytes32[] memory _kinds,\n uint256[] memory _minDeposits\n ) external;\n}\n" + }, + "contracts/interfaces/IEntitiesRegistry.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/**\n * @title IEntitiesRegistry\n * @dev A smart contract interface for registering and managing entities who can participate in the protocol.\n */\ninterface IEntitiesRegistry {\n /**\n * @dev Entity storage struct\n * @param id Unique entity Id\n * @param owner Owner of the entity entity\n * @param enabled The entity entity activity flag\n * @param signer Offers signer\n */\n struct Entity {\n bytes32 kind;\n bytes32 id;\n address owner;\n bool enabled;\n address signer;\n }\n\n /**\n * @dev Returns entity by Id\n * @param _id The entity Id\n */\n function getEntity(bytes32 _id) external view returns (Entity memory);\n\n /**\n * @dev Returns the value of the entity's deposit\n * @param _id The entity Id\n */\n function balanceOfEntity(bytes32 _id) external view returns (uint256);\n\n /**\n * @dev Returns the value of `enabled` entity status\n * @param _id The entity Id\n */\n function isEntityEnabled(bytes32 _id) external view returns (bool);\n\n /**\n * @dev Sets the new address of the protocol config contract address\n */\n function setConfig(address _config) external;\n\n /**\n * @dev Registers a new entity\n * @param _kind Type of entity\n * @param _salt Unique bytes32 string that allows off-chain calculation of the entity Id\n * @param _signer Account address that authorized by the entity owner to sign offers\n *\n * If registering of the entity is succeeded:\n * - the function emits `EntityRegistered(bytes32 id, bytes32 id)` event\n *\n * Requirements:\n *\n * - `salt` can be used only once. If a `salt` has been used and the entity is registered\n * the next attempt will results in the error `EntityExists()`\n * - an entity type provided with `_kind` must be registered\n *\n * NOTE: When the entity is registered its initial `enabled` status is set to `false`.\n * This means that to start accepting deals the entity must be enabled\n */\n function register(bytes32 _kind, bytes32 _salt, address _signer) external;\n\n /**\n * @dev Changes signer account of the entity\n * @param _id The entity Id\n * @param _signer Account authorized by the entity to sign offers\n *\n * If changing of the signer is succeeded:\n * - the function emits `SignerChanged(bytes32 id, address sender, address oldSigner, address new Signer)` event\n *\n * Requirements:\n *\n * - can be called by the entity owner only\n */\n function changeSigner(bytes32 _id, address _signer) external;\n\n /**\n * @dev Toggles an enabled status of the entity\n * @param _id The entity Id\n *\n * This function inverts a value of the `enabled` parameter of the entity\n *\n * If toggling is succeeded:\n * - the function emits `ToggleEnabled(bytes32 id, address sender, bool enabled)` event\n *\n * Requirements:\n *\n * - can be called by the entity owner only\n */\n function toggleEntity(bytes32 _id) external;\n\n /**\n * @dev See {EntitiesRegistry._addDeposit}.\n */\n function addDeposit(bytes32 _id, uint256 _value) external;\n\n /**\n * @dev Makes deposit of `asset` tokens with permit\n * @param _id The entity Id\n * @param _value Amount of `asset` tokens that must be deposited\n * @param _deadline Deadline time of permit\n * @param _sign Permit signature (EIP712)\n *\n * If `_sign` argument is provided the function will use the `permit` function\n * to transfer tokens from the sender to the contract, overwise the usual\n * `transferFrom` will be used.\n *\n * If the tokens transfer is succeeded:\n * - the function emits `Deposit(bytes32 id, address sender, uint256 value)` event\n *\n * Requirements:\n *\n * - can be called by the entity owner only\n */\n function addDeposit(\n bytes32 _id,\n uint256 _value,\n uint256 _deadline,\n bytes memory _sign\n ) external;\n\n /**\n * @dev Makes deposit withdrawal of the entity\n * @param _id The entity Id\n * @param _value Amount of `asset` tokens that must be withdrawn\n *\n * If the tokens withdrawal is succeeded:\n * - the function emits `Withdraw(bytes32 id, address sender, uint256 value)` event\n *\n * Requirements:\n *\n * - can be called by the entity owner only\n */\n function withdrawDeposit(bytes32 _id, uint256 _value) external;\n}\n" + }, + "contracts/libraries/SignatureUtils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nlibrary SignatureUtils {\n error InvalidSignature();\n\n /// @dev Splits signature into v/r/s form\n function split(\n bytes memory signature\n ) internal pure returns (uint8 v, bytes32 r, bytes32 s) {\n if (signature.length == 65) {\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n\n if eq(v, 0) {\n v := 27\n }\n\n if eq(v, 1) {\n v := 28\n }\n }\n } else {\n revert InvalidSignature();\n }\n }\n}\n" + }, + "contracts/libraries/Utils.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport \"@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol\";\n\nlibrary Utils {\n using SafeMathUpgradeable for uint256;\n\n /// Constants\n\n bytes32 public constant PAYMENT_OPTION_TYPE_HASH =\n keccak256(\"PaymentOption(bytes32 id,uint256 price,address asset)\");\n\n bytes32 public constant CANCEL_OPTION_TYPE_HASH =\n keccak256(\"CancelOption(uint256 time,uint256 penalty)\");\n\n bytes32 public constant OFFER_TYPE_HASH =\n keccak256(\n // solhint-disable-next-line max-line-length\n \"Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn,uint256 checkOut)\"\n );\n\n bytes32 public constant CHECK_IN_TYPE_HASH =\n keccak256(\"Voucher(bytes32 id,address signer)\");\n\n /// Errors\n\n /// @dev Thrown when percents value greater than 100\n error InvalidPercent();\n\n /// Data structures\n\n /**\n * @dev Payment option\n * @param id Unique ID of the payment option\n * @param price The price of the asset in wei\n * @param asset The address of the ERC20 token used for payment\n */\n struct PaymentOption {\n bytes32 id;\n uint256 price;\n address asset;\n }\n\n /**\n * @dev Deal cancellation option\n * @param time The number of seconds before checkIn\n * @param penalty The percentage of the total sum to be paid as a penalty if the deal is cancelled\n */\n struct CancelOption {\n uint256 time;\n uint256 penalty;\n }\n\n /**\n * @dev Offer payload\n * @param id The unique ID of the offer\n * @param expire The time when the offer expires (in seconds since the Unix epoch)\n * @param supplierId The unique ID of the supplier offering the deal\n * @param chainId The ID of the network chain where the deal is to be executed\n * @param requestHash The hash of the request made by the buyer\n * @param optionsHash The hash of the payment and cancellation options for the deal\n * @param paymentHash The hash of the payment option used for the deal\n * @param cancelHash The hash of the cancellation option used for the deal\n * @param transferable Indicates whether the deal NFT is transferable or not\n * @param checkIn The check-in time for the deal (in seconds since the Unix epoch)\n * @param checkOut The check-out time for the deal (in seconds since the Unix epoch)\n */\n struct Offer {\n bytes32 id;\n uint256 expire;\n bytes32 supplierId;\n uint256 chainId;\n bytes32 requestHash;\n bytes32 optionsHash;\n bytes32 paymentHash;\n bytes32 cancelHash;\n bool transferable;\n uint256 checkIn;\n uint256 checkOut;\n }\n\n /**\n * @dev Deal status\n */\n enum DealStatus {\n Created, // Just created\n Claimed, // Claimed by the supplier\n Rejected, // Rejected by the supplier\n Refunded, // Refunded by the supplier\n Cancelled, // Cancelled by the buyer\n CheckedIn, // Checked In\n CheckedOut, // Checked Out\n Disputed // Dispute started\n }\n\n /**\n * @dev Deal storage struct\n * @param offer Offer payload\n * @param price Deal price\n * @param asset Deal asset\n * @param status Current deal status\n */\n struct Deal {\n uint256 created;\n Offer offer;\n bytes32 retailerId;\n address buyer;\n uint256 price;\n address asset;\n DealStatus status;\n }\n\n /// @dev Create a has of bytes32 array\n function hash(bytes32[] memory _hashes) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(_hashes));\n }\n\n /// @dev Creates a hash of a PaymentOption\n function hash(\n PaymentOption memory _paymentOptions\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(\n PAYMENT_OPTION_TYPE_HASH,\n _paymentOptions.id,\n _paymentOptions.price,\n _paymentOptions.asset\n )\n );\n }\n\n /// @dev Creates a hash of a CancelOption\n function hash(CancelOption memory _cancel) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encodePacked(CANCEL_OPTION_TYPE_HASH, _cancel.time, _cancel.penalty)\n );\n }\n\n /// @dev Creates a hash of an array of PaymentOption\n function hash(\n PaymentOption[] memory _paymentOptions\n ) internal pure returns (bytes32) {\n bytes32[] memory hashes = new bytes32[](_paymentOptions.length);\n\n for (uint256 i = 0; i < _paymentOptions.length; i++) {\n hashes[i] = hash(_paymentOptions[i]);\n }\n\n return hash(hashes);\n }\n\n /// @dev Creates a hash of an array of CancelOption\n function hash(\n CancelOption[] memory _cancelOptions\n ) internal pure returns (bytes32) {\n bytes32[] memory hashes = new bytes32[](_cancelOptions.length);\n\n for (uint256 i = 0; i < _cancelOptions.length; i++) {\n hashes[i] = hash(_cancelOptions[i]);\n }\n\n return hash(hashes);\n }\n\n /// @dev Creates a hash of an Offer\n function hash(Offer memory _offer) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n OFFER_TYPE_HASH,\n _offer.id,\n _offer.expire,\n _offer.supplierId,\n _offer.chainId,\n _offer.requestHash,\n _offer.optionsHash,\n _offer.paymentHash,\n _offer.cancelHash,\n _offer.transferable,\n _offer.checkIn,\n _offer.checkOut\n )\n );\n }\n\n /// @dev Create a hash of check-in data\n function hashCheckInOut(\n bytes32 _id,\n address _signer\n ) internal pure returns (bytes32) {\n return keccak256(abi.encode(CHECK_IN_TYPE_HASH, _id, _signer));\n }\n\n /// @dev Calculates percentage value\n function _percentage(\n uint256 value,\n uint256 percent\n ) internal pure returns (uint256) {\n if (percent > 100) {\n revert InvalidPercent();\n }\n return value.mul(1000).mul(percent).div(100).div(1000);\n }\n}\n" + }, + "contracts/Market.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\nimport \"./ERC721Token.sol\";\nimport \"./DealsRegistry.sol\";\nimport \"./libraries/Utils.sol\";\n\n/**\n * @title Market\n * @dev This contract enables the creation and management of deals\n * @custom:security-contact security@windingtree.com\n */\ncontract Market is ERC721Token, DealsRegistry {\n /// @dev Mapping of token Id on offer Id\n mapping(uint256 => bytes32) public tokenOffers;\n\n /// @dev Mapping of offer Id on token Id\n mapping(bytes32 => uint256) public offerTokens;\n\n /// Throws when NFT transfer is not allowed by offer rule\n error TokenTransferNotAllowed();\n\n /**\n * @dev Constructor of ERC721Token\n */\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the Market contract with the given arguments\n * @param _owner The owner of the contract\n * @param _name The name of the contract\n * @param _version The version of the contract\n * @param _config The protocol config contract address\n * @param _entities Entities registry contract address\n */\n function initialize(\n address _owner,\n string memory _name,\n string memory _version,\n address _config,\n address _entities\n ) external initializer {\n _transferOwnership(_owner);\n\n // Initialize ERC721 token\n __ERC721Token_init(\"DealToken\", \"DEAL\");\n\n // Initialize Deals registry\n __DealsRegistry_init(_name, _version, _config, _entities);\n }\n\n /// Getters\n\n /**\n * @dev Returns offerId linked to the token\n * @param tokenId The ID of the token\n * @return offerId The ID of the offer linked to the token\n */\n function resolveTokenId(\n uint256 tokenId\n ) external view returns (bytes32 offerId) {\n _requireMinted(tokenId);\n offerId = tokenOffers[tokenId];\n }\n\n /// Pausable features\n\n /**\n * @dev Pauses the contract\n */\n function pause() public onlyOwner {\n _pause();\n }\n\n /**\n * @dev Unpauses the contract\n */\n function unpause() public onlyOwner {\n _unpause();\n }\n\n /// Features\n\n /**\n * @dev Executes logic before a deal is created\n * @param offer The details of the offer\n * @param price The price of the offer\n * @param asset The address of the asset\n * @param signs The signatures of the offer\n */\n function _beforeCreate(\n Utils.Offer memory offer,\n uint256 price,\n address asset,\n bytes[] memory signs\n ) internal override(DealsRegistry) whenNotPaused {\n super._beforeCreate(offer, price, asset, signs);\n }\n\n /**\n * @dev Executes logic after a deal is created\n * @param offer The details of the offer\n * @param price The price of the offer\n * @param asset The address of the asset\n * @param signs The signatures of the offer\n */\n function _afterCreate(\n Utils.Offer memory offer,\n uint256 price,\n address asset,\n bytes[] memory signs\n ) internal override(DealsRegistry) {\n // After-deal logic\n super._afterCreate(offer, price, asset, signs);\n }\n\n /**\n * @dev Executes logic after a deal is claimed\n * @param offerId The ID of the offer\n * @param buyer The address of the buyer\n */\n function _afterClaim(\n bytes32 offerId,\n address buyer\n ) internal override(DealsRegistry) {\n // Minting of a token\n uint256 tokenId = safeMint(buyer);\n // Create a map of token Id on offer Id\n tokenOffers[tokenId] = offerId;\n // Create a map of offer Id on token Id\n offerTokens[offerId] = tokenId;\n super._afterClaim(offerId, buyer);\n }\n\n /**\n * @dev Executes logic after a deal is canceled\n * @param offerId The ID of the offer\n */\n function _afterCancel(bytes32 offerId) internal override(DealsRegistry) {\n uint256 tokenId = offerTokens[offerId];\n\n // If token has been minted we must burn it\n if (tokenId != 0) {\n safeBurn(tokenId);\n delete tokenOffers[tokenId];\n delete offerTokens[offerId];\n }\n\n super._beforeCancel(offerId);\n }\n\n /// ERC721 features\n\n /**\n * @dev Returns the token URI of the given token ID\n * @param tokenId The ID of the token\n * @return The token URI of the given token ID\n */\n function tokenURI(\n uint256 tokenId\n ) public view override(ERC721Upgradeable) returns (string memory) {\n _requireMinted(tokenId);\n // TODO: Generate data-uri that depends on the id\n return \"\";\n }\n\n /**\n * @dev Executes before a token transfer\n * @param from The address to transfer the token from\n * @param to The address to transfer the token to\n * @param tokenId The ID of the token being transferred\n * @param batchSize The size of the batch being transferred\n *\n * NOTE: Initially minted token is transferred to his owner without any restrictions\n * All other transfers are managed according the following requirements:\n *\n * - token must be linked to an offerId\n * - token can be transferred or not according to the configuration of offer\n * - token can not be transferred when the deal status is `Claimed` only\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 tokenId,\n uint256 batchSize\n ) internal override(ERC721Token) whenNotPaused {\n // Execute the logic when the function called not from `_mint` or `_burn`\n if (from != address(0) && to != address(0)) {\n bytes32 offerId = tokenOffers[tokenId];\n\n if (offerId == bytes32(0)) {\n revert DealNotFound();\n }\n\n Utils.Deal storage offerDeal = deals[offerId];\n\n // Prevent transfer of token when this is not allowed by the offer\n // or the deal is in the non-transferrable status\n if (\n !offerDeal.offer.transferable ||\n offerDeal.status != Utils.DealStatus.Claimed\n ) {\n revert TokenTransferNotAllowed();\n }\n\n // Change the deal buyer to the new token owner\n offerDeal.buyer = to;\n }\n\n super._beforeTokenTransfer(from, to, tokenId, batchSize);\n }\n\n uint256[50] private __gap;\n}\n" + }, + "contracts/utils/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.19;\n\n/// @dev Simple ERC20 token interface\ninterface IERC20 {\n function decimals() external view returns (uint256);\n\n function transfer(address, uint256) external returns (bool);\n\n function transferFrom(address, address, uint256) external returns (bool);\n\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "storageLayout", + "devdoc", + "userdoc", + "evm.gasEstimates" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/package.json b/package.json index b68e3c5..71006ac 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,8 @@ "@typechain/hardhat": "^6.1.6", "@typechain/ethers-v5": "^10.2.1", "@typechain/ethers-v6": "^0.3.2", - "dotenv": "^16.0.3" + "dotenv": "^16.0.3", + "viem": "^0.3.37" }, "dependencies": { "@openzeppelin/contracts-upgradeable": "^4.8.3" diff --git a/package/src/constants.ts b/package/src/constants.ts index 8af539a..827ce88 100644 --- a/package/src/constants.ts +++ b/package/src/constants.ts @@ -6,30 +6,30 @@ export const kinds = { retailer: '0x72657461696c6572000000000000000000000000000000000000000000000000', }; -// ethers.solidityPackedKeccak256( +// viem.encodePacked( // ['string'], // ['PaymentOption(bytes32 id,uint256 price,address asset)'], // ); export const PAYMENT_OPTION_TYPE_HASH = '0x2f8fc0b3ad3f58f6deb367673d38e4112a3c8c64de033c5b780b84ef8f67cde6'; -// ethers.solidityPackedKeccak256( +// viem.encodePacked( // ['string'], // ['CancelOption(uint256 time,uint256 penalty)'], // ); export const CANCEL_OPTION_TYPE_HASH = '0x8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5'; -// ethers.solidityPackedKeccak256( +// viem.encodePacked( // ['string'], // [ // 'Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn)', // ], // ); export const OFFER_TYPE_HASH = - '0xcf2addd2f89a78825d3f130a17e47b4e9963adfd09837fa9c454569faa073354'; + '0x4fb12343a6f44152999c71291770d97fc1eace9d7d04889330d5a6d1af4a57c7'; -// ethers.solidityPackedKeccak256( +// viem.encodePacked( // ['string'], // [ // 'Voucher(bytes32 id,address signer)', diff --git a/package/src/hash.ts b/package/src/hash.ts new file mode 100644 index 0000000..6832625 --- /dev/null +++ b/package/src/hash.ts @@ -0,0 +1,210 @@ +import { Hash, Address, keccak256, toHex, stringify, encodePacked } from 'viem'; +import { + CANCEL_OPTION_TYPE_HASH, + OFFER_TYPE_HASH, + PAYMENT_OPTION_TYPE_HASH, +} from './constants.js'; + +/** Offered payment option type */ +export interface PaymentOption { + /** Unique payment option Id */ + id: Hash; + /** Asset price in WEI */ + price: bigint; + /** ERC20 asset contract address */ + asset: Address; +} + +/** Offered cancellation option type */ +export interface CancelOption { + /** Seconds before checkIn */ + time: bigint; + /** Percents of total sum */ + penalty: bigint; +} + +/** Unsigned offer payload type */ +export interface UnsignedOfferPayload extends Record { + /** Unique Offer Id */ + id: Hash; + /** Expiration time */ + expire: bigint; + /** Unique supplier Id registered on the protocol contract */ + supplierId: Hash; + /** Target network chain Id */ + chainId: bigint; + /** */ + requestHash: Hash; + /** */ + optionsHash: Hash; + /** */ + paymentHash: Hash; + /** */ + cancelHash: Hash; + /** Makes the deal NFT transferable or not */ + transferable: boolean; + /** Check-in time in seconds */ + checkIn: bigint; + /** Check-out time in seconds */ + checkOut: bigint; +} + +/** + * Converts an object that contains bigint values to a JSON string representation. + * + * @param {unknown} data The data to stringify. + * @returns {string} The JSON string representation of the data. + */ +export { stringify }; + +/** + * Generates simple unique Id + * + * @param {number} [length=14] Default is `14` + * @returns {string} + */ +export const simpleUid = (length = 14): string => { + if (length < 5 || length > 14) { + throw new Error('Length value must be between 5 and 14'); + } + return Math.random() + .toString(16) + .replace('.', '') + .split('') + .sort(() => (Math.random() > 0.5 ? 1 : -1)) + .join('') + .slice(0, length); +}; + +/** + * Generates random salt (bytes32 string) + * + * @returns {Hash} + */ +export const randomSalt = (): Hash => keccak256(toHex(simpleUid())); + +/** + * Computes the keccak256 hash of an object. + * + * @param {unknown} data The data object to hash. + * @returns {Hash} The keccak256 hash of the data. + */ +export const hashObject = (data: unknown): Hash => { + return keccak256(toHex(stringify(data))); +}; + +/** + * Computes the keccak256 hash of a PaymentOption object. + * + * @param {PaymentOption} option The PaymentOption object to hash. + * @returns {Hash} The keccak256 hash of the PaymentOption. + */ +export const hashPaymentOption = (option: PaymentOption): Hash => { + return keccak256( + encodePacked( + ['bytes32', 'bytes32', 'uint256', 'address'], + [PAYMENT_OPTION_TYPE_HASH, option.id, option.price, option.asset], + ), + ); +}; + +/** + * Computes the keccak256 hash of a CancelOption object. + * + * @param {CancelOption} option The CancelOption object to hash. + * @returns {Hash} The keccak256 hash of the CancelOption. + */ +export const hashCancelOption = (option: CancelOption): Hash => { + return keccak256( + encodePacked( + ['bytes32', 'uint256', 'uint256'], + [CANCEL_OPTION_TYPE_HASH, option.time, option.penalty], + ), + ); +}; + +/** + * Computes the keccak256 hash of an array of PaymentOption objects. + * + * @param {PaymentOption[]} options The array of PaymentOption objects to hash. + * @returns {Hash} The keccak256 hash of the PaymentOption array. + */ +export const hashPaymentOptionArray = (options: PaymentOption[]): Hash => { + const hashes: Hash[] = []; + + for (let i = 0; i < options.length; i++) { + hashes[i] = hashPaymentOption(options[i]); + } + + return keccak256(encodePacked(['bytes32[]'], [hashes])); +}; + +/** + * Computes the keccak256 hash of an array of CancelOption objects. + * + * @param {CancelOption[]} options The array of CancelOption objects to hash. + * @returns {Hash} The keccak256 hash of the CancelOption array. + */ +export const hashCancelOptionArray = (options: CancelOption[]): Hash => { + const hashes: Hash[] = []; + + for (let i = 0; i < options.length; i++) { + hashes[i] = hashCancelOption(options[i]); + } + + return keccak256(encodePacked(['bytes32[]'], [hashes])); +}; + +/** + * Computes the keccak256 hash of an UnsignedOfferPayload object. + * + * @param {UnsignedOfferPayload} payload The UnsignedOfferPayload object to hash. + * @returns {Hash} The keccak256 hash of the UnsignedOfferPayload. + */ +export const hashOfferPayload = (payload: UnsignedOfferPayload): Hash => { + return keccak256( + encodePacked( + [ + 'bytes32', + 'bytes32', + 'uint256', + 'bytes32', + 'uint256', + 'bytes32', + 'bytes32', + 'bytes32', + 'bytes32', + 'bool', + 'uint256', + 'uint256', + ], + [ + OFFER_TYPE_HASH, + payload.id, + payload.expire, + payload.supplierId, + payload.chainId, + payload.requestHash, + payload.optionsHash, + payload.paymentHash, + payload.cancelHash, + payload.transferable, + payload.checkIn, + payload.checkOut, + ], + ), + ); +}; + +/** + * Computes the keccak256 hash of a CheckInOut voucher. + * + * @param {string} offerId The ID of the offer. + * @param {string} signer The signer's address. + * @returns {Hash} The keccak256 hash of the CheckInOut operation. + */ +export const hashCheckInOut = (offerId: Hash, signer: Address): Hash => { + return keccak256( + encodePacked(['bytes32', 'bytes32', 'address'], [OFFER_TYPE_HASH, offerId, signer]), + ); +}; diff --git a/package/src/index.ts b/package/src/index.ts index 21551a1..b2bc5e6 100644 --- a/package/src/index.ts +++ b/package/src/index.ts @@ -16,3 +16,4 @@ export { }; export * from './constants.js'; export * from '../wagmi/index.js'; +export * from './hash.js'; diff --git a/package/wagmi/index.ts b/package/wagmi/index.ts index 02c452d..3ff6212 100644 --- a/package/wagmi/index.ts +++ b/package/wagmi/index.ts @@ -1,4 +1,4 @@ -// Generated by @wagmi/cli@1.0.0 on 5/24/2023 at 1:42:27 PM +// Generated by @wagmi/cli@1.0.0 on 5/29/2023 at 6:26:14 PM ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Config diff --git a/test/EntitiesRegistry.test.ts b/test/EntitiesRegistry.test.ts index 3ae9696..13b8088 100644 --- a/test/EntitiesRegistry.test.ts +++ b/test/EntitiesRegistry.test.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; import { BigNumber, constants } from "ethers"; -import { minDeposit, kinds } from "../utils/constants"; +import { minDeposit, kinds } from "../utils"; import { randomId, createSupplierId, createPermitSignature } from "./utils"; import { User, setup, registerEntity } from "./setup"; diff --git a/test/Market.test.ts b/test/Market.test.ts index 85831e8..3d73b50 100644 --- a/test/Market.test.ts +++ b/test/Market.test.ts @@ -2,7 +2,7 @@ import { expect } from "chai"; import { BigNumber, constants } from "ethers"; import { ethers } from "hardhat"; import { TransferEventObject } from "../typechain/contracts/Market"; -import { kinds } from "../utils/constants"; +import { kinds } from "../utils"; import { Offer } from "../utils/types"; import { structEqual, diff --git a/test/setup.ts b/test/setup.ts index 5131424..ba46816 100644 --- a/test/setup.ts +++ b/test/setup.ts @@ -8,7 +8,7 @@ import { } from "../typechain"; import { ethers, deployments, getNamedAccounts } from "hardhat"; import { BigNumber, Contract, VoidSigner } from "ethers"; -import { protocolFee, retailerFee, minDeposit } from "../utils/constants"; +import { protocolFee, retailerFee, minDeposit } from "../utils"; import { structEqual, createSupplierId } from "./utils"; export interface Contracts { diff --git a/test/utils.ts b/test/utils.ts index 7eae275..67cd60d 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -27,7 +27,7 @@ export const CANCEL_OPTION_TYPE_HASH = "0x8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5"; export const OFFER_TYPE_HASH = - "0xcf2addd2f89a78825d3f130a17e47b4e9963adfd09837fa9c454569faa073354"; + "0x4fb12343a6f44152999c71291770d97fc1eace9d7d04889330d5a6d1af4a57c7"; export const randomId = (): string => utils.solidityKeccak256( @@ -158,6 +158,10 @@ export const offerEip712Types: Record> = { name: "checkIn", type: "uint256", }, + { + name: "checkOut", + type: "uint256", + }, ], }; diff --git a/tsconfig.json b/tsconfig.json index 66ebf8b..a046a4c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,6 +26,6 @@ "./hardhat.config.ts", "./deploy/**/*.ts", "./tasks/**/*.ts", - "./utils/**/*.ts" - ] + "temp/utils/**/*.ts" +, "package/src/hash.ts", "temp/Hash.test.ts", "utils/index.ts", "utils/network.ts", "utils/types.ts" ] } diff --git a/utils/constants.ts b/utils/constants.ts deleted file mode 100644 index c8796e4..0000000 --- a/utils/constants.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { utils, BigNumber } from "ethers"; - -// Protocol entities types (kinds) as object -export const kinds = { - supplier: utils.formatBytes32String("supplier"), - retailer: utils.formatBytes32String("retailer"), -}; - -// Protocol entities types (kinds) as values array -export const kindsArr = Object.values(kinds); - -// Protocol defaults -export const eip712name = "Market"; -export const eip712version = "1"; -export const minDeposit = BigNumber.from("1000000000000000000000"); -export const claimPeriod = BigNumber.from("60"); -export const protocolFee = BigNumber.from("1"); -export const retailerFee = BigNumber.from("1"); - -// ethers.solidityPackedKeccak256( -// ['string'], -// ['PaymentOption(bytes32 id,uint256 price,address asset)'], -// ); -export const PAYMENT_OPTION_TYPE_HASH = - "0x2f8fc0b3ad3f58f6deb367673d38e4112a3c8c64de033c5b780b84ef8f67cde6"; - -// ethers.solidityPackedKeccak256( -// ['string'], -// ['CancelOption(uint256 time,uint256 penalty)'], -// ); -export const CANCEL_OPTION_TYPE_HASH = - "0x8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5"; - -// ethers.solidityPackedKeccak256( -// ['string'], -// [ -// 'Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn)', -// ], -// ); -export const OFFER_TYPE_HASH = - "0xcf2addd2f89a78825d3f130a17e47b4e9963adfd09837fa9c454569faa073354"; - -// ethers.solidityPackedKeccak256( -// ['string'], -// [ -// 'Voucher(bytes32 id,address signer)', -// ], -// ); -export const CHECK_IN_TYPE_HASH = - "0xf811d7f3ddb148410001929e2cbfb7fea8779b9349b7c2f650fa91840528d69c"; diff --git a/utils/index.ts b/utils/index.ts index 2236ffd..203fe30 100644 --- a/utils/index.ts +++ b/utils/index.ts @@ -1,18 +1,53 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import { utils, BigNumber, TypedDataField, VoidSigner } from "ethers"; -import { - PAYMENT_OPTION_TYPE_HASH, - CANCEL_OPTION_TYPE_HASH, - OFFER_TYPE_HASH, -} from "./constants"; -import { MockERC20Dec18Permit } from "../typechain"; -import { - PaymentOption, - CancelOption, - OfferPayload, - Offer, - Request, -} from "./types"; +import { utils, BigNumber } from "ethers"; + +// Protocol entities types (kinds) as object +export const kinds = { + supplier: utils.formatBytes32String("supplier"), + retailer: utils.formatBytes32String("retailer"), +}; + +// Protocol entities types (kinds) as values array +export const kindsArr = Object.values(kinds); + +// Protocol defaults +export const eip712name = "Market"; +export const eip712version = "1"; +export const minDeposit = BigNumber.from("1000000000000000000000"); +export const claimPeriod = BigNumber.from("60"); +export const protocolFee = BigNumber.from("1"); +export const retailerFee = BigNumber.from("1"); + +// ethers.solidityPackedKeccak256( +// ['string'], +// ['PaymentOption(bytes32 id,uint256 price,address asset)'], +// ); +export const PAYMENT_OPTION_TYPE_HASH = + "0x2f8fc0b3ad3f58f6deb367673d38e4112a3c8c64de033c5b780b84ef8f67cde6"; + +// ethers.solidityPackedKeccak256( +// ['string'], +// ['CancelOption(uint256 time,uint256 penalty)'], +// ); +export const CANCEL_OPTION_TYPE_HASH = + "0x8ea27057ea8a0239f02c8b75748218a035a5a2a2a0785b53aaa99af91ff538c5"; + +// ethers.solidityPackedKeccak256( +// ['string'], +// [ +// 'Offer(bytes32 id,uint256 expire,bytes32 supplierId,uint256 chainId,bytes32 requestHash,bytes32 optionsHash,bytes32 paymentHash,bytes32 cancelHash,bool transferable,uint256 checkIn)', +// ], +// ); +export const OFFER_TYPE_HASH = + "0x4fb12343a6f44152999c71291770d97fc1eace9d7d04889330d5a6d1af4a57c7"; + +// ethers.solidityPackedKeccak256( +// ['string'], +// [ +// 'Voucher(bytes32 id,address signer)', +// ], +// ); +export const CHECK_IN_TYPE_HASH = + "0xf811d7f3ddb148410001929e2cbfb7fea8779b9349b7c2f650fa91840528d69c"; export const randomId = (): string => utils.solidityKeccak256( @@ -30,282 +65,3 @@ export const randomId = (): string => export const createSupplierId = (address: string, salt: string): string => utils.solidityKeccak256(["address", "bytes32"], [address, salt]); - -export const hashObject = (request: unknown): string => - utils.solidityKeccak256(["string"], [JSON.stringify(request)]); - -export const hashPaymentOption = (option: PaymentOption): string => - utils.solidityKeccak256( - ["bytes32", "bytes32", "uint256", "address"], - [PAYMENT_OPTION_TYPE_HASH, option.id, option.price, option.asset] - ); - -export const hashCancelOption = (option: CancelOption): string => - utils.solidityKeccak256( - ["bytes32", "uint256", "uint256"], - [CANCEL_OPTION_TYPE_HASH, option.time, option.penalty] - ); - -export const hashPaymentOptionArray = (options: PaymentOption[]): string => { - const hashes = []; - - for (let i = 0; i < options.length; i++) { - hashes[i] = hashPaymentOption(options[i]); - } - return utils.solidityKeccak256(["bytes32[]"], [hashes]); -}; - -export const hashCancelOptionArray = (options: CancelOption[]): string => { - const hashes = []; - - for (let i = 0; i < options.length; i++) { - hashes[i] = hashCancelOption(options[i]); - } - - return utils.solidityKeccak256(["bytes32[]"], [hashes]); -}; - -export const hashOfferPayload = (payload: OfferPayload): string => - utils.solidityKeccak256( - [ - "bytes32", - "bytes32", - "uint256", - "bytes32", - "uint256", - "bytes32", - "bytes32", - "bytes32", - "bytes32", - "bool", - "uint256", - ], - [ - OFFER_TYPE_HASH, - payload.id, - payload.expire, - payload.supplierId, - payload.chainId, - payload.requestHash, - payload.optionsHash, - payload.paymentHash, - payload.cancelHash, - payload.transferable, - payload.checkIn, - ] - ); - -export const hashCheckInOut = (offerId: string, signer: string): string => - utils.solidityKeccak256( - ["bytes32", "bytes32", "address"], - [OFFER_TYPE_HASH, offerId, signer] - ); - -export const offerEip712Types: Record> = { - Offer: [ - { - name: "id", - type: "bytes32", - }, - { - name: "expire", - type: "uint256", - }, - { - name: "supplierId", - type: "bytes32", - }, - { - name: "chainId", - type: "uint256", - }, - { - name: "requestHash", - type: "bytes32", - }, - { - name: "optionsHash", - type: "bytes32", - }, - { - name: "paymentHash", - type: "bytes32", - }, - { - name: "cancelHash", - type: "bytes32", - }, - { - name: "transferable", - type: "bool", - }, - { - name: "checkIn", - type: "uint256", - }, - ], -}; - -export const checkInOutTypes: Record> = { - Voucher: [ - { - name: "id", - type: "bytes32", - }, - { - name: "signer", - type: "address", - }, - ], -}; - -export const createCheckInOutSignature = async ( - signer: VoidSigner, - offerId: string, - name: string, - version: string, - chainId: BigNumber, - verifyingContract: string -): Promise => - await signer._signTypedData( - { - name, - version, - chainId, - verifyingContract, - }, - checkInOutTypes, - { - id: offerId, - signer: signer.address, - } - ); - -export const createPermitSignature = async ( - signer: VoidSigner, - erc20: MockERC20Dec18Permit, - owner: string, - spender: string, - value: BigNumber, - deadline: number, - version = "1" -): Promise => { - const nonce = await erc20.nonces(owner); - const name = await erc20.name(); - const chainId = await signer.getChainId(); - - return await signer._signTypedData( - { - name, - version, - chainId, - verifyingContract: erc20.address, - }, - { - Permit: [ - { - name: "owner", - type: "address", - }, - { - name: "spender", - type: "address", - }, - { - name: "value", - type: "uint256", - }, - { - name: "nonce", - type: "uint256", - }, - { - name: "deadline", - type: "uint256", - }, - ], - }, - { - owner, - spender, - value, - nonce, - deadline, - } - ); -}; - -export const getCancelPenalty = ( - options: CancelOption[], - timestamp: BigNumber -) => { - let selectedTime = BigNumber.from(0); - let selectedPenalty = BigNumber.from(0); - - for (const option of options) { - if ( - timestamp.gte(option.time) && - (selectedTime.isZero() || option.time.lt(selectedTime)) - ) { - selectedTime = option.time; - selectedPenalty = option.penalty; - } - } - - return selectedPenalty.lte(BigNumber.from(100)) - ? selectedPenalty - : BigNumber.from(100); -}; - -export const buildOffer = async ( - signer: VoidSigner, - supplierId: string, - expire: BigNumber, - checkIn: BigNumber, - checkOut: BigNumber, - request: Request, - offerOptions: object, - payment: PaymentOption[], - cancel: CancelOption[], - transferableOverride: boolean, - name: string, - version: string, - chainId: BigNumber, - verifyingContract: string -): Promise => { - const offerPayload: OfferPayload = { - id: randomId(), - expire, - supplierId: supplierId, - chainId, - requestHash: hashObject(request), - optionsHash: hashObject(offerOptions), - paymentHash: hashPaymentOptionArray(payment), - cancelHash: hashCancelOptionArray(cancel), - transferable: transferableOverride ?? Math.random() > 0.5, - checkIn, - checkOut, - }; - - const signature = await signer._signTypedData( - { - name, - version, - chainId, - verifyingContract, - }, - offerEip712Types, - offerPayload - ); - - const offer: Offer = { - request, - options: offerOptions, - payment, - cancel, - payload: offerPayload, - signature, - }; - - return offer; -}; diff --git a/yarn.lock b/yarn.lock index 87bd845..197f202 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@adraffy/ens-normalize@1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.0.tgz#223572538f6bea336750039bb43a4016dcc8182d" + integrity sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ== + "@aws-crypto/sha256-js@1.2.2": version "1.2.2" resolved "https://registry.yarnpkg.com/@aws-crypto/sha256-js/-/sha256-js-1.2.2.tgz#02acd1a1fda92896fc5a28ec7c6e164644ea32fc" @@ -712,11 +717,23 @@ lodash "^4.17.16" uuid "^7.0.3" +"@noble/curves@1.0.0", "@noble/curves@~1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932" + integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw== + dependencies: + "@noble/hashes" "1.3.0" + "@noble/hashes@1.2.0", "@noble/hashes@~1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12" integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== +"@noble/hashes@1.3.0", "@noble/hashes@~1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" + integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== + "@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0": version "1.7.1" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" @@ -1298,6 +1315,15 @@ "@noble/secp256k1" "~1.7.0" "@scure/base" "~1.1.0" +"@scure/bip32@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.0.tgz#6c8d980ef3f290987736acd0ee2e0f0d50068d87" + integrity sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q== + dependencies: + "@noble/curves" "~1.0.0" + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + "@scure/bip39@1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.1.tgz#b54557b2e86214319405db819c4b6a370cf340c5" @@ -1306,6 +1332,14 @@ "@noble/hashes" "~1.2.0" "@scure/base" "~1.1.0" +"@scure/bip39@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.0.tgz#a207e2ef96de354de7d0002292ba1503538fc77b" + integrity sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg== + dependencies: + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + "@semantic-release/changelog@^6.0.3": version "6.0.3" resolved "https://registry.yarnpkg.com/@semantic-release/changelog/-/changelog-6.0.3.tgz#6195630ecbeccad174461de727d5f975abc23eeb" @@ -1799,6 +1833,11 @@ "@typescript-eslint/types" "5.59.5" eslint-visitor-keys "^3.3.0" +"@wagmi/chains@0.3.1": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-0.3.1.tgz#5d8e8ef1bcd8637c9f3ead8626595b12a01c35e4" + integrity sha512-NN5qziBLFeXnx0+3ywdiKKXUSW4H73Wc1jRrygl9GKXVPawU0GBMudwXUfV7VOu6E9vmG7Arj0pVsEwq63b2Ew== + JSONStream@^1.0.4, JSONStream@^1.3.4, JSONStream@^1.3.5: version "1.3.5" resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.5.tgz#3208c1f08d3a4d99261ab64f92302bc15e111ca0" @@ -1822,6 +1861,11 @@ abbrev@^2.0.0: resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-2.0.0.tgz#cf59829b8b4f03f89dda2771cb7f3653828c89bf" integrity sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ== +abitype@0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.8.2.tgz#cacd330d07488a4020d84f54fc361361234b9c83" + integrity sha512-B1ViNMGpfx/qjVQi0RTc2HEFHuR9uoCoTEkwELT5Y7pBPtBbctYijz9BK6+Kd0hQ3S70FhYTO2dWWk0QNUEXMA== + abort-controller@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" @@ -6572,6 +6616,11 @@ isomorphic-unfetch@^3.0.0: node-fetch "^2.6.1" unfetch "^4.2.0" +isomorphic-ws@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" + integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -11858,6 +11907,21 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" +viem@^0.3.37: + version "0.3.37" + resolved "https://registry.yarnpkg.com/viem/-/viem-0.3.37.tgz#0426863c52f4b77547bd3216b8ac66e32a38dda5" + integrity sha512-17jycP/1Hy9DsDpHlaaI7bbAHBDYGfVYHN6j0ltE7A/S30RXhPVFe4LAPRfmG+xR2QBq8xSUpjO78cRgDLBjZQ== + dependencies: + "@adraffy/ens-normalize" "1.9.0" + "@noble/curves" "1.0.0" + "@noble/hashes" "1.3.0" + "@scure/bip32" "1.3.0" + "@scure/bip39" "1.2.0" + "@wagmi/chains" "0.3.1" + abitype "0.8.2" + isomorphic-ws "5.0.0" + ws "8.12.0" + walk-up-path@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/walk-up-path/-/walk-up-path-3.0.1.tgz#c8d78d5375b4966c717eb17ada73dbd41490e886" @@ -12055,6 +12119,11 @@ ws@7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@8.12.0: + version "8.12.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8" + integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== + ws@^7.4.6: version "7.5.9" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591"