{"constructor_args":null,"is_partially_verified":false,"is_changed_bytecode":false,"abi":[{"inputs":[{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"BlockTimestampIsTooBig","type":"error"},{"inputs":[],"name":"CalldataMustHaveValidPayload","type":"error"},{"inputs":[],"name":"CalldataOverOrUnderFlow","type":"error"},{"inputs":[],"name":"CanNotPickMedianOfEmptyArray","type":"error"},{"inputs":[],"name":"CannotUpdateMoreThanOneDataFeed","type":"error"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"}],"name":"DataFeedIdNotFound","type":"error"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"}],"name":"DataFeedValueCannotBeZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"expectedDataTimestamp","type":"uint256"},{"internalType":"uint256","name":"dataPackageTimestamp","type":"uint256"}],"name":"DataPackageTimestampMismatch","type":"error"},{"inputs":[],"name":"DataPackageTimestampMustNotBeZero","type":"error"},{"inputs":[],"name":"DataPackageTimestampsMustBeEqual","type":"error"},{"inputs":[],"name":"DataTimestampCannotBeZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"dataTimestamp","type":"uint256"}],"name":"DataTimestampIsTooBig","type":"error"},{"inputs":[{"internalType":"uint256","name":"receivedDataTimestampMilliseconds","type":"uint256"},{"internalType":"uint256","name":"lastDataTimestampMilliseconds","type":"uint256"}],"name":"DataTimestampShouldBeNewerThanBefore","type":"error"},{"inputs":[],"name":"EachSignerMustProvideTheSameValue","type":"error"},{"inputs":[],"name":"EmptyCalldataPointersArr","type":"error"},{"inputs":[],"name":"GetDataServiceIdNotImplemented","type":"error"},{"inputs":[],"name":"IncorrectUnsignedMetadataSize","type":"error"},{"inputs":[{"internalType":"uint256","name":"receivedSignersCount","type":"uint256"},{"internalType":"uint256","name":"requiredSignersCount","type":"uint256"}],"name":"InsufficientNumberOfUniqueSigners","type":"error"},{"inputs":[],"name":"InvalidCalldataPointer","type":"error"},{"inputs":[{"internalType":"bytes32","name":"signedHash","type":"bytes32"}],"name":"InvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentBlockTimestamp","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTimestamp","type":"uint256"},{"internalType":"uint256","name":"minIntervalBetweenUpdates","type":"uint256"}],"name":"MinIntervalBetweenUpdatesHasNotPassedYet","type":"error"},{"inputs":[],"name":"RedstonePayloadMustHaveAtLeastOneDataPackage","type":"error"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"RoundNotFound","type":"error"},{"inputs":[{"internalType":"address","name":"receivedSigner","type":"address"}],"name":"SignerNotAuthorised","type":"error"},{"inputs":[{"internalType":"uint256","name":"receivedTimestampSeconds","type":"uint256"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"TimestampFromTooLongFuture","type":"error"},{"inputs":[{"internalType":"uint256","name":"receivedTimestampSeconds","type":"uint256"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"TimestampIsTooOld","type":"error"},{"inputs":[],"name":"TimestampsMustBeEqual","type":"error"},{"inputs":[{"internalType":"uint256","name":"valueByteSize","type":"uint256"}],"name":"TooLargeValueByteSize","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"UnsafeUint256ToUint80Conversion","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"name":"UnsafeUintToIntConversion","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"UpdaterNotAuthorised","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"int256","name":"current","type":"int256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updatedAt","type":"uint256"}],"name":"AnswerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"inputs":[{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"aggregateValues","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"aggregator","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"extractTimestampsAndAssertAllAreEqual","outputs":[{"internalType":"uint256","name":"extractedTimestamp","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getAllowedTimestampDiffsInSeconds","outputs":[{"internalType":"uint256","name":"maxDataAheadSeconds","type":"uint256"},{"internalType":"uint256","name":"maxDataDelaySeconds","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"signerAddress","type":"address"}],"name":"getAuthorisedSignerIndex","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBlockTimestampFromLatestUpdate","outputs":[{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDataFeedId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getDataFeedIds","outputs":[{"internalType":"bytes32[]","name":"dataFeedIds","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"}],"name":"getDataFeedIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDataServiceId","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDataTimestampFromLatestUpdate","outputs":[{"internalType":"uint256","name":"lastDataTimestamp","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestRoundId","outputs":[{"internalType":"uint256","name":"latestRoundId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestRoundParams","outputs":[{"internalType":"uint256","name":"latestRoundId","type":"uint256"},{"internalType":"uint128","name":"latestRoundDataTimestamp","type":"uint128"},{"internalType":"uint128","name":"latestRoundBlockTimestamp","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinIntervalBetweenUpdates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getPackedTimestampsForRound","outputs":[{"internalType":"uint256","name":"roundTimestamps","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPackedTimestampsFromLatestUpdate","outputs":[{"internalType":"uint256","name":"packedTimestamps","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriceFeedAdapter","outputs":[{"internalType":"contract IRedstoneAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriceFeedAdapterWithRounds","outputs":[{"internalType":"contract PriceFeedsAdapterWithRounds","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"requestedRoundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"},{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getRoundDataFromAdapter","outputs":[{"internalType":"uint256","name":"dataFeedValue","type":"uint256"},{"internalType":"uint128","name":"roundDataTimestamp","type":"uint128"},{"internalType":"uint128","name":"roundBlockTimestamp","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTimestampsFromLatestUpdate","outputs":[{"internalType":"uint128","name":"dataTimestamp","type":"uint128"},{"internalType":"uint128","name":"blockTimestamp","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUniqueSignersThreshold","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"}],"name":"getValueForDataFeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"},{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getValueForDataFeedAndRound","outputs":[{"internalType":"uint256","name":"dataFeedValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"}],"name":"getValueForDataFeedUnsafe","outputs":[{"internalType":"uint256","name":"dataFeedValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"dataFeedIds","type":"bytes32[]"}],"name":"getValuesForDataFeeds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"requestedDataFeedIds","type":"bytes32[]"}],"name":"getValuesForDataFeedsUnsafe","outputs":[{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRound","outputs":[{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"updater","type":"address"}],"name":"requireAuthorisedUpdater","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"dataPackagesTimestamp","type":"uint256"}],"name":"updateDataFeedsValues","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"},{"internalType":"uint256","name":"valueForDataFeed","type":"uint256"}],"name":"validateDataFeedValueOnRead","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dataFeedId","type":"bytes32"},{"internalType":"uint256","name":"valueForDataFeed","type":"uint256"}],"name":"validateDataFeedValueOnWrite","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"dataPackagesTimestamp","type":"uint256"}],"name":"validateDataPackagesTimestampOnce","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"dataPackagesTimestamp","type":"uint256"}],"name":"validateProposedDataPackagesTimestamp","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"receivedTimestampMilliseconds","type":"uint256"}],"name":"validateTimestamp","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"}],"conflicting_implementations":null,"certified":false,"additional_sources":[{"file_path":"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\n// solhint-disable-next-line interface-starts-with-i\ninterface AggregatorV3Interface {\n  function decimals() external view returns (uint8);\n\n  function description() external view returns (string memory);\n\n  function version() external view returns (uint256);\n\n  function getRoundData(\n    uint80 _roundId\n  ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n\n  function latestRoundData()\n    external\n    view\n    returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (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 * ```solidity\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\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"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.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     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\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://consensys.net/diligence/blog/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.8.0/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(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\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 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        (bool success, bytes memory returndata) = target.delegatecall(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"},{"file_path":"@openzeppelin/contracts/utils/math/SafeCast.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)\n// This file was procedurally generated from scripts/generate/templates/SafeCast.js.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow\n * checks.\n *\n * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can\n * easily result in undesired exploitation or bugs, since developers usually\n * assume that overflows raise errors. `SafeCast` restores this intuition by\n * reverting the transaction when such an operation overflows.\n *\n * Using this library instead of the unchecked operations eliminates an entire\n * class of bugs, so it's recommended to use it always.\n *\n * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing\n * all math on `uint256` and `int256` and then downcasting.\n */\nlibrary SafeCast {\n    /**\n     * @dev Returns the downcasted uint248 from uint256, reverting on\n     * overflow (when the input is greater than largest uint248).\n     *\n     * Counterpart to Solidity's `uint248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint248(uint256 value) internal pure returns (uint248) {\n        require(value <= type(uint248).max, \"SafeCast: value doesn't fit in 248 bits\");\n        return uint248(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint240 from uint256, reverting on\n     * overflow (when the input is greater than largest uint240).\n     *\n     * Counterpart to Solidity's `uint240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint240(uint256 value) internal pure returns (uint240) {\n        require(value <= type(uint240).max, \"SafeCast: value doesn't fit in 240 bits\");\n        return uint240(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint232 from uint256, reverting on\n     * overflow (when the input is greater than largest uint232).\n     *\n     * Counterpart to Solidity's `uint232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint232(uint256 value) internal pure returns (uint232) {\n        require(value <= type(uint232).max, \"SafeCast: value doesn't fit in 232 bits\");\n        return uint232(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint224 from uint256, reverting on\n     * overflow (when the input is greater than largest uint224).\n     *\n     * Counterpart to Solidity's `uint224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     *\n     * _Available since v4.2._\n     */\n    function toUint224(uint256 value) internal pure returns (uint224) {\n        require(value <= type(uint224).max, \"SafeCast: value doesn't fit in 224 bits\");\n        return uint224(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint216 from uint256, reverting on\n     * overflow (when the input is greater than largest uint216).\n     *\n     * Counterpart to Solidity's `uint216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint216(uint256 value) internal pure returns (uint216) {\n        require(value <= type(uint216).max, \"SafeCast: value doesn't fit in 216 bits\");\n        return uint216(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint208 from uint256, reverting on\n     * overflow (when the input is greater than largest uint208).\n     *\n     * Counterpart to Solidity's `uint208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint208(uint256 value) internal pure returns (uint208) {\n        require(value <= type(uint208).max, \"SafeCast: value doesn't fit in 208 bits\");\n        return uint208(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint200 from uint256, reverting on\n     * overflow (when the input is greater than largest uint200).\n     *\n     * Counterpart to Solidity's `uint200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint200(uint256 value) internal pure returns (uint200) {\n        require(value <= type(uint200).max, \"SafeCast: value doesn't fit in 200 bits\");\n        return uint200(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint192 from uint256, reverting on\n     * overflow (when the input is greater than largest uint192).\n     *\n     * Counterpart to Solidity's `uint192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint192(uint256 value) internal pure returns (uint192) {\n        require(value <= type(uint192).max, \"SafeCast: value doesn't fit in 192 bits\");\n        return uint192(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint184 from uint256, reverting on\n     * overflow (when the input is greater than largest uint184).\n     *\n     * Counterpart to Solidity's `uint184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint184(uint256 value) internal pure returns (uint184) {\n        require(value <= type(uint184).max, \"SafeCast: value doesn't fit in 184 bits\");\n        return uint184(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint176 from uint256, reverting on\n     * overflow (when the input is greater than largest uint176).\n     *\n     * Counterpart to Solidity's `uint176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint176(uint256 value) internal pure returns (uint176) {\n        require(value <= type(uint176).max, \"SafeCast: value doesn't fit in 176 bits\");\n        return uint176(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint168 from uint256, reverting on\n     * overflow (when the input is greater than largest uint168).\n     *\n     * Counterpart to Solidity's `uint168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint168(uint256 value) internal pure returns (uint168) {\n        require(value <= type(uint168).max, \"SafeCast: value doesn't fit in 168 bits\");\n        return uint168(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint160 from uint256, reverting on\n     * overflow (when the input is greater than largest uint160).\n     *\n     * Counterpart to Solidity's `uint160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint160(uint256 value) internal pure returns (uint160) {\n        require(value <= type(uint160).max, \"SafeCast: value doesn't fit in 160 bits\");\n        return uint160(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint152 from uint256, reverting on\n     * overflow (when the input is greater than largest uint152).\n     *\n     * Counterpart to Solidity's `uint152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint152(uint256 value) internal pure returns (uint152) {\n        require(value <= type(uint152).max, \"SafeCast: value doesn't fit in 152 bits\");\n        return uint152(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint144 from uint256, reverting on\n     * overflow (when the input is greater than largest uint144).\n     *\n     * Counterpart to Solidity's `uint144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint144(uint256 value) internal pure returns (uint144) {\n        require(value <= type(uint144).max, \"SafeCast: value doesn't fit in 144 bits\");\n        return uint144(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint136 from uint256, reverting on\n     * overflow (when the input is greater than largest uint136).\n     *\n     * Counterpart to Solidity's `uint136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint136(uint256 value) internal pure returns (uint136) {\n        require(value <= type(uint136).max, \"SafeCast: value doesn't fit in 136 bits\");\n        return uint136(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint128 from uint256, reverting on\n     * overflow (when the input is greater than largest uint128).\n     *\n     * Counterpart to Solidity's `uint128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint128(uint256 value) internal pure returns (uint128) {\n        require(value <= type(uint128).max, \"SafeCast: value doesn't fit in 128 bits\");\n        return uint128(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint120 from uint256, reverting on\n     * overflow (when the input is greater than largest uint120).\n     *\n     * Counterpart to Solidity's `uint120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint120(uint256 value) internal pure returns (uint120) {\n        require(value <= type(uint120).max, \"SafeCast: value doesn't fit in 120 bits\");\n        return uint120(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint112 from uint256, reverting on\n     * overflow (when the input is greater than largest uint112).\n     *\n     * Counterpart to Solidity's `uint112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint112(uint256 value) internal pure returns (uint112) {\n        require(value <= type(uint112).max, \"SafeCast: value doesn't fit in 112 bits\");\n        return uint112(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint104 from uint256, reverting on\n     * overflow (when the input is greater than largest uint104).\n     *\n     * Counterpart to Solidity's `uint104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint104(uint256 value) internal pure returns (uint104) {\n        require(value <= type(uint104).max, \"SafeCast: value doesn't fit in 104 bits\");\n        return uint104(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint96 from uint256, reverting on\n     * overflow (when the input is greater than largest uint96).\n     *\n     * Counterpart to Solidity's `uint96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     *\n     * _Available since v4.2._\n     */\n    function toUint96(uint256 value) internal pure returns (uint96) {\n        require(value <= type(uint96).max, \"SafeCast: value doesn't fit in 96 bits\");\n        return uint96(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint88 from uint256, reverting on\n     * overflow (when the input is greater than largest uint88).\n     *\n     * Counterpart to Solidity's `uint88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint88(uint256 value) internal pure returns (uint88) {\n        require(value <= type(uint88).max, \"SafeCast: value doesn't fit in 88 bits\");\n        return uint88(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint80 from uint256, reverting on\n     * overflow (when the input is greater than largest uint80).\n     *\n     * Counterpart to Solidity's `uint80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint80(uint256 value) internal pure returns (uint80) {\n        require(value <= type(uint80).max, \"SafeCast: value doesn't fit in 80 bits\");\n        return uint80(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint72 from uint256, reverting on\n     * overflow (when the input is greater than largest uint72).\n     *\n     * Counterpart to Solidity's `uint72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint72(uint256 value) internal pure returns (uint72) {\n        require(value <= type(uint72).max, \"SafeCast: value doesn't fit in 72 bits\");\n        return uint72(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint64 from uint256, reverting on\n     * overflow (when the input is greater than largest uint64).\n     *\n     * Counterpart to Solidity's `uint64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint64(uint256 value) internal pure returns (uint64) {\n        require(value <= type(uint64).max, \"SafeCast: value doesn't fit in 64 bits\");\n        return uint64(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint56 from uint256, reverting on\n     * overflow (when the input is greater than largest uint56).\n     *\n     * Counterpart to Solidity's `uint56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint56(uint256 value) internal pure returns (uint56) {\n        require(value <= type(uint56).max, \"SafeCast: value doesn't fit in 56 bits\");\n        return uint56(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint48 from uint256, reverting on\n     * overflow (when the input is greater than largest uint48).\n     *\n     * Counterpart to Solidity's `uint48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint48(uint256 value) internal pure returns (uint48) {\n        require(value <= type(uint48).max, \"SafeCast: value doesn't fit in 48 bits\");\n        return uint48(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint40 from uint256, reverting on\n     * overflow (when the input is greater than largest uint40).\n     *\n     * Counterpart to Solidity's `uint40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint40(uint256 value) internal pure returns (uint40) {\n        require(value <= type(uint40).max, \"SafeCast: value doesn't fit in 40 bits\");\n        return uint40(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint32 from uint256, reverting on\n     * overflow (when the input is greater than largest uint32).\n     *\n     * Counterpart to Solidity's `uint32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint32(uint256 value) internal pure returns (uint32) {\n        require(value <= type(uint32).max, \"SafeCast: value doesn't fit in 32 bits\");\n        return uint32(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint24 from uint256, reverting on\n     * overflow (when the input is greater than largest uint24).\n     *\n     * Counterpart to Solidity's `uint24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     *\n     * _Available since v4.7._\n     */\n    function toUint24(uint256 value) internal pure returns (uint24) {\n        require(value <= type(uint24).max, \"SafeCast: value doesn't fit in 24 bits\");\n        return uint24(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint16 from uint256, reverting on\n     * overflow (when the input is greater than largest uint16).\n     *\n     * Counterpart to Solidity's `uint16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint16(uint256 value) internal pure returns (uint16) {\n        require(value <= type(uint16).max, \"SafeCast: value doesn't fit in 16 bits\");\n        return uint16(value);\n    }\n\n    /**\n     * @dev Returns the downcasted uint8 from uint256, reverting on\n     * overflow (when the input is greater than largest uint8).\n     *\n     * Counterpart to Solidity's `uint8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     *\n     * _Available since v2.5._\n     */\n    function toUint8(uint256 value) internal pure returns (uint8) {\n        require(value <= type(uint8).max, \"SafeCast: value doesn't fit in 8 bits\");\n        return uint8(value);\n    }\n\n    /**\n     * @dev Converts a signed int256 into an unsigned uint256.\n     *\n     * Requirements:\n     *\n     * - input must be greater than or equal to 0.\n     *\n     * _Available since v3.0._\n     */\n    function toUint256(int256 value) internal pure returns (uint256) {\n        require(value >= 0, \"SafeCast: value must be positive\");\n        return uint256(value);\n    }\n\n    /**\n     * @dev Returns the downcasted int248 from int256, reverting on\n     * overflow (when the input is less than smallest int248 or\n     * greater than largest int248).\n     *\n     * Counterpart to Solidity's `int248` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 248 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt248(int256 value) internal pure returns (int248 downcasted) {\n        downcasted = int248(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 248 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int240 from int256, reverting on\n     * overflow (when the input is less than smallest int240 or\n     * greater than largest int240).\n     *\n     * Counterpart to Solidity's `int240` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 240 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt240(int256 value) internal pure returns (int240 downcasted) {\n        downcasted = int240(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 240 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int232 from int256, reverting on\n     * overflow (when the input is less than smallest int232 or\n     * greater than largest int232).\n     *\n     * Counterpart to Solidity's `int232` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 232 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt232(int256 value) internal pure returns (int232 downcasted) {\n        downcasted = int232(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 232 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int224 from int256, reverting on\n     * overflow (when the input is less than smallest int224 or\n     * greater than largest int224).\n     *\n     * Counterpart to Solidity's `int224` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 224 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt224(int256 value) internal pure returns (int224 downcasted) {\n        downcasted = int224(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 224 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int216 from int256, reverting on\n     * overflow (when the input is less than smallest int216 or\n     * greater than largest int216).\n     *\n     * Counterpart to Solidity's `int216` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 216 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt216(int256 value) internal pure returns (int216 downcasted) {\n        downcasted = int216(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 216 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int208 from int256, reverting on\n     * overflow (when the input is less than smallest int208 or\n     * greater than largest int208).\n     *\n     * Counterpart to Solidity's `int208` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 208 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt208(int256 value) internal pure returns (int208 downcasted) {\n        downcasted = int208(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 208 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int200 from int256, reverting on\n     * overflow (when the input is less than smallest int200 or\n     * greater than largest int200).\n     *\n     * Counterpart to Solidity's `int200` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 200 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt200(int256 value) internal pure returns (int200 downcasted) {\n        downcasted = int200(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 200 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int192 from int256, reverting on\n     * overflow (when the input is less than smallest int192 or\n     * greater than largest int192).\n     *\n     * Counterpart to Solidity's `int192` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 192 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt192(int256 value) internal pure returns (int192 downcasted) {\n        downcasted = int192(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 192 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int184 from int256, reverting on\n     * overflow (when the input is less than smallest int184 or\n     * greater than largest int184).\n     *\n     * Counterpart to Solidity's `int184` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 184 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt184(int256 value) internal pure returns (int184 downcasted) {\n        downcasted = int184(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 184 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int176 from int256, reverting on\n     * overflow (when the input is less than smallest int176 or\n     * greater than largest int176).\n     *\n     * Counterpart to Solidity's `int176` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 176 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt176(int256 value) internal pure returns (int176 downcasted) {\n        downcasted = int176(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 176 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int168 from int256, reverting on\n     * overflow (when the input is less than smallest int168 or\n     * greater than largest int168).\n     *\n     * Counterpart to Solidity's `int168` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 168 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt168(int256 value) internal pure returns (int168 downcasted) {\n        downcasted = int168(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 168 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int160 from int256, reverting on\n     * overflow (when the input is less than smallest int160 or\n     * greater than largest int160).\n     *\n     * Counterpart to Solidity's `int160` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 160 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt160(int256 value) internal pure returns (int160 downcasted) {\n        downcasted = int160(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 160 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int152 from int256, reverting on\n     * overflow (when the input is less than smallest int152 or\n     * greater than largest int152).\n     *\n     * Counterpart to Solidity's `int152` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 152 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt152(int256 value) internal pure returns (int152 downcasted) {\n        downcasted = int152(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 152 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int144 from int256, reverting on\n     * overflow (when the input is less than smallest int144 or\n     * greater than largest int144).\n     *\n     * Counterpart to Solidity's `int144` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 144 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt144(int256 value) internal pure returns (int144 downcasted) {\n        downcasted = int144(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 144 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int136 from int256, reverting on\n     * overflow (when the input is less than smallest int136 or\n     * greater than largest int136).\n     *\n     * Counterpart to Solidity's `int136` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 136 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt136(int256 value) internal pure returns (int136 downcasted) {\n        downcasted = int136(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 136 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int128 from int256, reverting on\n     * overflow (when the input is less than smallest int128 or\n     * greater than largest int128).\n     *\n     * Counterpart to Solidity's `int128` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 128 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt128(int256 value) internal pure returns (int128 downcasted) {\n        downcasted = int128(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 128 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int120 from int256, reverting on\n     * overflow (when the input is less than smallest int120 or\n     * greater than largest int120).\n     *\n     * Counterpart to Solidity's `int120` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 120 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt120(int256 value) internal pure returns (int120 downcasted) {\n        downcasted = int120(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 120 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int112 from int256, reverting on\n     * overflow (when the input is less than smallest int112 or\n     * greater than largest int112).\n     *\n     * Counterpart to Solidity's `int112` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 112 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt112(int256 value) internal pure returns (int112 downcasted) {\n        downcasted = int112(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 112 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int104 from int256, reverting on\n     * overflow (when the input is less than smallest int104 or\n     * greater than largest int104).\n     *\n     * Counterpart to Solidity's `int104` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 104 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt104(int256 value) internal pure returns (int104 downcasted) {\n        downcasted = int104(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 104 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int96 from int256, reverting on\n     * overflow (when the input is less than smallest int96 or\n     * greater than largest int96).\n     *\n     * Counterpart to Solidity's `int96` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 96 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt96(int256 value) internal pure returns (int96 downcasted) {\n        downcasted = int96(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 96 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int88 from int256, reverting on\n     * overflow (when the input is less than smallest int88 or\n     * greater than largest int88).\n     *\n     * Counterpart to Solidity's `int88` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 88 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt88(int256 value) internal pure returns (int88 downcasted) {\n        downcasted = int88(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 88 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int80 from int256, reverting on\n     * overflow (when the input is less than smallest int80 or\n     * greater than largest int80).\n     *\n     * Counterpart to Solidity's `int80` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 80 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt80(int256 value) internal pure returns (int80 downcasted) {\n        downcasted = int80(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 80 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int72 from int256, reverting on\n     * overflow (when the input is less than smallest int72 or\n     * greater than largest int72).\n     *\n     * Counterpart to Solidity's `int72` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 72 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt72(int256 value) internal pure returns (int72 downcasted) {\n        downcasted = int72(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 72 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int64 from int256, reverting on\n     * overflow (when the input is less than smallest int64 or\n     * greater than largest int64).\n     *\n     * Counterpart to Solidity's `int64` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 64 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt64(int256 value) internal pure returns (int64 downcasted) {\n        downcasted = int64(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 64 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int56 from int256, reverting on\n     * overflow (when the input is less than smallest int56 or\n     * greater than largest int56).\n     *\n     * Counterpart to Solidity's `int56` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 56 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt56(int256 value) internal pure returns (int56 downcasted) {\n        downcasted = int56(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 56 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int48 from int256, reverting on\n     * overflow (when the input is less than smallest int48 or\n     * greater than largest int48).\n     *\n     * Counterpart to Solidity's `int48` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 48 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt48(int256 value) internal pure returns (int48 downcasted) {\n        downcasted = int48(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 48 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int40 from int256, reverting on\n     * overflow (when the input is less than smallest int40 or\n     * greater than largest int40).\n     *\n     * Counterpart to Solidity's `int40` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 40 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt40(int256 value) internal pure returns (int40 downcasted) {\n        downcasted = int40(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 40 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int32 from int256, reverting on\n     * overflow (when the input is less than smallest int32 or\n     * greater than largest int32).\n     *\n     * Counterpart to Solidity's `int32` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 32 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt32(int256 value) internal pure returns (int32 downcasted) {\n        downcasted = int32(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 32 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int24 from int256, reverting on\n     * overflow (when the input is less than smallest int24 or\n     * greater than largest int24).\n     *\n     * Counterpart to Solidity's `int24` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 24 bits\n     *\n     * _Available since v4.7._\n     */\n    function toInt24(int256 value) internal pure returns (int24 downcasted) {\n        downcasted = int24(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 24 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int16 from int256, reverting on\n     * overflow (when the input is less than smallest int16 or\n     * greater than largest int16).\n     *\n     * Counterpart to Solidity's `int16` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 16 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt16(int256 value) internal pure returns (int16 downcasted) {\n        downcasted = int16(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 16 bits\");\n    }\n\n    /**\n     * @dev Returns the downcasted int8 from int256, reverting on\n     * overflow (when the input is less than smallest int8 or\n     * greater than largest int8).\n     *\n     * Counterpart to Solidity's `int8` operator.\n     *\n     * Requirements:\n     *\n     * - input must fit into 8 bits\n     *\n     * _Available since v3.1._\n     */\n    function toInt8(int256 value) internal pure returns (int8 downcasted) {\n        downcasted = int8(value);\n        require(downcasted == value, \"SafeCast: value doesn't fit in 8 bits\");\n    }\n\n    /**\n     * @dev Converts an unsigned uint256 into a signed int256.\n     *\n     * Requirements:\n     *\n     * - input must be less than or equal to maxInt256.\n     *\n     * _Available since v3.0._\n     */\n    function toInt256(uint256 value) internal pure returns (int256) {\n        // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive\n        require(value <= uint256(type(int256).max), \"SafeCast: value doesn't fit in an int256\");\n        return int256(value);\n    }\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/core/IRedstoneAdapter.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\n/**\n * @title Interface of RedStone adapter\n * @author The Redstone Oracles team\n */\ninterface IRedstoneAdapter {\n\n  /**\n   * @notice Updates values of all data feeds supported by the Adapter contract\n   * @dev This function requires an attached redstone payload to the transaction calldata.\n   * It also requires each data package to have exactly the same timestamp\n   * @param dataPackagesTimestamp Timestamp of each signed data package in the redstone payload\n   */\n  function updateDataFeedsValues(uint256 dataPackagesTimestamp) external;\n\n\n  /**\n   * @notice Returns the latest properly reported value of the data feed\n   * @param dataFeedId The identifier of the requested data feed\n   * @return value The latest value of the given data feed\n   */\n  function getValueForDataFeed(bytes32 dataFeedId) external view returns (uint256);\n\n  /**\n   * @notice Returns the latest properly reported values for several data feeds\n   * @param requestedDataFeedIds The array of identifiers for the requested feeds\n   * @return values Values of the requested data feeds in the corresponding order\n   */\n  function getValuesForDataFeeds(bytes32[] memory requestedDataFeedIds) external view returns (uint256[] memory);\n\n  /**\n   * @notice Returns data timestamp from the latest update\n   * @dev It's virtual, because its implementation can sometimes be different\n   * (e.g. SinglePriceFeedAdapterWithClearing)\n   * @return lastDataTimestamp Timestamp of the latest reported data packages\n   */\n  function getDataTimestampFromLatestUpdate() external view returns (uint256 lastDataTimestamp);\n\n  /**\n   * @notice Returns block timestamp of the latest successful update\n   * @return blockTimestamp The block timestamp of the latest successful update\n   */\n  function getBlockTimestampFromLatestUpdate() external view returns (uint256 blockTimestamp);\n\n\n  /**\n   * @notice Returns timestamps of the latest successful update\n   * @return dataTimestamp timestamp (usually in milliseconds) from the signed data packages\n   * @return blockTimestamp timestamp of the block when the update has happened\n   */\n  function getTimestampsFromLatestUpdate() external view returns (uint128 dataTimestamp, uint128 blockTimestamp);\n\n  /**\n   * @notice Returns identifiers of all data feeds supported by the Adapter contract\n   * @return An array of data feed identifiers\n   */\n  function getDataFeedIds() external view returns (bytes32[] memory);\n\n  /**\n   * @notice Returns the unique index of the given data feed\n   * @param dataFeedId The data feed identifier\n   * @return index The index of the data feed\n   */\n  function getDataFeedIndex(bytes32 dataFeedId) external view returns (uint256);\n\n  /**\n   * @notice Returns minimal required interval (usually in seconds) between subsequent updates\n   * @return interval The required interval between updates\n   */\n  function getMinIntervalBetweenUpdates() external view returns (uint256);\n\n  /**\n   * @notice Reverts if the proposed timestamp of data packages it too old or too new\n   * comparing to the block.timestamp. It also ensures that the proposed timestamp is newer\n   * Then the one from the previous update\n   * @param dataPackagesTimestamp The proposed timestamp (usually in milliseconds)\n   */\n  function validateProposedDataPackagesTimestamp(uint256 dataPackagesTimestamp) external view;\n\n  /**\n   * @notice Reverts if the updater is not authorised\n   * @dev This function should revert if msg.sender is not allowed to update data feed values\n   * @param updater The address of the proposed updater\n   */\n  function requireAuthorisedUpdater(address updater) external view;\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/core/RedstoneAdapterBase.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport {RedstoneConsumerNumericBase, RedstoneDefaultsLib} from \"@redstone-finance/evm-connector/contracts/core/RedstoneConsumerNumericBase.sol\";\nimport {IRedstoneAdapter} from \"./IRedstoneAdapter.sol\";\n\n/**\n * @title Core logic of Redstone Adapter Contract\n * @author The Redstone Oracles team\n * @dev This contract is used to repeatedly push Redstone data to blockchain storage\n * More details here: https://docs.redstone.finance/docs/smart-contract-devs/get-started/redstone-classic\n *\n * Key details about the contract:\n * - Values for data feeds can be updated using the `updateDataFeedsValues` function\n * - All data feeds must be updated within a single call, partial updates are not allowed\n * - There is a configurable minimum interval between updates\n * - Updaters can be restricted by overriding `requireAuthorisedUpdater` function\n * - The contract is designed to force values validation, by default it prevents returning zero values\n * - All data packages in redstone payload must have the same timestamp,\n *    equal to `dataPackagesTimestamp` argument of the `updateDataFeedsValues` function\n * - Block timestamp abstraction - even though we call it blockTimestamp in many places,\n *    it's possible to have a custom logic here, e.g. use block number instead of a timestamp\n */\nabstract contract RedstoneAdapterBase is RedstoneConsumerNumericBase, IRedstoneAdapter {\n  // We don't use storage variables to avoid potential problems with upgradable contracts\n  bytes32 internal constant LATEST_UPDATE_TIMESTAMPS_STORAGE_LOCATION = 0x3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe2; // keccak256(\"RedStone.lastUpdateTimestamp\");\n  uint256 internal constant MIN_INTERVAL_BETWEEN_UPDATES = 3 seconds;\n  uint256 internal constant BITS_COUNT_IN_16_BYTES = 128;\n  uint256 internal constant MAX_NUMBER_FOR_128_BITS = 0x00000000000000000000000000000000ffffffffffffffffffffffffffffffff;\n\n  error DataTimestampShouldBeNewerThanBefore(\n    uint256 receivedDataTimestampMilliseconds,\n    uint256 lastDataTimestampMilliseconds\n  );\n\n  error MinIntervalBetweenUpdatesHasNotPassedYet(\n    uint256 currentBlockTimestamp,\n    uint256 lastUpdateTimestamp,\n    uint256 minIntervalBetweenUpdates\n  );\n\n  error DataPackageTimestampMismatch(uint256 expectedDataTimestamp, uint256 dataPackageTimestamp);\n\n  error DataFeedValueCannotBeZero(bytes32 dataFeedId);\n\n  error DataFeedIdNotFound(bytes32 dataFeedId);\n\n  error DataTimestampIsTooBig(uint256 dataTimestamp);\n\n  error BlockTimestampIsTooBig(uint256 blockTimestamp);\n\n  /**\n   * @notice Reverts if the updater is not authorised\n   * @dev This function should revert if msg.sender is not allowed to update data feed values\n   * @param updater The address of the proposed updater\n   */\n  function requireAuthorisedUpdater(address updater) public view virtual {\n    // By default, anyone can update data feed values, but it can be overridden\n  }\n\n  /**\n   * @notice Returns identifiers of all data feeds supported by the Adapter contract\n   * @dev this function must be implemented in derived contracts\n   * @return An array of data feed identifiers\n   */\n  function getDataFeedIds() public view virtual returns (bytes32[] memory);\n\n  /**\n   * @notice Returns the unique index of the given data feed\n   * @dev This function can (and should) be overridden to reduce gas\n   * costs of other functions\n   * @param dataFeedId The data feed identifier\n   * @return index The index of the data feed\n   */\n  function getDataFeedIndex(bytes32 dataFeedId) public view virtual returns (uint256) {\n    bytes32[] memory dataFeedIds = getDataFeedIds();\n    for (uint256 i = 0; i < dataFeedIds.length;) {\n      if (dataFeedIds[i] == dataFeedId) {\n        return i;\n      }\n      unchecked { i++; } // reduces gas costs\n    }\n    revert DataFeedIdNotFound(dataFeedId);\n  }\n\n  /**\n   * @notice Updates values of all data feeds supported by the Adapter contract\n   * @dev This function requires an attached redstone payload to the transaction calldata.\n   * It also requires each data package to have exactly the same timestamp\n   * @param dataPackagesTimestamp Timestamp of each signed data package in the redstone payload\n   */\n  function updateDataFeedsValues(uint256 dataPackagesTimestamp) public virtual {\n    requireAuthorisedUpdater(msg.sender);\n    _assertMinIntervalBetweenUpdatesPassed();\n    validateProposedDataPackagesTimestamp(dataPackagesTimestamp);\n    _saveTimestampsOfCurrentUpdate(dataPackagesTimestamp);\n\n    bytes32[] memory dataFeedsIdsArray = getDataFeedIds();\n\n    // It will trigger timestamp validation for each data package\n    uint256[] memory oracleValues = getOracleNumericValuesFromTxMsg(dataFeedsIdsArray);\n\n    _validateAndUpdateDataFeedsValues(dataFeedsIdsArray, oracleValues);\n  }\n\n  /**\n   * @dev Note! This function is not called directly, it's called for each data package    .\n   * in redstone payload and just verifies if each data package has the same timestamp\n   * as the one that was saved in the storage\n   * @param receivedTimestampMilliseconds Timestamp from a data package\n   */\n  function validateTimestamp(uint256 receivedTimestampMilliseconds) public view virtual override {\n    uint256 expectedDataPackageTimestamp = getDataTimestampFromLatestUpdate();\n    if (receivedTimestampMilliseconds != expectedDataPackageTimestamp) {\n      revert DataPackageTimestampMismatch(\n        expectedDataPackageTimestamp,\n        receivedTimestampMilliseconds\n      );\n    }\n  }\n\n  /**\n   * @dev This function should be implemented by the actual contract\n   * and should contain the logic of values validation and reporting.\n   * Usually, values reporting is based on saving them to the contract storage,\n   * e.g. in PriceFeedsAdapter, but some custom implementations (e.g. GMX keeper adapter\n   * or Mento Sorted Oracles adapter) may handle values updating in a different way\n   * @param dataFeedIdsArray Array of the data feeds identifiers (it will always be all data feed ids)\n   * @param values The reported values that should be validated and reported\n   */\n  function _validateAndUpdateDataFeedsValues(bytes32[] memory dataFeedIdsArray, uint256[] memory values) internal virtual;\n\n  /**\n   * @dev This function reverts if not enough time passed since the latest update\n   */\n  function _assertMinIntervalBetweenUpdatesPassed() private view {\n    uint256 currentBlockTimestamp = getBlockTimestamp();\n    uint256 blockTimestampFromLatestUpdate = getBlockTimestampFromLatestUpdate();\n    uint256 minIntervalBetweenUpdates = getMinIntervalBetweenUpdates();\n    if (currentBlockTimestamp < blockTimestampFromLatestUpdate + minIntervalBetweenUpdates) {\n      revert MinIntervalBetweenUpdatesHasNotPassedYet(\n        currentBlockTimestamp,\n        blockTimestampFromLatestUpdate,\n        minIntervalBetweenUpdates\n      );\n    }\n  }\n\n  /**\n   * @notice Returns minimal required interval (usually in seconds) between subsequent updates\n   * @dev You can override this function to change the required interval between updates.\n   * Please do not set it to 0, as it may open many attack vectors\n   * @return interval The required interval between updates\n   */\n  function getMinIntervalBetweenUpdates() public view virtual returns (uint256) {\n    return MIN_INTERVAL_BETWEEN_UPDATES;\n  }\n\n  /**\n   * @notice Reverts if the proposed timestamp of data packages it too old or too new\n   * comparing to the block.timestamp. It also ensures that the proposed timestamp is newer\n   * Then the one from the previous update\n   * @param dataPackagesTimestamp The proposed timestamp (usually in milliseconds)\n   */\n  function validateProposedDataPackagesTimestamp(uint256 dataPackagesTimestamp) public view {\n    _preventUpdateWithOlderDataPackages(dataPackagesTimestamp);\n    validateDataPackagesTimestampOnce(dataPackagesTimestamp);\n  }\n\n\n  /**\n   * @notice Reverts if the proposed timestamp of data packages it too old or too new\n   * comparing to the current block timestamp\n   * @param dataPackagesTimestamp The proposed timestamp (usually in milliseconds)\n   */\n  function validateDataPackagesTimestampOnce(uint256 dataPackagesTimestamp) public view virtual {\n    uint256 receivedTimestampSeconds = dataPackagesTimestamp / 1000;\n\n    (uint256 maxDataAheadSeconds, uint256 maxDataDelaySeconds) = getAllowedTimestampDiffsInSeconds();\n\n    uint256 blockTimestamp = getBlockTimestamp();\n\n    if (blockTimestamp < receivedTimestampSeconds) {\n      if ((receivedTimestampSeconds - blockTimestamp) > maxDataAheadSeconds) {\n        revert RedstoneDefaultsLib.TimestampFromTooLongFuture(receivedTimestampSeconds, blockTimestamp);\n      }\n    } else if ((blockTimestamp - receivedTimestampSeconds) > maxDataDelaySeconds) {\n      revert RedstoneDefaultsLib.TimestampIsTooOld(receivedTimestampSeconds, blockTimestamp);\n    }\n  }\n\n  /**\n   * @dev This function can be overridden, e.g. to use block.number instead of block.timestamp\n   * It can be useful in some L2 chains, as sometimes their different blocks can have the same timestamp\n   * @return timestamp Timestamp or Block number or any other number that can identify time in the context\n   * of the given blockchain\n   */\n  function getBlockTimestamp() public view virtual returns (uint256) {\n    return block.timestamp;\n  }\n\n  /**\n   * @dev Helpful function for getting values for timestamp validation\n   * @return  maxDataAheadSeconds Max allowed number of seconds ahead of block.timestamp\n   * @return  maxDataDelaySeconds Max allowed number of seconds for data delay\n   */\n  function getAllowedTimestampDiffsInSeconds() public view virtual returns (uint256 maxDataAheadSeconds, uint256 maxDataDelaySeconds) {\n    maxDataAheadSeconds = RedstoneDefaultsLib.DEFAULT_MAX_DATA_TIMESTAMP_AHEAD_SECONDS;\n    maxDataDelaySeconds = RedstoneDefaultsLib.DEFAULT_MAX_DATA_TIMESTAMP_DELAY_SECONDS;\n  }\n\n  /**\n   * @dev Reverts if proposed data packages are not newer than the ones used previously\n   * @param dataPackagesTimestamp Timestamp od the data packages (usually in milliseconds)\n   */\n  function _preventUpdateWithOlderDataPackages(uint256 dataPackagesTimestamp) internal view {\n    uint256 dataTimestampFromLatestUpdate = getDataTimestampFromLatestUpdate();\n\n    if (dataPackagesTimestamp <= dataTimestampFromLatestUpdate) {\n      revert DataTimestampShouldBeNewerThanBefore(\n        dataPackagesTimestamp,\n        dataTimestampFromLatestUpdate\n      );\n    }\n  }\n\n  /**\n   * @notice Returns data timestamp from the latest update\n   * @dev It's virtual, because its implementation can sometimes be different\n   * (e.g. SinglePriceFeedAdapterWithClearing)\n   * @return lastDataTimestamp Timestamp of the latest reported data packages\n   */\n  function getDataTimestampFromLatestUpdate() public view virtual returns (uint256 lastDataTimestamp) {\n    (lastDataTimestamp, ) = getTimestampsFromLatestUpdate();\n  }\n\n  /**\n   * @notice Returns block timestamp of the latest successful update\n   * @return blockTimestamp The block timestamp of the latest successful update\n   */\n  function getBlockTimestampFromLatestUpdate() public view returns (uint256 blockTimestamp) {\n    (, blockTimestamp) = getTimestampsFromLatestUpdate();\n  }\n\n  /**\n   * @dev Returns 2 timestamps packed into a single uint256 number\n   * @return packedTimestamps a single uin256 number with 2 timestamps\n   */\n  function getPackedTimestampsFromLatestUpdate() public view returns (uint256 packedTimestamps) {\n    assembly {\n      packedTimestamps := sload(LATEST_UPDATE_TIMESTAMPS_STORAGE_LOCATION)\n    }\n  }\n\n  /**\n   * @notice Returns timestamps of the latest successful update\n   * @return dataTimestamp timestamp (usually in milliseconds) from the signed data packages\n   * @return blockTimestamp timestamp of the block when the update has happened\n   */\n  function getTimestampsFromLatestUpdate() public view virtual returns (uint128 dataTimestamp, uint128 blockTimestamp) {\n    return _unpackTimestamps(getPackedTimestampsFromLatestUpdate());\n  }\n\n\n  /**\n   * @dev A helpful function to unpack 2 timestamps from one uin256 number\n   * @param packedTimestamps a single uin256 number\n   * @return dataTimestamp fetched from left 128 bits\n   * @return blockTimestamp fetched from right 128 bits\n   */\n  function _unpackTimestamps(uint256 packedTimestamps) internal pure returns (uint128 dataTimestamp, uint128 blockTimestamp) {\n    dataTimestamp = uint128(packedTimestamps >> 128); // left 128 bits\n    blockTimestamp = uint128(packedTimestamps); // right 128 bits\n  }\n\n\n  /**\n   * @dev Logic of saving timestamps of the current update\n   * By default, it stores packed timestamps in one storage slot (32 bytes)\n   * to minimise gas costs\n   * But it can be overridden (e.g. in SinglePriceFeedAdapter)\n   * @param   dataPackagesTimestamp  .\n   */\n  function _saveTimestampsOfCurrentUpdate(uint256 dataPackagesTimestamp) internal virtual {\n    uint256 blockTimestamp = getBlockTimestamp();\n\n    if (blockTimestamp > MAX_NUMBER_FOR_128_BITS) {\n      revert BlockTimestampIsTooBig(blockTimestamp);\n    }\n\n    if (dataPackagesTimestamp > MAX_NUMBER_FOR_128_BITS) {\n      revert DataTimestampIsTooBig(dataPackagesTimestamp);\n    }\n\n    assembly {\n      let timestamps := or(shl(BITS_COUNT_IN_16_BYTES, dataPackagesTimestamp), blockTimestamp)\n      sstore(LATEST_UPDATE_TIMESTAMPS_STORAGE_LOCATION, timestamps)\n    }\n  }\n\n  /**\n   * @notice Returns the latest properly reported value of the data feed\n   * @param dataFeedId The identifier of the requested data feed\n   * @return value The latest value of the given data feed\n   */\n  function getValueForDataFeed(bytes32 dataFeedId) public view returns (uint256) {\n    getDataFeedIndex(dataFeedId); // will revert if data feed id is not supported\n\n    // \"unsafe\" here means \"without validation\"\n    uint256 valueForDataFeed = getValueForDataFeedUnsafe(dataFeedId);\n\n    validateDataFeedValueOnRead(dataFeedId, valueForDataFeed);\n    return valueForDataFeed;\n  }\n\n  /**\n   * @notice Returns the latest properly reported values for several data feeds\n   * @param dataFeedIds The array of identifiers for the requested feeds\n   * @return values Values of the requested data feeds in the corresponding order\n   */\n  function getValuesForDataFeeds(bytes32[] memory dataFeedIds) public view returns (uint256[] memory) {\n    uint256[] memory values = getValuesForDataFeedsUnsafe(dataFeedIds);\n    for (uint256 i = 0; i < dataFeedIds.length;) {\n      bytes32 dataFeedId = dataFeedIds[i];\n      getDataFeedIndex(dataFeedId); // will revert if data feed id is not supported\n      validateDataFeedValueOnRead(dataFeedId, values[i]);\n      unchecked { i++; } // reduces gas costs\n    }\n    return values;\n  }\n\n\n\n  /**\n   * @dev Reverts if proposed value for the proposed data feed id is invalid\n   * Is called on every NOT *unsafe method which reads dataFeed\n   * By default, it just checks if the value is not equal to 0, but it can be extended\n   * @param dataFeedId The data feed identifier\n   * @param valueForDataFeed Proposed value for the data feed\n   */\n  function validateDataFeedValueOnRead(bytes32 dataFeedId, uint256 valueForDataFeed) public view virtual {\n    if (valueForDataFeed == 0) {\n      revert DataFeedValueCannotBeZero(dataFeedId);\n    }\n  }\n\n  /**\n   * @dev Reverts if proposed value for the proposed data feed id is invalid\n   * Is called on every NOT *unsafe method which writes dataFeed\n   * By default, it does nothing\n   * @param dataFeedId The data feed identifier\n   * @param valueForDataFeed Proposed value for the data feed\n   */\n  function validateDataFeedValueOnWrite(bytes32 dataFeedId, uint256 valueForDataFeed) public view virtual {\n    if (valueForDataFeed == 0) {\n      revert DataFeedValueCannotBeZero(dataFeedId);\n    }\n  }\n\n  /**\n   * @dev [HIGH RISK] Returns the latest value for a given data feed without validation\n   * Important! Using this function instead of `getValueForDataFeed` may cause\n   * significant risk for your smart contracts\n   * @param dataFeedId The data feed identifier\n   * @return dataFeedValue Unvalidated value of the latest successful update\n   */\n  function getValueForDataFeedUnsafe(bytes32 dataFeedId) public view virtual returns (uint256);\n\n  /**\n   * @notice [HIGH RISK] Returns the latest properly reported values for several data feeds without validation\n   * Important! Using this function instead of `getValuesForDataFeeds` may cause\n   * significant risk for your smart contracts\n   * @param requestedDataFeedIds The array of identifiers for the requested feeds\n   * @return values Unvalidated values of the requested data feeds in the corresponding order\n   */\n  function getValuesForDataFeedsUnsafe(bytes32[] memory requestedDataFeedIds) public view virtual returns (uint256[] memory values) {\n    values = new uint256[](requestedDataFeedIds.length);\n    for (uint256 i = 0; i < requestedDataFeedIds.length;) {\n      values[i] = getValueForDataFeedUnsafe(requestedDataFeedIds[i]);\n      unchecked { i++; } // reduces gas costs\n    }\n    return values;\n  }\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/MergedPriceFeedAdapterCommon.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.17;\nimport {IRedstoneAdapter} from \"../core/IRedstoneAdapter.sol\";\n\nabstract contract MergedPriceFeedAdapterCommon {\n  event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);\n\n  error CannotUpdateMoreThanOneDataFeed();\n\n  function getPriceFeedAdapter() public view virtual returns (IRedstoneAdapter) {\n    return IRedstoneAdapter(address(this));\n  }\n\n  function aggregator() public view virtual returns (address) {\n    return address(getPriceFeedAdapter());\n  }\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/PriceFeedBase.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\npragma solidity ^0.8.17;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {IRedstoneAdapter} from \"../core/IRedstoneAdapter.sol\";\nimport {IPriceFeed} from \"./interfaces/IPriceFeed.sol\";\n\n/**\n * @title Main logic of the price feed contract\n * @author The Redstone Oracles team\n * @dev Implementation of common functions for the PriceFeed contract\n * that queries data from the specified PriceFeedAdapter\n *\n * It can be used by projects that have already implemented with Chainlink-like\n * price feeds and would like to minimise changes in their existing codebase.\n *\n * If you are flexible, it's much better (and cheaper in terms of gas) to query\n * the PriceFeedAdapter contract directly\n */\nabstract contract PriceFeedBase is IPriceFeed, Initializable {\n  uint256 internal constant INT256_MAX = uint256(type(int256).max);\n\n  error UnsafeUintToIntConversion(uint256 value);\n\n  /**\n   * @dev Helpful function for upgradable contracts\n   */\n  function initialize() public virtual initializer {\n    // We don't have storage variables, but we keep this function\n    // Because it is used for contract setup in upgradable contracts\n  }\n\n  /**\n   * @notice Returns data feed identifier for the PriceFeed contract\n   * @return dataFeedId The identifier of the data feed\n   */\n  function getDataFeedId() public view virtual returns (bytes32);\n\n  /**\n   * @notice Returns the address of the price feed adapter\n   * @return address The address of the price feed adapter\n   */\n  function getPriceFeedAdapter() public view virtual returns (IRedstoneAdapter);\n\n\n  /**\n   * @notice Returns the number of decimals for the price feed\n   * @dev By default, RedStone uses 8 decimals for data feeds\n   * @return decimals The number of decimals in the price feed values\n   */\n  function decimals() public virtual pure override returns (uint8) {\n    return 8;\n  }\n\n\n  /**\n   * @notice Description of the Price Feed\n   * @return description\n   */\n  function description() public view virtual override returns (string memory) {\n    return \"Redstone Price Feed\";\n  }\n\n  /**\n   * @notice Version of the Price Feed\n   * @dev Currently it has no specific motivation and was added\n   * only to be compatible with the Chainlink interface\n   * @return version\n   */\n  function version() public virtual pure override returns (uint256) {\n    return 1;\n  }\n\n\n  /**\n   * @notice Returns details of the latest successful update round\n   * @dev It uses few helpful functions to abstract logic of getting\n   * latest round id and value\n   * @return roundId The number of the latest round\n   * @return answer The latest reported value\n   * @return startedAt Block timestamp when the latest successful round started\n   * @return updatedAt Block timestamp of the latest successful round\n   * @return answeredInRound The number of the latest round\n   */\n  function latestRoundData()\n    public\n    view\n    override\n    virtual\n    returns (\n      uint80 roundId,\n      int256 answer,\n      uint256 startedAt,\n      uint256 updatedAt,\n      uint80 answeredInRound\n    )\n  {\n    roundId = latestRound();\n    answer = latestAnswer();\n\n    uint256 blockTimestamp = getPriceFeedAdapter().getBlockTimestampFromLatestUpdate();\n\n    // These values are equal after chainlink’s OCR update\n    startedAt = blockTimestamp;\n    updatedAt = blockTimestamp;\n\n    // We want to be compatible with Chainlink's interface\n    // And in our case the roundId is always equal to answeredInRound\n    answeredInRound = roundId;\n  }\n\n  /**\n   * @notice Old Chainlink function for getting the latest successfully reported value\n   * @return latestAnswer The latest successfully reported value\n   */\n  function latestAnswer() public virtual view returns (int256) {\n    bytes32 dataFeedId = getDataFeedId();\n\n    uint256 uintAnswer = getPriceFeedAdapter().getValueForDataFeed(dataFeedId);\n\n    if (uintAnswer > INT256_MAX) {\n      revert UnsafeUintToIntConversion(uintAnswer);\n    }\n\n    return int256(uintAnswer);\n  }\n\n  /**\n   * @notice Old Chainlink function for getting the number of latest round\n   * @return latestRound The number of the latest update round\n   */\n  function latestRound() public view virtual returns (uint80);\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/PriceFeedsAdapterBase.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport {Initializable} from \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport {RedstoneAdapterBase} from \"../core/RedstoneAdapterBase.sol\";\n\n/**\n * @title Common logic of the price feeds adapter contracts\n * @author The Redstone Oracles team\n */\nabstract contract PriceFeedsAdapterBase is RedstoneAdapterBase, Initializable {\n\n  /**\n   * @dev Helpful function for upgradable contracts\n   */\n  function initialize() public virtual initializer {\n    // We don't have storage variables, but we keep this function\n    // Because it is used for contract setup in upgradable contracts\n  }\n\n  /**\n   * @dev This function is virtual and may contain additional logic in the derived contract\n   * E.g. it can check if the updating conditions are met (e.g. if at least one\n   * value is deviated enough)\n   * @param dataFeedIdsArray Array of all data feeds identifiers\n   * @param values The reported values that are validated and reported\n   */\n  function _validateAndUpdateDataFeedsValues(\n    bytes32[] memory dataFeedIdsArray,\n    uint256[] memory values\n  ) internal virtual override {\n    for (uint256 i = 0; i < dataFeedIdsArray.length;) {\n      _validateAndUpdateDataFeedValue(dataFeedIdsArray[i], values[i]);\n      unchecked { i++; } // reduces gas costs\n    }\n  }\n\n  /**\n   * @dev Helpful virtual function for handling value validation and saving in derived\n   * Price Feed Adapters contracts\n   * @param dataFeedId The data feed identifier\n   * @param dataFeedValue Proposed value for the data feed\n   */\n  function _validateAndUpdateDataFeedValue(bytes32 dataFeedId, uint256 dataFeedValue) internal virtual;\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/data-services/MergedPriceFeedAdapterWithRoundsPrimaryProd.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport {MergedPriceFeedAdapterWithRounds} from \"../with-rounds/MergedPriceFeedAdapterWithRounds.sol\";\n\nabstract contract MergedPriceFeedAdapterWithRoundsPrimaryProd is MergedPriceFeedAdapterWithRounds {\n  function getUniqueSignersThreshold() public view virtual override returns (uint8) {\n    return 3;\n  }\n\n  function getAuthorisedSignerIndex(\n    address signerAddress\n  ) public view virtual override returns (uint8) {\n    if (signerAddress == 0x8BB8F32Df04c8b654987DAaeD53D6B6091e3B774) { return 0; }\n    else if (signerAddress == 0xdEB22f54738d54976C4c0fe5ce6d408E40d88499) { return 1; }\n    else if (signerAddress == 0x51Ce04Be4b3E32572C4Ec9135221d0691Ba7d202) { return 2; }\n    else if (signerAddress == 0xDD682daEC5A90dD295d14DA4b0bec9281017b5bE) { return 3; }\n    else if (signerAddress == 0x9c5AE89C4Af6aA32cE58588DBaF90d18a855B6de) { return 4; }\n    else {\n      revert SignerNotAuthorised(signerAddress);\n    }\n  }\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/interfaces/IPriceFeed.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport {AggregatorV3Interface} from \"@chainlink/contracts/src/v0.8/shared/interfaces/AggregatorV3Interface.sol\";\nimport {IPriceFeedLegacy} from \"./IPriceFeedLegacy.sol\";\n\n/**\n * @title Complete price feed interface\n * @author The Redstone Oracles team\n * @dev All required public functions that must be implemented\n * by each Redstone PriceFeed contract\n */\ninterface IPriceFeed is IPriceFeedLegacy, AggregatorV3Interface {\n  /**\n   * @notice Returns data feed identifier for the PriceFeed contract\n   * @return dataFeedId The identifier of the data feed\n   */\n  function getDataFeedId() external view returns (bytes32);\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/interfaces/IPriceFeedLegacy.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\n/**\n * @title Interface with the old Chainlink Price Feed functions\n * @author The Redstone Oracles team\n * @dev There are some projects (e.g. gmx-contracts) that still\n * rely on some legacy functions\n */\ninterface IPriceFeedLegacy {\n  /**\n   * @notice Old Chainlink function for getting the number of latest round\n   * @return latestRound The number of the latest update round\n   */\n  function latestRound() external view returns (uint80);\n\n  \n  /**\n   * @notice Old Chainlink function for getting the latest successfully reported value\n   * @return latestAnswer The latest successfully reported value\n   */\n  function latestAnswer() external view returns (int256);\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/with-rounds/MergedPriceFeedAdapterWithRounds.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport {PriceFeedBase, PriceFeedWithRounds} from \"./PriceFeedWithRounds.sol\";\nimport {PriceFeedsAdapterBase, PriceFeedsAdapterWithRounds} from \"./PriceFeedsAdapterWithRounds.sol\";\nimport {IRedstoneAdapter} from \"../../core/IRedstoneAdapter.sol\";\nimport {MergedPriceFeedAdapterCommon} from \"../MergedPriceFeedAdapterCommon.sol\";\nimport {SafeCast} from \"@openzeppelin/contracts/utils/math/SafeCast.sol\";\n\nabstract contract MergedPriceFeedAdapterWithRounds is\n  MergedPriceFeedAdapterCommon,\n  PriceFeedWithRounds,\n  PriceFeedsAdapterWithRounds\n{\n  function initialize() public virtual override(PriceFeedBase, PriceFeedsAdapterBase) initializer {\n    // We don't have storage variables, but we keep this function\n    // Because it is used for contract setup in upgradable contracts\n  }\n\n  function getPriceFeedAdapter() public view virtual override(MergedPriceFeedAdapterCommon, PriceFeedBase) returns (IRedstoneAdapter) {\n    return super.getPriceFeedAdapter();\n  }\n\n  function getDataFeedIds() public view virtual override returns (bytes32[] memory dataFeedIds) {\n    dataFeedIds = new bytes32[](1);\n    dataFeedIds[0] = getDataFeedId();\n  }\n\n  function getDataFeedIndex(bytes32 dataFeedId) public view virtual override returns (uint256) {\n    if (dataFeedId == getDataFeedId()) {\n      return 0;\n    } else {\n      revert DataFeedIdNotFound(dataFeedId);\n    }\n  }\n\n  function _emitEventAfterSingleValueUpdate(uint256 newValue) internal virtual {\n    emit AnswerUpdated(SafeCast.toInt256(newValue), getLatestRoundId(), block.timestamp);\n  }\n\n  function _validateAndUpdateDataFeedsValues(\n    bytes32[] memory dataFeedIdsArray,\n    uint256[] memory values\n  ) internal virtual override {\n    if (dataFeedIdsArray.length != 1 || values.length != 1) {\n      revert CannotUpdateMoreThanOneDataFeed();\n    }\n    PriceFeedsAdapterWithRounds._validateAndUpdateDataFeedsValues(dataFeedIdsArray, values);\n    _emitEventAfterSingleValueUpdate(values[0]);\n  }\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/with-rounds/PriceFeedWithRounds.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport {PriceFeedsAdapterWithRounds} from \"./PriceFeedsAdapterWithRounds.sol\";\nimport {PriceFeedBase} from \"../PriceFeedBase.sol\";\n\n/**\n * @title Implementation of a price feed contract with rounds support\n * @author The Redstone Oracles team\n * @dev This contract is abstract. The actual contract instance\n * must implement the following functions:\n * - getDataFeedId\n * - getPriceFeedAdapter\n */\nabstract contract PriceFeedWithRounds is PriceFeedBase {\n  uint256 internal constant UINT80_MAX = uint256(type(uint80).max);\n\n  error UnsafeUint256ToUint80Conversion(uint256 value);\n\n  function getPriceFeedAdapterWithRounds() public view returns(PriceFeedsAdapterWithRounds) {\n    return PriceFeedsAdapterWithRounds(address(getPriceFeedAdapter()));\n  }\n\n  /**\n   * @notice Old Chainlink function for getting the number of latest round\n   * @return latestRound The number of the latest successful round\n   */\n  function latestRound() public view override returns (uint80) {\n    uint256 latestRoundUint256 = getPriceFeedAdapterWithRounds().getLatestRoundId();\n\n    if (latestRoundUint256 > UINT80_MAX) {\n      revert UnsafeUint256ToUint80Conversion(latestRoundUint256);\n    }\n\n    return uint80(latestRoundUint256);\n  }\n\n  /**\n   * @notice Returns details for the given round\n   * @param roundId Requested round identifier\n   */\n  function getRoundData(uint80 requestedRoundId) public view override returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) {\n    (uint256 dataFeedValue, uint128 roundDataTimestamp, uint128 roundBlockTimestamp) = getPriceFeedAdapterWithRounds().getRoundDataFromAdapter(\n      getDataFeedId(),\n      requestedRoundId\n    );\n    roundId = requestedRoundId;\n\n    if (dataFeedValue > INT256_MAX) {\n      revert UnsafeUintToIntConversion(dataFeedValue);\n    }\n\n    answer = int256(dataFeedValue);\n    startedAt = roundDataTimestamp / 1000; // convert to seconds\n    updatedAt = roundBlockTimestamp;\n\n    // We want to be compatible with Chainlink's interface\n    // And in our case the roundId is always equal to answeredInRound\n    answeredInRound = requestedRoundId;\n  }\n}\n"},{"file_path":"@redstone-finance/evm-adapters/contracts/price-feeds/with-rounds/PriceFeedsAdapterWithRounds.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport {PriceFeedsAdapterBase} from \"../PriceFeedsAdapterBase.sol\";\n\n/**\n * @title Price feeds adapter contract with rounds support\n * @author The Redstone Oracles team\n * @dev This contract is abstract. The actual contract instance\n * must implement the following functions:\n * - getDataFeedIds\n * - getUniqueSignersThreshold\n * - getAuthorisedSignerIndex\n *\n * We also recommend to override `getDataFeedIndex` function with hardcoded\n * values, as it can significantly reduce gas usage\n */\nabstract contract PriceFeedsAdapterWithRounds is PriceFeedsAdapterBase {\n  bytes32 constant VALUES_MAPPING_STORAGE_LOCATION = 0x4dd0c77efa6f6d590c97573d8c70b714546e7311202ff7c11c484cc841d91bfc; // keccak256(\"RedStone.oracleValuesMapping\");\n  bytes32 constant ROUND_TIMESTAMPS_MAPPING_STORAGE_LOCATION = 0x207e00944d909d1224f0c253d58489121d736649f8393199f55eecf4f0cf3eb0; // keccak256(\"RedStone.roundTimestampMapping\");\n  bytes32 constant LATEST_ROUND_ID_STORAGE_LOCATION = 0xc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc4083263938; // keccak256(\"RedStone.latestRoundId\");\n\n  error RoundNotFound(uint256 roundId);\n\n  /**\n   * @dev Saved new round data to the storage\n   * @param dataFeedIdsArray Array of all data feeds identifiers\n   * @param values The reported values that are validated and reported\n   */\n  function _validateAndUpdateDataFeedsValues(\n    bytes32[] memory dataFeedIdsArray,\n    uint256[] memory values\n  ) internal virtual override {\n    _incrementLatestRoundId();\n    _updatePackedTimestampsForLatestRound();\n\n    for (uint256 i = 0; i < dataFeedIdsArray.length;) {\n      _validateAndUpdateDataFeedValue(dataFeedIdsArray[i], values[i]);\n      unchecked { i++; } // reduces gas costs\n    }\n  }\n\n  /**\n   * @dev Helpful virtual function for handling value validation and updating\n   * @param dataFeedId The data feed identifier\n   * @param dataFeedValue Proposed value for the data feed\n   */\n  function _validateAndUpdateDataFeedValue(bytes32 dataFeedId, uint256 dataFeedValue) internal virtual override {\n    validateDataFeedValueOnWrite(dataFeedId, dataFeedValue);\n    bytes32 locationInStorage = _getValueLocationInStorage(dataFeedId, getLatestRoundId());\n    assembly {\n      sstore(locationInStorage, dataFeedValue)\n    }\n  }\n\n  /**\n   * @dev [HIGH RISK] Returns the value for a given data feed from the latest round\n   * without validation. Important! Using this function instead of `getValueForDataFeed`\n   * may cause significant risk for your smart contracts\n   * @param dataFeedId The data feed identifier\n   * @return dataFeedValue Unvalidated value of the latest successful update\n   */\n  function getValueForDataFeedUnsafe(bytes32 dataFeedId) public view override returns (uint256 dataFeedValue) {\n    return getValueForDataFeedAndRound(dataFeedId, getLatestRoundId());\n  }\n\n  /**\n   * @dev [HIGH RISK] Returns value for the requested data feed from the given round\n   * without validation.\n   * @param dataFeedId The data feed identifier\n   * @param roundId The number of the requested round\n   * @return dataFeedValue value for the requested data feed from the given round\n   */\n  function getValueForDataFeedAndRound(bytes32 dataFeedId, uint256 roundId) public view returns (uint256 dataFeedValue) {\n    bytes32 locationInStorage = _getValueLocationInStorage(dataFeedId, roundId);\n    assembly {\n      dataFeedValue := sload(locationInStorage)\n    }\n  }\n\n\n  /**\n   * @notice Returns data from the latest successful round\n   * @return latestRoundId\n   * @return latestRoundDataTimestamp\n   * @return latestRoundBlockTimestamp\n   */\n  function getLatestRoundParams() public view returns ( uint256 latestRoundId, uint128 latestRoundDataTimestamp, uint128 latestRoundBlockTimestamp) {\n    latestRoundId = getLatestRoundId();\n    uint256 packedRoundTimestamps = getPackedTimestampsForRound(latestRoundId);\n    (latestRoundDataTimestamp, latestRoundBlockTimestamp) = _unpackTimestamps(\n      packedRoundTimestamps\n    );\n  }\n\n\n  /**\n   * @notice Returns details for the given round and data feed\n   * @param dataFeedId Requested data feed\n   * @param roundId Requested round identifier\n   * @return dataFeedValue\n   * @return roundDataTimestamp\n   * @return roundBlockTimestamp\n   */\n  function getRoundDataFromAdapter(bytes32 dataFeedId, uint256 roundId) public view returns (uint256 dataFeedValue, uint128 roundDataTimestamp, uint128 roundBlockTimestamp) {\n    if (roundId > getLatestRoundId() || roundId == 0) {\n      revert RoundNotFound(roundId);\n    }\n\n    dataFeedValue = getValueForDataFeedAndRound(dataFeedId, roundId);\n    validateDataFeedValueOnRead(dataFeedId, dataFeedValue);\n    uint256 packedRoundTimestamps = getPackedTimestampsForRound(roundId);\n    (roundDataTimestamp, roundBlockTimestamp) = _unpackTimestamps(packedRoundTimestamps);\n  }\n\n\n  /**\n   * @dev Helpful function for getting storage location for requested value\n   * @param dataFeedId Requested data feed identifier\n   * @param roundId Requested round number\n   * @return locationInStorage\n   */\n  function _getValueLocationInStorage(bytes32 dataFeedId, uint256 roundId) private pure returns (bytes32) {\n    return keccak256(abi.encode(dataFeedId, roundId, VALUES_MAPPING_STORAGE_LOCATION));\n  }\n\n\n  /**\n   * @dev Helpful function for getting storage location for round timestamps\n   * @param roundId Requested round number\n   * @return locationInStorage\n   */\n  function _getRoundTimestampsLocationInStorage(uint256 roundId) private pure returns (bytes32) {\n    return keccak256(abi.encode(roundId, ROUND_TIMESTAMPS_MAPPING_STORAGE_LOCATION));\n  }\n\n\n  /**\n   * @notice Returns latest successful round number\n   * @return latestRoundId\n   */\n  function getLatestRoundId() public view returns (uint256 latestRoundId) {\n    assembly {\n      latestRoundId := sload(LATEST_ROUND_ID_STORAGE_LOCATION)\n    }\n  }\n\n  /**\n   * @dev Helpful function for incrementing the latest round number by 1 in\n   * the contract storage\n   */\n  function _incrementLatestRoundId() private {\n    uint256 latestRoundId = getLatestRoundId();\n    assembly {\n      sstore(LATEST_ROUND_ID_STORAGE_LOCATION, add(latestRoundId, 1))\n    }\n  }\n\n  /**\n   * @notice Returns timestamps related to the given round packed into one number\n   * @param roundId Requested round number\n   * @return roundTimestamps\n   */\n  function getPackedTimestampsForRound(uint256 roundId) public view returns (uint256 roundTimestamps) {\n    bytes32 locationInStorage = _getRoundTimestampsLocationInStorage(roundId);\n    assembly {\n      roundTimestamps := sload(locationInStorage)\n    }\n  }\n\n\n  /**\n   * @dev Saves packed timestamps (data and block.timestamp) in the contract storage\n   */\n  function _updatePackedTimestampsForLatestRound() private {\n    uint256 packedTimestamps = getPackedTimestampsFromLatestUpdate();\n    uint256 latestRoundId = getLatestRoundId();\n    bytes32 locationInStorage = _getRoundTimestampsLocationInStorage(latestRoundId);\n    assembly {\n      sstore(locationInStorage, packedTimestamps)\n    }\n  }\n}\n"},{"file_path":"@redstone-finance/evm-connector/contracts/core/CalldataExtractor.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport \"./RedstoneConstants.sol\";\n\n/**\n * @title The base contract with the main logic of data extraction from calldata\n * @author The Redstone Oracles team\n * @dev This contract was created to reuse the same logic in the RedstoneConsumerBase\n * and the ProxyConnector contracts\n */\ncontract CalldataExtractor is RedstoneConstants {\n\n  error DataPackageTimestampMustNotBeZero();\n  error DataPackageTimestampsMustBeEqual();\n  error RedstonePayloadMustHaveAtLeastOneDataPackage();\n  error TooLargeValueByteSize(uint256 valueByteSize);\n\n  function extractTimestampsAndAssertAllAreEqual() public pure returns (uint256 extractedTimestamp) {\n    uint256 calldataNegativeOffset = _extractByteSizeOfUnsignedMetadata();\n    uint256 dataPackagesCount;\n    (dataPackagesCount, calldataNegativeOffset) = _extractDataPackagesCountFromCalldata(calldataNegativeOffset);\n\n    if (dataPackagesCount == 0) {\n      revert RedstonePayloadMustHaveAtLeastOneDataPackage();\n    }\n\n    for (uint256 dataPackageIndex = 0; dataPackageIndex < dataPackagesCount; dataPackageIndex++) {\n      uint256 dataPackageByteSize = _getDataPackageByteSize(calldataNegativeOffset);\n\n      // Extracting timestamp for the current data package\n      uint48 dataPackageTimestamp; // uint48, because timestamp uses 6 bytes\n      uint256 timestampNegativeOffset = (calldataNegativeOffset + TIMESTAMP_NEGATIVE_OFFSET_IN_DATA_PACKAGE_WITH_STANDARD_SLOT_BS);\n      uint256 timestampOffset = msg.data.length - timestampNegativeOffset;\n      assembly {\n        dataPackageTimestamp := calldataload(timestampOffset)\n      }\n\n      if (dataPackageTimestamp == 0) {\n        revert DataPackageTimestampMustNotBeZero();\n      }\n\n      if (extractedTimestamp == 0) {\n        extractedTimestamp = dataPackageTimestamp;\n      } else if (dataPackageTimestamp != extractedTimestamp) {\n        revert DataPackageTimestampsMustBeEqual();\n      }\n\n      calldataNegativeOffset += dataPackageByteSize;\n    }\n  }\n\n  function _getDataPackageByteSize(uint256 calldataNegativeOffset) internal pure returns (uint256) {\n    (\n      uint256 dataPointsCount,\n      uint256 eachDataPointValueByteSize\n    ) = _extractDataPointsDetailsForDataPackage(calldataNegativeOffset);\n\n    return\n      dataPointsCount *\n      (DATA_POINT_SYMBOL_BS + eachDataPointValueByteSize) +\n      DATA_PACKAGE_WITHOUT_DATA_POINTS_BS;\n  }\n\n  function _extractByteSizeOfUnsignedMetadata() internal pure returns (uint256) {\n    // Checking if the calldata ends with the RedStone marker\n    bool hasValidRedstoneMarker;\n    assembly {\n      let calldataLast32Bytes := calldataload(sub(calldatasize(), STANDARD_SLOT_BS))\n      hasValidRedstoneMarker := eq(\n        REDSTONE_MARKER_MASK,\n        and(calldataLast32Bytes, REDSTONE_MARKER_MASK)\n      )\n    }\n    if (!hasValidRedstoneMarker) {\n      revert CalldataMustHaveValidPayload();\n    }\n\n    // Using uint24, because unsigned metadata byte size number has 3 bytes\n    uint24 unsignedMetadataByteSize;\n    if (REDSTONE_MARKER_BS_PLUS_STANDARD_SLOT_BS > msg.data.length) {\n      revert CalldataOverOrUnderFlow();\n    }\n    assembly {\n      unsignedMetadataByteSize := calldataload(\n        sub(calldatasize(), REDSTONE_MARKER_BS_PLUS_STANDARD_SLOT_BS)\n      )\n    }\n    uint256 calldataNegativeOffset = unsignedMetadataByteSize\n      + UNSIGNED_METADATA_BYTE_SIZE_BS\n      + REDSTONE_MARKER_BS;\n    if (calldataNegativeOffset + DATA_PACKAGES_COUNT_BS > msg.data.length) {\n      revert IncorrectUnsignedMetadataSize();\n    }\n    return calldataNegativeOffset;\n  }\n\n  // We return uint16, because unsigned metadata byte size number has 2 bytes\n  function _extractDataPackagesCountFromCalldata(uint256 calldataNegativeOffset)\n    internal\n    pure\n    returns (uint16 dataPackagesCount, uint256 nextCalldataNegativeOffset)\n  {\n    uint256 calldataNegativeOffsetWithStandardSlot = calldataNegativeOffset + STANDARD_SLOT_BS;\n    if (calldataNegativeOffsetWithStandardSlot > msg.data.length) {\n      revert CalldataOverOrUnderFlow();\n    }\n    assembly {\n      dataPackagesCount := calldataload(\n        sub(calldatasize(), calldataNegativeOffsetWithStandardSlot)\n      )\n    }\n    return (dataPackagesCount, calldataNegativeOffset + DATA_PACKAGES_COUNT_BS);\n  }\n\n  function _extractDataPointValueAndDataFeedId(\n    uint256 dataPointNegativeOffset,\n    uint256 dataPointValueByteSize\n  ) internal pure virtual returns (bytes32 dataPointDataFeedId, uint256 dataPointValue) {\n    uint256 dataPointCalldataOffset = msg.data.length - dataPointNegativeOffset;\n    assembly {\n      dataPointDataFeedId := calldataload(dataPointCalldataOffset)\n      dataPointValue := calldataload(add(dataPointCalldataOffset, DATA_POINT_SYMBOL_BS))\n    }\n    if (dataPointValueByteSize >= 33) {\n      revert TooLargeValueByteSize(dataPointValueByteSize);\n    }\n    unchecked {\n      dataPointValue = dataPointValue >> (32 - dataPointValueByteSize) * 8; \n    }\n  }\n\n  function _extractDataPointsDetailsForDataPackage(uint256 calldataNegativeOffsetForDataPackage)\n    internal\n    pure\n    returns (uint256 dataPointsCount, uint256 eachDataPointValueByteSize)\n  {\n    // Using uint24, because data points count byte size number has 3 bytes\n    uint24 dataPointsCount_;\n\n    // Using uint32, because data point value byte size has 4 bytes\n    uint32 eachDataPointValueByteSize_;\n\n    // Extract data points count\n    uint256 calldataOffset = msg.data.length - (calldataNegativeOffsetForDataPackage + SIG_BS + STANDARD_SLOT_BS);\n    assembly {\n      dataPointsCount_ := calldataload(calldataOffset)\n    }\n\n    // Extract each data point value size\n    calldataOffset = calldataOffset - DATA_POINTS_COUNT_BS;\n    assembly {\n      eachDataPointValueByteSize_ := calldataload(calldataOffset)\n    }\n\n    // Prepare returned values\n    dataPointsCount = dataPointsCount_;\n    eachDataPointValueByteSize = eachDataPointValueByteSize_;\n  }\n}\n"},{"file_path":"@redstone-finance/evm-connector/contracts/core/RedstoneConstants.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\n/**\n * @title The base contract with helpful constants\n * @author The Redstone Oracles team\n * @dev It mainly contains redstone-related values, which improve readability\n * of other contracts (e.g. CalldataExtractor and RedstoneConsumerBase)\n */\ncontract RedstoneConstants {\n  // === Abbreviations ===\n  // BS - Bytes size\n  // PTR - Pointer (memory location)\n  // SIG - Signature\n\n  // Solidity and YUL constants\n  uint256 internal constant STANDARD_SLOT_BS = 32;\n  uint256 internal constant FREE_MEMORY_PTR = 0x40;\n  uint256 internal constant BYTES_ARR_LEN_VAR_BS = 32;\n  uint256 internal constant REVERT_MSG_OFFSET = 68; // Revert message structure described here: https://ethereum.stackexchange.com/a/66173/106364\n  uint256 internal constant STRING_ERR_MESSAGE_MASK = 0x08c379a000000000000000000000000000000000000000000000000000000000;\n\n  // RedStone protocol consts\n  uint256 internal constant SIG_BS = 65;\n  uint256 internal constant TIMESTAMP_BS = 6;\n  uint256 internal constant DATA_PACKAGES_COUNT_BS = 2;\n  uint256 internal constant DATA_POINTS_COUNT_BS = 3;\n  uint256 internal constant DATA_POINT_VALUE_BYTE_SIZE_BS = 4;\n  uint256 internal constant DATA_POINT_SYMBOL_BS = 32;\n  uint256 internal constant UNSIGNED_METADATA_BYTE_SIZE_BS = 3;\n  uint256 internal constant REDSTONE_MARKER_BS = 9; // byte size of 0x000002ed57011e0000\n  uint256 internal constant REDSTONE_MARKER_MASK = 0x0000000000000000000000000000000000000000000000000002ed57011e0000;\n\n  // Derived values (based on consts)\n  uint256 internal constant TIMESTAMP_NEGATIVE_OFFSET_IN_DATA_PACKAGE_WITH_STANDARD_SLOT_BS = 104; // SIG_BS + DATA_POINTS_COUNT_BS + DATA_POINT_VALUE_BYTE_SIZE_BS + STANDARD_SLOT_BS\n  uint256 internal constant DATA_PACKAGE_WITHOUT_DATA_POINTS_BS = 78; // DATA_POINT_VALUE_BYTE_SIZE_BS + TIMESTAMP_BS + DATA_POINTS_COUNT_BS + SIG_BS\n  uint256 internal constant DATA_PACKAGE_WITHOUT_DATA_POINTS_AND_SIG_BS = 13; // DATA_POINT_VALUE_BYTE_SIZE_BS + TIMESTAMP_BS + DATA_POINTS_COUNT_BS\n  uint256 internal constant REDSTONE_MARKER_BS_PLUS_STANDARD_SLOT_BS = 41; // REDSTONE_MARKER_BS + STANDARD_SLOT_BS\n\n  // Error messages\n  error CalldataOverOrUnderFlow();\n  error IncorrectUnsignedMetadataSize();\n  error InsufficientNumberOfUniqueSigners(uint256 receivedSignersCount, uint256 requiredSignersCount);\n  error EachSignerMustProvideTheSameValue();\n  error EmptyCalldataPointersArr();\n  error InvalidCalldataPointer();\n  error CalldataMustHaveValidPayload();\n  error SignerNotAuthorised(address receivedSigner);\n  error DataTimestampCannotBeZero();\n  error TimestampsMustBeEqual();\n}\n"},{"file_path":"@redstone-finance/evm-connector/contracts/core/RedstoneConsumerBase.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport \"./RedstoneConstants.sol\";\nimport \"./RedstoneDefaultsLib.sol\";\nimport \"./CalldataExtractor.sol\";\nimport \"../libs/BitmapLib.sol\";\nimport \"../libs/SignatureLib.sol\";\n\n/**\n * @title The base contract with the main Redstone logic\n * @author The Redstone Oracles team\n * @dev Do not use this contract directly in consumer contracts, take a\n * look at `RedstoneConsumerNumericBase` and `RedstoneConsumerBytesBase` instead\n */\nabstract contract RedstoneConsumerBase is CalldataExtractor {\n\n  error GetDataServiceIdNotImplemented();\n\n  /* ========== VIRTUAL FUNCTIONS (MAY BE OVERRIDDEN IN CHILD CONTRACTS) ========== */\n\n  /**\n   * @dev This function must be implemented by the child consumer contract.\n   * It should return dataServiceId which DataServiceWrapper will use if not provided explicitly .\n   * If not overridden, value will always have to be provided explicitly in DataServiceWrapper.\n   * @return dataServiceId being consumed by contract\n   */\n  function getDataServiceId() public view virtual returns (string memory) {\n    revert GetDataServiceIdNotImplemented();\n  }\n\n  /**\n   * @dev This function must be implemented by the child consumer contract.\n   * It should return a unique index for a given signer address if the signer\n   * is authorised, otherwise it should revert\n   * @param receivedSigner The address of a signer, recovered from ECDSA signature\n   * @return Unique index for a signer in the range [0..255]\n   */\n  function getAuthorisedSignerIndex(address receivedSigner) public view virtual returns (uint8);\n\n  /**\n   * @dev This function may be overridden by the child consumer contract.\n   * It should validate the timestamp against the current time (block.timestamp)\n   * It should revert with a helpful message if the timestamp is not valid\n   * @param receivedTimestampMilliseconds Timestamp extracted from calldata\n   */\n  function validateTimestamp(uint256 receivedTimestampMilliseconds) public view virtual {\n    RedstoneDefaultsLib.validateTimestamp(receivedTimestampMilliseconds);\n  }\n\n  /**\n   * @dev This function must be implemented by the child consumer contract.\n   * @return The minimum required value of unique authorised signers\n   */\n  function getUniqueSignersThreshold() public view virtual returns (uint8);\n\n  /**\n   * @dev This function may be overridden by the child consumer contract.\n   * It should aggregate values from different signers to a single uint value.\n   * By default, it calculates the median value\n   * @param values An array of uint256 values from different signers\n   * @return Result of the aggregation in the form of a single number\n   */\n  function aggregateValues(uint256[] memory values) public view virtual returns (uint256) {\n    return RedstoneDefaultsLib.aggregateValues(values);\n  }\n\n  /* ========== FUNCTIONS WITH IMPLEMENTATION (CAN NOT BE OVERRIDDEN) ========== */\n\n  /**\n   * @dev This is an internal helpful function for secure extraction oracle values\n   * from the tx calldata. Security is achieved by signatures verification, timestamp\n   * validation, and aggregating values from different authorised signers into a\n   * single numeric value. If any of the required conditions (e.g. packages with different \n   * timestamps or insufficient number of authorised signers) do not match, the function \n   * will revert.\n   *\n   * Note! You should not call this function in a consumer contract. You can use\n   * `getOracleNumericValuesFromTxMsg` or `getOracleNumericValueFromTxMsg` instead.\n   *\n   * @param dataFeedIds An array of unique data feed identifiers\n   * @return An array of the extracted and verified oracle values in the same order\n   * as they are requested in dataFeedIds array\n   * @return dataPackagesTimestamp timestamp equal for all data packages\n   */\n  function _securelyExtractOracleValuesAndTimestampFromTxMsg(bytes32[] memory dataFeedIds)\n    internal\n    view\n    returns (uint256[] memory, uint256 dataPackagesTimestamp)\n  {\n    // Initializing helpful variables and allocating memory\n    uint256[] memory uniqueSignerCountForDataFeedIds = new uint256[](dataFeedIds.length);\n    uint256[] memory signersBitmapForDataFeedIds = new uint256[](dataFeedIds.length);\n    uint256[][] memory valuesForDataFeeds = new uint256[][](dataFeedIds.length);\n    uint256 uniqueSignersThreshold = getUniqueSignersThreshold();\n    for (uint256 i = 0; i < dataFeedIds.length;) {\n      // The line below is commented because newly allocated arrays are filled with zeros\n      // But we left it for better readability\n      // signersBitmapForDataFeedIds[i] = 0; // <- setting to an empty bitmap\n      valuesForDataFeeds[i] = new uint256[](uniqueSignersThreshold);\n      unchecked {\n        i++;\n      }\n    }\n\n    // Extracting the number of data packages from calldata\n    uint256 calldataNegativeOffset = _extractByteSizeOfUnsignedMetadata();\n    uint256 dataPackagesCount;\n    (dataPackagesCount, calldataNegativeOffset) = _extractDataPackagesCountFromCalldata(calldataNegativeOffset);\n\n    // Saving current free memory pointer\n    uint256 freeMemPtr;\n    assembly {\n      freeMemPtr := mload(FREE_MEMORY_PTR)\n    }\n\n    // Data packages extraction in a loop\n    for (uint256 dataPackageIndex = 0; dataPackageIndex < dataPackagesCount;) {\n      // Extract data package details and update calldata offset\n      uint256 dataPackageTimestamp;\n      (calldataNegativeOffset, dataPackageTimestamp) = _extractDataPackage(\n        dataFeedIds,\n        uniqueSignerCountForDataFeedIds,\n        signersBitmapForDataFeedIds,\n        valuesForDataFeeds,\n        calldataNegativeOffset\n      );\n\n      if (dataPackageTimestamp == 0) {\n        revert DataTimestampCannotBeZero();\n      }\n\n      if (dataPackageTimestamp != dataPackagesTimestamp) {\n        if (dataPackagesTimestamp == 0) {\n          // Setting dataPackagesTimestamp first time\n          dataPackagesTimestamp = dataPackageTimestamp;    \n        } else {\n          revert TimestampsMustBeEqual();\n        }\n      }\n\n      // Resetting the memory pointer to the initial \"safe\" value\n      // We add STANDARD_SLOT_BS (32 bytes) to account for potential allocation\n      // of the dataPackageIndex variable, which may or may not be stored in memory\n      assembly {\n        mstore(FREE_MEMORY_PTR, add(freeMemPtr, STANDARD_SLOT_BS))\n      }\n      unchecked {\n        dataPackageIndex++;\n      }\n    }\n\n    // Validating numbers of unique signers and calculating aggregated values for each dataFeedId\n    return (_getAggregatedValues(valuesForDataFeeds, uniqueSignerCountForDataFeedIds), dataPackagesTimestamp);\n  }\n\n  /**\n   * @dev This is a private helpful function, which extracts data for a data package based\n   * on the given negative calldata offset, verifies them, and in the case of successful\n   * verification updates the corresponding data package values in memory\n   *\n   * @param dataFeedIds an array of unique data feed identifiers\n   * @param uniqueSignerCountForDataFeedIds an array with the numbers of unique signers\n   * for each data feed\n   * @param signersBitmapForDataFeedIds an array of signer bitmaps for data feeds\n   * @param valuesForDataFeeds 2-dimensional array, valuesForDataFeeds[i][j] contains\n   * j-th value for the i-th data feed\n   * @param calldataNegativeOffset negative calldata offset for the given data package\n   *\n   * @return nextCalldataNegativeOffset negative calldata offset for the next data package\n   * @return dataPackageTimestamp data package timestamp\n   */\n  function _extractDataPackage(\n    bytes32[] memory dataFeedIds,\n    uint256[] memory uniqueSignerCountForDataFeedIds,\n    uint256[] memory signersBitmapForDataFeedIds,\n    uint256[][] memory valuesForDataFeeds,\n    uint256 calldataNegativeOffset\n  ) private view returns (uint256 nextCalldataNegativeOffset, uint256 dataPackageTimestamp) {\n    uint256 signerIndex;\n\n    (\n      uint256 dataPointsCount,\n      uint256 eachDataPointValueByteSize\n    ) = _extractDataPointsDetailsForDataPackage(calldataNegativeOffset);\n\n    // We use scopes to resolve problem with too deep stack\n    {\n      address signerAddress;\n      bytes32 signedHash;\n      bytes memory signedMessage;\n      uint256 signedMessageBytesCount;\n      uint48 extractedTimestamp;\n\n      signedMessageBytesCount = dataPointsCount * (eachDataPointValueByteSize + DATA_POINT_SYMBOL_BS)\n        + DATA_PACKAGE_WITHOUT_DATA_POINTS_AND_SIG_BS; //DATA_POINT_VALUE_BYTE_SIZE_BS + TIMESTAMP_BS + DATA_POINTS_COUNT_BS\n\n      uint256 timestampCalldataOffset = msg.data.length - \n        (calldataNegativeOffset + TIMESTAMP_NEGATIVE_OFFSET_IN_DATA_PACKAGE_WITH_STANDARD_SLOT_BS);\n\n      uint256 signedMessageCalldataOffset = msg.data.length - \n        (calldataNegativeOffset + SIG_BS + signedMessageBytesCount);\n\n      assembly {\n        // Extracting the signed message\n        signedMessage := extractBytesFromCalldata(\n          signedMessageCalldataOffset,\n          signedMessageBytesCount\n        )\n\n        // Hashing the signed message\n        signedHash := keccak256(add(signedMessage, BYTES_ARR_LEN_VAR_BS), signedMessageBytesCount)\n\n        // Extracting timestamp\n        extractedTimestamp := calldataload(timestampCalldataOffset)\n\n        function initByteArray(bytesCount) -> ptr {\n          ptr := mload(FREE_MEMORY_PTR)\n          mstore(ptr, bytesCount)\n          ptr := add(ptr, BYTES_ARR_LEN_VAR_BS)\n          mstore(FREE_MEMORY_PTR, add(ptr, bytesCount))\n        }\n\n        function extractBytesFromCalldata(offset, bytesCount) -> extractedBytes {\n          let extractedBytesStartPtr := initByteArray(bytesCount)\n          calldatacopy(\n            extractedBytesStartPtr,\n            offset,\n            bytesCount\n          )\n          extractedBytes := sub(extractedBytesStartPtr, BYTES_ARR_LEN_VAR_BS)\n        }\n      }\n\n      dataPackageTimestamp = extractedTimestamp;\n\n      // Verifying the off-chain signature against on-chain hashed data\n      signerAddress = SignatureLib.recoverSignerAddress(\n        signedHash,\n        calldataNegativeOffset + SIG_BS\n      );\n      signerIndex = getAuthorisedSignerIndex(signerAddress);\n    }\n\n    // Updating helpful arrays\n    {\n      calldataNegativeOffset = calldataNegativeOffset + DATA_PACKAGE_WITHOUT_DATA_POINTS_BS;\n      bytes32 dataPointDataFeedId;\n      uint256 dataPointValue;\n      for (uint256 dataPointIndex = 0; dataPointIndex < dataPointsCount;) {\n        calldataNegativeOffset = calldataNegativeOffset + eachDataPointValueByteSize + DATA_POINT_SYMBOL_BS;\n        // Extracting data feed id and value for the current data point\n        (dataPointDataFeedId, dataPointValue) = _extractDataPointValueAndDataFeedId(\n          calldataNegativeOffset,\n          eachDataPointValueByteSize\n        );\n\n        for (\n          uint256 dataFeedIdIndex = 0;\n          dataFeedIdIndex < dataFeedIds.length;\n        ) {\n          if (dataPointDataFeedId == dataFeedIds[dataFeedIdIndex]) {\n            uint256 bitmapSignersForDataFeedId = signersBitmapForDataFeedIds[dataFeedIdIndex];\n\n            if (\n              !BitmapLib.getBitFromBitmap(bitmapSignersForDataFeedId, signerIndex) && /* current signer was not counted for current dataFeedId */\n              uniqueSignerCountForDataFeedIds[dataFeedIdIndex] < getUniqueSignersThreshold()\n            ) {\n              // Add new value\n              valuesForDataFeeds[dataFeedIdIndex][uniqueSignerCountForDataFeedIds[dataFeedIdIndex]] = dataPointValue;\n\n              // Increase unique signer counter\n              uniqueSignerCountForDataFeedIds[dataFeedIdIndex]++;\n\n              // Update signers bitmap\n              signersBitmapForDataFeedIds[dataFeedIdIndex] = BitmapLib.setBitInBitmap(\n                bitmapSignersForDataFeedId,\n                signerIndex\n              );\n            }\n\n            // Breaking, as there couldn't be several indexes for the same feed ID\n            break;\n          }\n          unchecked {\n            dataFeedIdIndex++;\n          }\n        }\n        unchecked {\n           dataPointIndex++;\n        }\n      }\n    }\n\n    return (calldataNegativeOffset, dataPackageTimestamp);\n  }\n\n  /**\n   * @dev This is a private helpful function, which aggregates values from different\n   * authorised signers for the given arrays of values for each data feed\n   *\n   * @param valuesForDataFeeds 2-dimensional array, valuesForDataFeeds[i][j] contains\n   * j-th value for the i-th data feed\n   * @param uniqueSignerCountForDataFeedIds an array with the numbers of unique signers\n   * for each data feed\n   *\n   * @return An array of the aggregated values\n   */\n  function _getAggregatedValues(\n    uint256[][] memory valuesForDataFeeds,\n    uint256[] memory uniqueSignerCountForDataFeedIds\n  ) private view returns (uint256[] memory) {\n    uint256[] memory aggregatedValues = new uint256[](valuesForDataFeeds.length);\n    uint256 uniqueSignersThreshold = getUniqueSignersThreshold();\n\n    for (uint256 dataFeedIndex = 0; dataFeedIndex < valuesForDataFeeds.length;) {\n      if (uniqueSignerCountForDataFeedIds[dataFeedIndex] < uniqueSignersThreshold) {\n        revert InsufficientNumberOfUniqueSigners(\n          uniqueSignerCountForDataFeedIds[dataFeedIndex],\n          uniqueSignersThreshold);\n      }\n      uint256 aggregatedValueForDataFeedId = aggregateValues(valuesForDataFeeds[dataFeedIndex]);\n      aggregatedValues[dataFeedIndex] = aggregatedValueForDataFeedId;\n      unchecked {\n         dataFeedIndex++;\n      }\n    }\n\n    return aggregatedValues;\n  }\n}\n"},{"file_path":"@redstone-finance/evm-connector/contracts/core/RedstoneConsumerNumericBase.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport \"./RedstoneConsumerBase.sol\";\n\n/**\n * @title The base contract for Redstone consumers' contracts that allows to\n * securely calculate numeric redstone oracle values\n * @author The Redstone Oracles team\n * @dev This contract can extend other contracts to allow them\n * securely fetch Redstone oracle data from transactions calldata\n */\nabstract contract RedstoneConsumerNumericBase is RedstoneConsumerBase {\n  /**\n   * @dev This function can be used in a consumer contract to securely extract an\n   * oracle value for a given data feed id. Security is achieved by\n   * signatures verification, timestamp validation, and aggregating values\n   * from different authorised signers into a single numeric value. If any of the\n   * required conditions do not match, the function will revert.\n   * Note! This function expects that tx calldata contains redstone payload in the end\n   * Learn more about redstone payload here: https://github.com/redstone-finance/redstone-oracles-monorepo/tree/main/packages/evm-connector#readme\n   * @param dataFeedId bytes32 value that uniquely identifies the data feed\n   * @return Extracted and verified numeric oracle value for the given data feed id\n   */\n  function getOracleNumericValueFromTxMsg(bytes32 dataFeedId)\n    internal\n    view\n    virtual\n    returns (uint256)\n  {\n    bytes32[] memory dataFeedIds = new bytes32[](1);\n    dataFeedIds[0] = dataFeedId;\n    return getOracleNumericValuesFromTxMsg(dataFeedIds)[0];\n  }\n\n  /**\n   * @dev This function can be used in a consumer contract to securely extract several\n   * numeric oracle values for a given array of data feed ids. Security is achieved by\n   * signatures verification, timestamp validation, and aggregating values\n   * from different authorised signers into a single numeric value. If any of the\n   * required conditions do not match, the function will revert.\n   * Note! This function expects that tx calldata contains redstone payload in the end\n   * Learn more about redstone payload here: https://github.com/redstone-finance/redstone-oracles-monorepo/tree/main/packages/evm-connector#readme\n   * @param dataFeedIds An array of unique data feed identifiers\n   * @return An array of the extracted and verified oracle values in the same order\n   * as they are requested in the dataFeedIds array\n   */\n  function getOracleNumericValuesFromTxMsg(bytes32[] memory dataFeedIds)\n    internal\n    view\n    virtual\n    returns (uint256[] memory)\n  {\n    (uint256[] memory values, uint256 timestamp) = _securelyExtractOracleValuesAndTimestampFromTxMsg(dataFeedIds);\n    validateTimestamp(timestamp);\n    return values;\n  }\n\n  /**\n   * @dev This function can be used in a consumer contract to securely extract several\n   * numeric oracle values for a given array of data feed ids. Security is achieved by\n   * signatures verification and aggregating values from different authorised signers \n   * into a single numeric value. If any of the required conditions do not match, \n   * the function will revert.\n   * Note! This function returns the timestamp of the packages (it requires it to be \n   * the same for all), but does not validate this timestamp.\n   * Note! This function expects that tx calldata contains redstone payload in the end\n   * Learn more about redstone payload here: https://github.com/redstone-finance/redstone-oracles-monorepo/tree/main/packages/evm-connector#readme\n   * @param dataFeedIds An array of unique data feed identifiers\n   * @return An array of the extracted and verified oracle values in the same order\n   * as they are requested in the dataFeedIds array and data packages timestamp\n   */\n   function getOracleNumericValuesAndTimestampFromTxMsg(bytes32[] memory dataFeedIds)\n    internal\n    view\n    virtual\n    returns (uint256[] memory, uint256)\n  {\n    return _securelyExtractOracleValuesAndTimestampFromTxMsg(dataFeedIds);\n  }\n\n  /**\n   * @dev This function works similarly to the `getOracleNumericValuesFromTxMsg` with the\n   * only difference that it allows to request oracle data for an array of data feeds\n   * that may contain duplicates\n   * \n   * @param dataFeedIdsWithDuplicates An array of data feed identifiers (duplicates are allowed)\n   * @return An array of the extracted and verified oracle values in the same order\n   * as they are requested in the dataFeedIdsWithDuplicates array\n   */\n  function getOracleNumericValuesWithDuplicatesFromTxMsg(bytes32[] memory dataFeedIdsWithDuplicates) internal view returns (uint256[] memory) {\n    // Building an array without duplicates\n    bytes32[] memory dataFeedIdsWithoutDuplicates = new bytes32[](dataFeedIdsWithDuplicates.length);\n    bool alreadyIncluded;\n    uint256 uniqueDataFeedIdsCount = 0;\n\n    for (uint256 indexWithDup = 0; indexWithDup < dataFeedIdsWithDuplicates.length; indexWithDup++) {\n      // Checking if current element is already included in `dataFeedIdsWithoutDuplicates`\n      alreadyIncluded = false;\n      for (uint256 indexWithoutDup = 0; indexWithoutDup < uniqueDataFeedIdsCount; indexWithoutDup++) {\n        if (dataFeedIdsWithoutDuplicates[indexWithoutDup] == dataFeedIdsWithDuplicates[indexWithDup]) {\n          alreadyIncluded = true;\n          break;\n        }\n      }\n\n      // Adding if not included\n      if (!alreadyIncluded) {\n        dataFeedIdsWithoutDuplicates[uniqueDataFeedIdsCount] = dataFeedIdsWithDuplicates[indexWithDup];\n        uniqueDataFeedIdsCount++;\n      }\n    }\n\n    // Overriding dataFeedIdsWithoutDuplicates.length\n    // Equivalent to: dataFeedIdsWithoutDuplicates.length = uniqueDataFeedIdsCount;\n    assembly {\n      mstore(dataFeedIdsWithoutDuplicates, uniqueDataFeedIdsCount)\n    }\n\n    // Requesting oracle values (without duplicates)\n    (uint256[] memory valuesWithoutDuplicates, uint256 timestamp) = _securelyExtractOracleValuesAndTimestampFromTxMsg(dataFeedIdsWithoutDuplicates);\n    validateTimestamp(timestamp);\n\n    // Preparing result values array\n    uint256[] memory valuesWithDuplicates = new uint256[](dataFeedIdsWithDuplicates.length);\n    for (uint256 indexWithDup = 0; indexWithDup < dataFeedIdsWithDuplicates.length; indexWithDup++) {\n      for (uint256 indexWithoutDup = 0; indexWithoutDup < dataFeedIdsWithoutDuplicates.length; indexWithoutDup++) {\n        if (dataFeedIdsWithDuplicates[indexWithDup] == dataFeedIdsWithoutDuplicates[indexWithoutDup]) {\n          valuesWithDuplicates[indexWithDup] = valuesWithoutDuplicates[indexWithoutDup];\n          break;\n        }\n      }\n    }\n\n    return valuesWithDuplicates;\n  }\n}\n"},{"file_path":"@redstone-finance/evm-connector/contracts/core/RedstoneDefaultsLib.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport \"../libs/NumericArrayLib.sol\";\n\n/**\n * @title Default implementations of virtual redstone consumer base functions\n * @author The Redstone Oracles team\n */\nlibrary RedstoneDefaultsLib {\n  uint256 constant DEFAULT_MAX_DATA_TIMESTAMP_DELAY_SECONDS = 3 minutes;\n  uint256 constant DEFAULT_MAX_DATA_TIMESTAMP_AHEAD_SECONDS = 1 minutes;\n\n  error TimestampFromTooLongFuture(uint256 receivedTimestampSeconds, uint256 blockTimestamp);\n  error TimestampIsTooOld(uint256 receivedTimestampSeconds, uint256 blockTimestamp);\n\n  function validateTimestamp(uint256 receivedTimestampMilliseconds) internal view {\n    // Getting data timestamp from future seems quite unlikely\n    // But we've already spent too much time with different cases\n    // Where block.timestamp was less than dataPackage.timestamp.\n    // Some blockchains may case this problem as well.\n    // That's why we add MAX_BLOCK_TIMESTAMP_DELAY\n    // and allow data \"from future\" but with a small delay\n    uint256 receivedTimestampSeconds = receivedTimestampMilliseconds / 1000;\n\n    if (block.timestamp < receivedTimestampSeconds) {\n      if ((receivedTimestampSeconds - block.timestamp) > DEFAULT_MAX_DATA_TIMESTAMP_AHEAD_SECONDS) {\n        revert TimestampFromTooLongFuture(receivedTimestampSeconds, block.timestamp);\n      }\n    } else if ((block.timestamp - receivedTimestampSeconds) > DEFAULT_MAX_DATA_TIMESTAMP_DELAY_SECONDS) {\n      revert TimestampIsTooOld(receivedTimestampSeconds, block.timestamp);\n    }\n  }\n\n  function aggregateValues(uint256[] memory values) internal pure returns (uint256) {\n    return NumericArrayLib.pickMedian(values);\n  }\n}\n"},{"file_path":"@redstone-finance/evm-connector/contracts/libs/BitmapLib.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.17;\n\nlibrary BitmapLib {\n  function setBitInBitmap(uint256 bitmap, uint256 bitIndex) internal pure returns (uint256) {\n    return bitmap | (1 << bitIndex);\n  }\n\n  function getBitFromBitmap(uint256 bitmap, uint256 bitIndex) internal pure returns (bool) {\n    uint256 bitAtIndex = bitmap & (1 << bitIndex);\n    return bitAtIndex > 0;\n  }\n}\n"},{"file_path":"@redstone-finance/evm-connector/contracts/libs/NumericArrayLib.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.17;\n\nlibrary NumericArrayLib {\n  // This function sort array in memory using bubble sort algorithm,\n  // which performs even better than quick sort for small arrays\n\n  uint256 constant BYTES_ARR_LEN_VAR_BS = 32;\n  uint256 constant UINT256_VALUE_BS = 32;\n\n  error CanNotPickMedianOfEmptyArray();\n\n  // This function modifies the array\n  function pickMedian(uint256[] memory arr) internal pure returns (uint256) {\n    if (arr.length == 2) {\n      return (arr[0] + arr[1]) / 2;\n    }\n    if (arr.length == 0) {\n      revert CanNotPickMedianOfEmptyArray();\n    }\n    sort(arr);\n    uint256 middleIndex = arr.length / 2;\n    if (arr.length % 2 == 0) {\n      uint256 sum = arr[middleIndex - 1] + arr[middleIndex];\n      return sum / 2;\n    } else {\n      return arr[middleIndex];\n    }\n  }\n\n  function sort(uint256[] memory arr) internal pure {\n    assembly {\n      let arrLength := mload(arr)\n      let valuesPtr := add(arr, BYTES_ARR_LEN_VAR_BS)\n      let endPtr := add(valuesPtr, mul(arrLength, UINT256_VALUE_BS))\n      for {\n        let arrIPtr := valuesPtr\n      } lt(arrIPtr, endPtr) {\n        arrIPtr := add(arrIPtr, UINT256_VALUE_BS) // arrIPtr += 32\n      } {\n        for {\n          let arrJPtr := valuesPtr\n        } lt(arrJPtr, arrIPtr) {\n          arrJPtr := add(arrJPtr, UINT256_VALUE_BS) // arrJPtr += 32\n        } {\n          let arrI := mload(arrIPtr)\n          let arrJ := mload(arrJPtr)\n          if lt(arrI, arrJ) {\n            mstore(arrIPtr, arrJ)\n            mstore(arrJPtr, arrI)\n          }\n        }\n      }\n    }\n  }\n}\n"},{"file_path":"@redstone-finance/evm-connector/contracts/libs/SignatureLib.sol","source_code":"// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.17;\n\nlibrary SignatureLib {\n  uint256 constant ECDSA_SIG_R_BS = 32;\n  uint256 constant ECDSA_SIG_S_BS = 32;\n  \n  // Constants for ECDSA recovery ids\n  uint8 constant RECOVERY_ID_27 = 27;\n  uint8 constant RECOVERY_ID_28 = 28;\n\n  // Constant representing half of the curve order (secp256k1n / 2)\n  uint256 constant HALF_CURVE_ORDER = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0;\n\n  error InvalidSignature(bytes32 signedHash);\n\n  function recoverSignerAddress(bytes32 signedHash, uint256 signatureCalldataNegativeOffset)\n    internal\n    pure\n    returns (address signerAddress)\n  {\n    bytes32 r;\n    bytes32 s;\n    uint8 v;\n    assembly {\n      let signatureCalldataStartPos := sub(calldatasize(), signatureCalldataNegativeOffset)\n      r := calldataload(signatureCalldataStartPos)\n      signatureCalldataStartPos := add(signatureCalldataStartPos, ECDSA_SIG_R_BS)\n      s := calldataload(signatureCalldataStartPos)\n      signatureCalldataStartPos := add(signatureCalldataStartPos, ECDSA_SIG_S_BS)\n      v := byte(0, calldataload(signatureCalldataStartPos)) // last byte of the signature memory array\n    }\n    // 27 and 28 are the only two valid recovery ids used for ECDSA signatures in Ethereum\n    if (v != RECOVERY_ID_27 && v != RECOVERY_ID_28) {\n      revert InvalidSignature(signedHash);\n    }\n    // Ensure that the s value is in the lower half of the secp256k1 curve order (s < secp256k1n/2+1)\n    // to avoid signature malleability issues.\n    if (uint256(s) > HALF_CURVE_ORDER) {\n      revert InvalidSignature(signedHash);\n    }\n    signerAddress = ecrecover(signedHash, v, r, s);\n    if (signerAddress == address(0)) {\n      revert InvalidSignature(signedHash);\n    }\n  }\n}\n"},{"file_path":"contracts/__addresses/Addresses.sol","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.4;\n\nlibrary OldGelatoAddress {\n  address constant public ADDR = 0xc4D1AE5E796E6d7561cdc8335F85e6B57a36e097;\n}\n\nlibrary GelatoAddress {\n  address constant public ADDR = 0xCD6BfDA4D95d5C0f3f2882dC221D792392c99714;\n}\n"}],"is_verified_via_sourcify":true,"can_be_visualized_via_sol2uml":true,"evm_version":"london","language":"solidity","is_verified_via_eth_bytecode_db":true,"is_fully_verified":true,"license_type":"none","is_blueprint":false,"name":"EthereumMergedAdapterWithRoundsSpkccNavV1","creation_bytecode":"0x608060405234801561001057600080fd5b50612bdb806100206000396000f3fe608060405234801561001057600080fd5b50600436106102de5760003560e01c80638ec7c82111610186578063c274583a116100e3578063f34f73d811610097578063fba0315811610071578063fba031581461068d578063fd1f4bef14610695578063feaf968c146106bc57600080fd5b8063f34f73d81461060d578063f50b2efe14610673578063f90c49241461068657600080fd5b8063cbc33eb2116100c8578063cbc33eb214610427578063d1375817146105fe578063d149c0d71461060657600080fd5b8063c274583a146105d0578063c8337760146105d857600080fd5b8063aef2f1651161013a578063b24ebfcc1161011f578063b24ebfcc14610597578063bb1f29b7146105aa578063c14c9204146105bd57600080fd5b8063aef2f16514610551578063b0f106b01461056657600080fd5b80639a6fc8f51161016b5780639a6fc8f5146104e1578063a8b940e61461052b578063ada114571461053e57600080fd5b80638ec7c821146104bb578063971b9c03146104ce57600080fd5b806355a547d51161023f5780636e3e0370116101f35780637a02bdf1116101cd5780637a02bdf1146104845780638129fc1c1461048c5780638c3b990b1461049457600080fd5b80636e3e0370146104275780637284e4161461043c578063796b89b91461047e57600080fd5b80636668316a116102245780636668316a146103de578063668a0f02146103f15780636dafaf6a1461041457600080fd5b806355a547d5146103b657806355d12458146103be57600080fd5b806344e02982116102965780634b6a9d811161027b5780634b6a9d81146102fe57806350d25bcd146103a757806354fd4d50146103af57600080fd5b806344e029821461038e57806347043b00146103a157600080fd5b806326bf15ff116102c757806326bf15ff14610325578063313ce567146103665780633ce142f51461037b57600080fd5b80631b2758ee146102e3578063245a7bfc146102fe575b600080fd5b6102eb6106c4565b6040519081526020015b60405180910390f35b305b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102f5565b610338610333366004612752565b6106e6565b604080519384526fffffffffffffffffffffffffffffffff92831660208501529116908201526060016102f5565b60085b60405160ff90911681526020016102f5565b610369610389366004612774565b6107d9565b6102eb61039c3660046127aa565b610947565b30610300565b6102eb610970565b60016102eb565b6102eb610a6e565b6103d16103cc366004612865565b610bc7565b6040516102f591906128fb565b6102eb6103ec3660046127aa565b610c68565b6103f9610c96565b60405169ffffffffffffffffffff90911681526020016102f5565b6102eb6104223660046127aa565b610d51565b61043a610435366004612752565b610db7565b005b60408051808201909152601381527f52656473746f6e6520507269636520466565640000000000000000000000000060208201525b6040516102f5919061293f565b426102eb565b6102eb610df8565b61043a610e1a565b7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc4083263938546102eb565b6102eb6104c93660046127aa565b610fa4565b6103d16104dc366004612865565b610fb8565b6104f46104ef3660046129ab565b61102e565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016102f5565b61043a610539366004612774565b6111ad565b61043a61054c3660046127aa565b611302565b60408051603c815260b46020820152016102f5565b61056e611314565b604080516fffffffffffffffffffffffffffffffff9384168152929091166020830152016102f5565b6102eb6105a5366004612865565b611352565b61043a6105b83660046127aa565b61135d565b61043a6105cb3660046127aa565b611420565b61047161146b565b7f53504b43435f4e415600000000000000000000000000000000000000000000006102eb565b61033861149f565b60036102eb565b6102eb61061b366004612752565b60408051602080820194909452808201929092527f4dd0c77efa6f6d590c97573d8c70b714546e7311202ff7c11c484cc841d91bfc606080840191909152815180840390910181526080909201905280519101205490565b61043a6106813660046127aa565b6114e8565b6003610369565b6103d1611537565b7f3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe2546102eb565b6104f461159c565b60006106ce611314565b6fffffffffffffffffffffffffffffffff1692915050565b60008060006107137fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b84118061071e575083155b1561075d576040517ff8ae8137000000000000000000000000000000000000000000000000000000008152600481018590526024015b60405180910390fd5b6040805160208082018890528183018790527f4dd0c77efa6f6d590c97573d8c70b714546e7311202ff7c11c484cc841d91bfc60608084019190915283518084039091018152608090920190925280519101205492506107bd8584610db7565b60006107c885610fa4565b9396608085901c9650939450505050565b600073ffffffffffffffffffffffffffffffffffffffff8216738bb8f32df04c8b654987daaed53d6b6091e3b7740361081457506000919050565b73ffffffffffffffffffffffffffffffffffffffff821673deb22f54738d54976c4c0fe5ce6d408e40d884990361084d57506001919050565b73ffffffffffffffffffffffffffffffffffffffff82167351ce04be4b3e32572c4ec9135221d0691ba7d2020361088657506002919050565b73ffffffffffffffffffffffffffffffffffffffff821673dd682daec5a90dd295d14da4b0bec9281017b5be036108bf57506003919050565b73ffffffffffffffffffffffffffffffffffffffff8216739c5ae89c4af6aa32ce58588dbaf90d18a855b6de036108f857506004919050565b6040517fec459bc000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401610754565b919050565b600061095282610d51565b50600061095e83610c68565b905061096a8382610db7565b92915050565b6040517f44e029820000000000000000000000000000000000000000000000000000000081527f53504b43435f4e4156000000000000000000000000000000000000000000000060048201819052600091829030906344e0298290602401602060405180830381865afa1580156109eb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0f91906129d7565b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81111561096a576040517feccac09b00000000000000000000000000000000000000000000000000000000815260048101829052602401610754565b600080610a79611639565b90506000610a868261176e565b925061ffff1690506000819003610ac9576040517f8552ff3c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81811015610bc1576000610adf846117d6565b9050600080610aef606887612a1f565b90506000610afd8236612a32565b9050803592508265ffffffffffff16600003610b45576040517f336dc9d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b87600003610b5d578265ffffffffffff169750610b9e565b878365ffffffffffff1614610b9e576040517fd9d1f46500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ba88488612a1f565b9650505050508080610bb990612a45565b915050610acc565b50505090565b6060815167ffffffffffffffff811115610be357610be36127c3565b604051908082528060200260200182016040528015610c0c578160200160208202803683370190505b50905060005b8251811015610c6257610c3d838281518110610c3057610c30612a7d565b6020026020010151610c68565b828281518110610c4f57610c4f612a7d565b6020908102919091010152600101610c12565b50919050565b600061096a8261061b7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b6000803073ffffffffffffffffffffffffffffffffffffffff16638c3b990b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ce4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0891906129d7565b905069ffffffffffffffffffff811115610942576040517f1e93e47c00000000000000000000000000000000000000000000000000000000815260048101829052602401610754565b60007f53504b43435f4e415600000000000000000000000000000000000000000000008203610d8257506000919050565b6040517f9382940300000000000000000000000000000000000000000000000000000000815260048101839052602401610754565b80600003610df4576040517f0565ce2a00000000000000000000000000000000000000000000000000000000815260048101839052602401610754565b5050565b6000610e02611314565b506fffffffffffffffffffffffffffffffff16919050565b600054610100900460ff1615808015610e3a5750600054600160ff909116105b80610e545750303b158015610e54575060005460ff166001145b610ee0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610754565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610f3e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b8015610fa157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b600080610fb083611812565b549392505050565b60606000610fc583610bc7565b905060005b8351811015611027576000848281518110610fe757610fe7612a7d565b60200260200101519050610ffa81610d51565b5061101e8184848151811061101157611011612a7d565b6020026020010151610db7565b50600101610fca565b5092915050565b6000808080808080803073ffffffffffffffffffffffffffffffffffffffff166326bf15ff7f53504b43435f4e415600000000000000000000000000000000000000000000006040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b168152600481019190915269ffffffffffffffffffff8c166024820152604401606060405180830381865afa1580156110da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fe9190612acc565b9250925092508897507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115611164576040517feccac09b00000000000000000000000000000000000000000000000000000000815260048101849052602401610754565b8296506103e8826111759190612b37565b6fffffffffffffffffffffffffffffffff169550806fffffffffffffffffffffffffffffffff16945088935050505091939590929450565b73ffffffffffffffffffffffffffffffffffffffff811673be085ef98eeedfef036e33b623bbb44a5d105a3e14801590611211575073ffffffffffffffffffffffffffffffffffffffff811673cf443a92236d75d2f9288c7dc1021a2499e846b714155b8015611247575073ffffffffffffffffffffffffffffffffffffffff8116736bd3bb71e0bdbb6213fc31743b9a1f29e71dc95014155b801561127d575073ffffffffffffffffffffffffffffffffffffffff811673cd6bfda4d95d5c0f3f2882dc221d792392c9971414155b80156112b3575073ffffffffffffffffffffffffffffffffffffffff811673c4d1ae5e796e6d7561cdc8335f85e6b57a36e09714155b15610fa1576040517f63328d3d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610754565b61130b8161186e565b610fa18161135d565b60008061134a6113427f3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe25490565b608081901c91565b915091509091565b600061096a826118bd565b600061136b6103e883612b66565b9050603c60b442838110156113cc57826113858286612a32565b11156113c7576040517fb6b0916d0000000000000000000000000000000000000000000000000000000081526004810185905260248101829052604401610754565b611419565b816113d78583612a32565b1115611419576040517f0321d0b50000000000000000000000000000000000000000000000000000000081526004810185905260248101829052604401610754565b5050505050565b611429336111ad565b6114316118c8565b61143a81611302565b6114438161192b565b600061144d611537565b9050600061145a826119f1565b90506114668282611a0c565b505050565b60606040517f608b530700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060006114cc7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b925060006114d984610fa4565b9394608085901c949350915050565b60006114f2610df8565b9050808214610df4576040517f6bc11ec50000000000000000000000000000000000000000000000000000000081526004810182905260248101839052604401610754565b604080516001808252818301909252606091602080830190803683370190505090507f53504b43435f4e415600000000000000000000000000000000000000000000008160008151811061158d5761158d612a7d565b60200260200101818152505090565b60008060008060006115ac610c96565b94506115b6610970565b935060003073ffffffffffffffffffffffffffffffffffffffff16631b2758ee6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611605573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162991906129d7565b9596949594859450879350915050565b60006602ed57011e00007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0360135811614806116a1576040517fe7764c9e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600036602911156116de576040517f5796f78a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd736013560006009611717600362ffffff8516612a1f565b6117219190612a1f565b90503661172f600283612a1f565b1115611767576040517fc30a7bd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9392505050565b6000808061177d602085612a1f565b9050368111156117b9576040517f5796f78a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b36819003359250826117cc600286612a1f565b9250925050915091565b60008060006117e484611a83565b9092509050604e6117f6826020612a1f565b6118009084612b7a565b61180a9190612a1f565b949350505050565b6040516000906118519083907f207e00944d909d1224f0c253d58489121d736649f8393199f55eecf4f0cf3eb090602001918252602082015260400190565b604051602081830303815290604052805190602001209050919050565b6000611878610df8565b9050808211610df4576040517fef05deba0000000000000000000000000000000000000000000000000000000081526004810183905260248101829052604401610754565b600061096a82611ad6565b4260006118d36106c4565b905060036118e18183612a1f565b831015611466576040517f83b3f5c4000000000000000000000000000000000000000000000000000000008152600481018490526024810183905260448101829052606401610754565b426fffffffffffffffffffffffffffffffff811115611979576040517f70db678f00000000000000000000000000000000000000000000000000000000815260048101829052602401610754565b6fffffffffffffffffffffffffffffffff8211156119c6576040517f5cbfa8a100000000000000000000000000000000000000000000000000000000815260048101839052602401610754565b60809190911b177f3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe255565b60606000806119ff84611c13565b91509150611027816114e8565b81516001141580611a1f57508051600114155b15611a56576040517fbed42bab00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611a608282611e60565b610df481600081518110611a7657611a76612a7d565b6020026020010151611ec0565b6000808080806020611a96604188612a1f565b611aa09190612a1f565b611aaa9036612a32565b803593509050611abb600382612a32565b62ffffff9390931696923563ffffffff169550919350505050565b60008151600203611b2d57600282600181518110611af657611af6612a7d565b602002602001015183600081518110611b1157611b11612a7d565b6020026020010151611b239190612a1f565b61096a9190612b66565b8151600003611b68576040517f9e198af900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b7182611f21565b600060028351611b819190612b66565b905060028351611b919190612b91565b600003611bf1576000838281518110611bac57611bac612a7d565b602002602001015184600184611bc29190612a32565b81518110611bd257611bd2612a7d565b6020026020010151611be49190612a1f565b905061180a600282612b66565b828181518110611c0357611c03612a7d565b6020026020010151915050919050565b6060600080835167ffffffffffffffff811115611c3257611c326127c3565b604051908082528060200260200182016040528015611c5b578160200160208202803683370190505b5090506000845167ffffffffffffffff811115611c7a57611c7a6127c3565b604051908082528060200260200182016040528015611ca3578160200160208202803683370190505b5090506000855167ffffffffffffffff811115611cc257611cc26127c3565b604051908082528060200260200182016040528015611cf557816020015b6060815260200190600190039081611ce05790505b509050600360005b8751811015611d6e578167ffffffffffffffff811115611d1f57611d1f6127c3565b604051908082528060200260200182016040528015611d48578160200160208202803683370190505b50838281518110611d5b57611d5b612a7d565b6020908102919091010152600101611cfd565b506000611d79611639565b90506000611d868261176e565b60405190935061ffff909116915060005b82811015611e47576000611dae8c8a8a8a89611f6f565b90955090506000819003611dee576040517fdfb25a7900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b898114611e375789600003611e0557809950611e37565b6040517f4cbc474200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060208201604052600101611d97565b50611e528588612218565b985050505050505050915091565b611e68612340565b611e70612392565b60005b825181101561146657611eb8838281518110611e9157611e91612a7d565b6020026020010151838381518110611eab57611eab612a7d565b60200260200101516123fd565b600101611e73565b7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc408326393854611eeb82612498565b6040514281527f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f9060200160405180910390a350565b8051602082016020820281019150805b82811015611f6957815b81811015611f60578151815180821015611f56578084528183525b5050602001611f3b565b50602001611f31565b50505050565b6000806000806000611f8086611a83565b909250905060008060608180600d611f99602088612a1f565b611fa39089612b7a565b611fad9190612a1f565b91506000611fbc60688d612a1f565b611fc69036612a32565b9050600083611fd660418f612a1f565b611fe09190612a1f565b611fea9036612a32565b9050611ff68482612009565b945083602086012095508135925061204b565b604080518381526020818501810190925260009101838382377fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0019392505050565b8265ffffffffffff169a5061206c8660418f6120679190612a1f565b61254e565b9650612077876107d9565b60ff16995050505050505050604e866120909190612a1f565b955060008060005b848110156122055760206120ac858b612a1f565b6120b69190612a1f565b98506120c289856126e6565b909350915060005b8d518110156121fc578d81815181106120e5576120e5612a7d565b602002602001015184036121f45760008c828151811061210757612107612a7d565b6020026020010151905061212081896001901b16151590565b1580156121495750600360ff168e838151811061213f5761213f612a7d565b6020026020010151105b156121ee57838c838151811061216157612161612a7d565b60200260200101518f848151811061217b5761217b612a7d565b60200260200101518151811061219357612193612a7d565b6020026020010181815250508d82815181106121b1576121b1612a7d565b6020026020010180518091906121c690612a45565b9052506001881b81178d83815181106121e1576121e1612a7d565b6020026020010181815250505b506121fc565b6001016120ca565b50600101612098565b5050508594505050509550959350505050565b60606000835167ffffffffffffffff811115612236576122366127c3565b60405190808252806020026020018201604052801561225f578160200160208202803683370190505b509050600360005b8551811015612336578185828151811061228357612283612a7d565b602002602001015110156122e9578481815181106122a3576122a3612a7d565b6020026020010151826040517f2b13aef5000000000000000000000000000000000000000000000000000000008152600401610754929190918252602082015260400190565b600061230d87838151811061230057612300612a7d565b6020026020010151611352565b90508084838151811061232257612322612a7d565b602090810291909101015250600101612267565b5090949350505050565b600061236a7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b6001017fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385550565b60006123bc7f3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe25490565b905060006123e87fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b905060006123f582611812565b929092555050565b6124078282610db7565b6000612490836124357fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b60408051602081018490529081018290527f4dd0c77efa6f6d590c97573d8c70b714546e7311202ff7c11c484cc841d91bfc606082015260009060800160405160208183030381529060405280519060200120905092915050565b919091555050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82111561254a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e743235360000000000000000000000000000000000000000000000006064820152608401610754565b5090565b60003682900380359060208101359060400135831a601b8114801590612578575060ff8116601c14155b156125b2576040517f666b7cba00000000000000000000000000000000000000000000000000000000815260048101879052602401610754565b7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561260f576040517f666b7cba00000000000000000000000000000000000000000000000000000000815260048101879052602401610754565b60408051600081526020810180835288905260ff831691810191909152606081018490526080810183905260019060a0016020604051602081039080840390855afa158015612662573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015194505073ffffffffffffffffffffffffffffffffffffffff84166126dd576040517f666b7cba00000000000000000000000000000000000000000000000000000000815260048101879052602401610754565b50505092915050565b600080806126f48536612a32565b905080359250602081013591506021841061273e576040517fc000fc4200000000000000000000000000000000000000000000000000000000815260048101859052602401610754565b8360200360080282901c9150509250929050565b6000806040838503121561276557600080fd5b50508035926020909101359150565b60006020828403121561278657600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461176757600080fd5b6000602082840312156127bc57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612839576128396127c3565b604052919050565b600067ffffffffffffffff82111561285b5761285b6127c3565b5060051b60200190565b6000602080838503121561287857600080fd5b823567ffffffffffffffff81111561288f57600080fd5b8301601f810185136128a057600080fd5b80356128b36128ae82612841565b6127f2565b81815260059190911b820183019083810190878311156128d257600080fd5b928401925b828410156128f0578335825292840192908401906128d7565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561293357835183529284019291840191600101612917565b50909695505050505050565b600060208083528351808285015260005b8181101561296c57858101830151858201604001528201612950565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b6000602082840312156129bd57600080fd5b813569ffffffffffffffffffff8116811461176757600080fd5b6000602082840312156129e957600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561096a5761096a6129f0565b8181038181111561096a5761096a6129f0565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612a7657612a766129f0565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b80516fffffffffffffffffffffffffffffffff8116811461094257600080fd5b600080600060608486031215612ae157600080fd5b83519250612af160208501612aac565b9150612aff60408501612aac565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006fffffffffffffffffffffffffffffffff80841680612b5a57612b5a612b08565b92169190910492915050565b600082612b7557612b75612b08565b500490565b808202811582820484141761096a5761096a6129f0565b600082612ba057612ba0612b08565b50069056fea264697066735822122052d444403621a2f697804c30b8ce7032f4d86390ff4333b385db79cc659e106064736f6c63430008110033","external_libraries":[],"proxy_type":null,"implementations":[],"verified_at":"2025-11-10T13:51:13.928365Z","is_verified_via_verifier_alliance":false,"compiler_version":"0.8.17+commit.8df45f5f","decoded_constructor_args":null,"sourcify_repo_url":"https://repo.sourcify.dev/1/0x14449CC3185deC0421c3CB37074215F1aaCB97F9","optimization_runs":10000,"compiler_settings":{"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":10000},"remappings":[]},"is_verified":true,"verified_twin_address_hash":null,"optimization_enabled":true,"deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106102de5760003560e01c80638ec7c82111610186578063c274583a116100e3578063f34f73d811610097578063fba0315811610071578063fba031581461068d578063fd1f4bef14610695578063feaf968c146106bc57600080fd5b8063f34f73d81461060d578063f50b2efe14610673578063f90c49241461068657600080fd5b8063cbc33eb2116100c8578063cbc33eb214610427578063d1375817146105fe578063d149c0d71461060657600080fd5b8063c274583a146105d0578063c8337760146105d857600080fd5b8063aef2f1651161013a578063b24ebfcc1161011f578063b24ebfcc14610597578063bb1f29b7146105aa578063c14c9204146105bd57600080fd5b8063aef2f16514610551578063b0f106b01461056657600080fd5b80639a6fc8f51161016b5780639a6fc8f5146104e1578063a8b940e61461052b578063ada114571461053e57600080fd5b80638ec7c821146104bb578063971b9c03146104ce57600080fd5b806355a547d51161023f5780636e3e0370116101f35780637a02bdf1116101cd5780637a02bdf1146104845780638129fc1c1461048c5780638c3b990b1461049457600080fd5b80636e3e0370146104275780637284e4161461043c578063796b89b91461047e57600080fd5b80636668316a116102245780636668316a146103de578063668a0f02146103f15780636dafaf6a1461041457600080fd5b806355a547d5146103b657806355d12458146103be57600080fd5b806344e02982116102965780634b6a9d811161027b5780634b6a9d81146102fe57806350d25bcd146103a757806354fd4d50146103af57600080fd5b806344e029821461038e57806347043b00146103a157600080fd5b806326bf15ff116102c757806326bf15ff14610325578063313ce567146103665780633ce142f51461037b57600080fd5b80631b2758ee146102e3578063245a7bfc146102fe575b600080fd5b6102eb6106c4565b6040519081526020015b60405180910390f35b305b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102f5565b610338610333366004612752565b6106e6565b604080519384526fffffffffffffffffffffffffffffffff92831660208501529116908201526060016102f5565b60085b60405160ff90911681526020016102f5565b610369610389366004612774565b6107d9565b6102eb61039c3660046127aa565b610947565b30610300565b6102eb610970565b60016102eb565b6102eb610a6e565b6103d16103cc366004612865565b610bc7565b6040516102f591906128fb565b6102eb6103ec3660046127aa565b610c68565b6103f9610c96565b60405169ffffffffffffffffffff90911681526020016102f5565b6102eb6104223660046127aa565b610d51565b61043a610435366004612752565b610db7565b005b60408051808201909152601381527f52656473746f6e6520507269636520466565640000000000000000000000000060208201525b6040516102f5919061293f565b426102eb565b6102eb610df8565b61043a610e1a565b7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc4083263938546102eb565b6102eb6104c93660046127aa565b610fa4565b6103d16104dc366004612865565b610fb8565b6104f46104ef3660046129ab565b61102e565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016102f5565b61043a610539366004612774565b6111ad565b61043a61054c3660046127aa565b611302565b60408051603c815260b46020820152016102f5565b61056e611314565b604080516fffffffffffffffffffffffffffffffff9384168152929091166020830152016102f5565b6102eb6105a5366004612865565b611352565b61043a6105b83660046127aa565b61135d565b61043a6105cb3660046127aa565b611420565b61047161146b565b7f53504b43435f4e415600000000000000000000000000000000000000000000006102eb565b61033861149f565b60036102eb565b6102eb61061b366004612752565b60408051602080820194909452808201929092527f4dd0c77efa6f6d590c97573d8c70b714546e7311202ff7c11c484cc841d91bfc606080840191909152815180840390910181526080909201905280519101205490565b61043a6106813660046127aa565b6114e8565b6003610369565b6103d1611537565b7f3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe2546102eb565b6104f461159c565b60006106ce611314565b6fffffffffffffffffffffffffffffffff1692915050565b60008060006107137fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b84118061071e575083155b1561075d576040517ff8ae8137000000000000000000000000000000000000000000000000000000008152600481018590526024015b60405180910390fd5b6040805160208082018890528183018790527f4dd0c77efa6f6d590c97573d8c70b714546e7311202ff7c11c484cc841d91bfc60608084019190915283518084039091018152608090920190925280519101205492506107bd8584610db7565b60006107c885610fa4565b9396608085901c9650939450505050565b600073ffffffffffffffffffffffffffffffffffffffff8216738bb8f32df04c8b654987daaed53d6b6091e3b7740361081457506000919050565b73ffffffffffffffffffffffffffffffffffffffff821673deb22f54738d54976c4c0fe5ce6d408e40d884990361084d57506001919050565b73ffffffffffffffffffffffffffffffffffffffff82167351ce04be4b3e32572c4ec9135221d0691ba7d2020361088657506002919050565b73ffffffffffffffffffffffffffffffffffffffff821673dd682daec5a90dd295d14da4b0bec9281017b5be036108bf57506003919050565b73ffffffffffffffffffffffffffffffffffffffff8216739c5ae89c4af6aa32ce58588dbaf90d18a855b6de036108f857506004919050565b6040517fec459bc000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83166004820152602401610754565b919050565b600061095282610d51565b50600061095e83610c68565b905061096a8382610db7565b92915050565b6040517f44e029820000000000000000000000000000000000000000000000000000000081527f53504b43435f4e4156000000000000000000000000000000000000000000000060048201819052600091829030906344e0298290602401602060405180830381865afa1580156109eb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0f91906129d7565b90507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81111561096a576040517feccac09b00000000000000000000000000000000000000000000000000000000815260048101829052602401610754565b600080610a79611639565b90506000610a868261176e565b925061ffff1690506000819003610ac9576040517f8552ff3c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b81811015610bc1576000610adf846117d6565b9050600080610aef606887612a1f565b90506000610afd8236612a32565b9050803592508265ffffffffffff16600003610b45576040517f336dc9d000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b87600003610b5d578265ffffffffffff169750610b9e565b878365ffffffffffff1614610b9e576040517fd9d1f46500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610ba88488612a1f565b9650505050508080610bb990612a45565b915050610acc565b50505090565b6060815167ffffffffffffffff811115610be357610be36127c3565b604051908082528060200260200182016040528015610c0c578160200160208202803683370190505b50905060005b8251811015610c6257610c3d838281518110610c3057610c30612a7d565b6020026020010151610c68565b828281518110610c4f57610c4f612a7d565b6020908102919091010152600101610c12565b50919050565b600061096a8261061b7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b6000803073ffffffffffffffffffffffffffffffffffffffff16638c3b990b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ce4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0891906129d7565b905069ffffffffffffffffffff811115610942576040517f1e93e47c00000000000000000000000000000000000000000000000000000000815260048101829052602401610754565b60007f53504b43435f4e415600000000000000000000000000000000000000000000008203610d8257506000919050565b6040517f9382940300000000000000000000000000000000000000000000000000000000815260048101839052602401610754565b80600003610df4576040517f0565ce2a00000000000000000000000000000000000000000000000000000000815260048101839052602401610754565b5050565b6000610e02611314565b506fffffffffffffffffffffffffffffffff16919050565b600054610100900460ff1615808015610e3a5750600054600160ff909116105b80610e545750303b158015610e54575060005460ff166001145b610ee0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610754565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610f3e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b8015610fa157600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b600080610fb083611812565b549392505050565b60606000610fc583610bc7565b905060005b8351811015611027576000848281518110610fe757610fe7612a7d565b60200260200101519050610ffa81610d51565b5061101e8184848151811061101157611011612a7d565b6020026020010151610db7565b50600101610fca565b5092915050565b6000808080808080803073ffffffffffffffffffffffffffffffffffffffff166326bf15ff7f53504b43435f4e415600000000000000000000000000000000000000000000006040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b168152600481019190915269ffffffffffffffffffff8c166024820152604401606060405180830381865afa1580156110da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110fe9190612acc565b9250925092508897507f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831115611164576040517feccac09b00000000000000000000000000000000000000000000000000000000815260048101849052602401610754565b8296506103e8826111759190612b37565b6fffffffffffffffffffffffffffffffff169550806fffffffffffffffffffffffffffffffff16945088935050505091939590929450565b73ffffffffffffffffffffffffffffffffffffffff811673be085ef98eeedfef036e33b623bbb44a5d105a3e14801590611211575073ffffffffffffffffffffffffffffffffffffffff811673cf443a92236d75d2f9288c7dc1021a2499e846b714155b8015611247575073ffffffffffffffffffffffffffffffffffffffff8116736bd3bb71e0bdbb6213fc31743b9a1f29e71dc95014155b801561127d575073ffffffffffffffffffffffffffffffffffffffff811673cd6bfda4d95d5c0f3f2882dc221d792392c9971414155b80156112b3575073ffffffffffffffffffffffffffffffffffffffff811673c4d1ae5e796e6d7561cdc8335f85e6b57a36e09714155b15610fa1576040517f63328d3d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610754565b61130b8161186e565b610fa18161135d565b60008061134a6113427f3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe25490565b608081901c91565b915091509091565b600061096a826118bd565b600061136b6103e883612b66565b9050603c60b442838110156113cc57826113858286612a32565b11156113c7576040517fb6b0916d0000000000000000000000000000000000000000000000000000000081526004810185905260248101829052604401610754565b611419565b816113d78583612a32565b1115611419576040517f0321d0b50000000000000000000000000000000000000000000000000000000081526004810185905260248101829052604401610754565b5050505050565b611429336111ad565b6114316118c8565b61143a81611302565b6114438161192b565b600061144d611537565b9050600061145a826119f1565b90506114668282611a0c565b505050565b60606040517f608b530700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060006114cc7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b925060006114d984610fa4565b9394608085901c949350915050565b60006114f2610df8565b9050808214610df4576040517f6bc11ec50000000000000000000000000000000000000000000000000000000081526004810182905260248101839052604401610754565b604080516001808252818301909252606091602080830190803683370190505090507f53504b43435f4e415600000000000000000000000000000000000000000000008160008151811061158d5761158d612a7d565b60200260200101818152505090565b60008060008060006115ac610c96565b94506115b6610970565b935060003073ffffffffffffffffffffffffffffffffffffffff16631b2758ee6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611605573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162991906129d7565b9596949594859450879350915050565b60006602ed57011e00007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0360135811614806116a1576040517fe7764c9e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600036602911156116de576040517f5796f78a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd736013560006009611717600362ffffff8516612a1f565b6117219190612a1f565b90503661172f600283612a1f565b1115611767576040517fc30a7bd700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9392505050565b6000808061177d602085612a1f565b9050368111156117b9576040517f5796f78a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b36819003359250826117cc600286612a1f565b9250925050915091565b60008060006117e484611a83565b9092509050604e6117f6826020612a1f565b6118009084612b7a565b61180a9190612a1f565b949350505050565b6040516000906118519083907f207e00944d909d1224f0c253d58489121d736649f8393199f55eecf4f0cf3eb090602001918252602082015260400190565b604051602081830303815290604052805190602001209050919050565b6000611878610df8565b9050808211610df4576040517fef05deba0000000000000000000000000000000000000000000000000000000081526004810183905260248101829052604401610754565b600061096a82611ad6565b4260006118d36106c4565b905060036118e18183612a1f565b831015611466576040517f83b3f5c4000000000000000000000000000000000000000000000000000000008152600481018490526024810183905260448101829052606401610754565b426fffffffffffffffffffffffffffffffff811115611979576040517f70db678f00000000000000000000000000000000000000000000000000000000815260048101829052602401610754565b6fffffffffffffffffffffffffffffffff8211156119c6576040517f5cbfa8a100000000000000000000000000000000000000000000000000000000815260048101839052602401610754565b60809190911b177f3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe255565b60606000806119ff84611c13565b91509150611027816114e8565b81516001141580611a1f57508051600114155b15611a56576040517fbed42bab00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611a608282611e60565b610df481600081518110611a7657611a76612a7d565b6020026020010151611ec0565b6000808080806020611a96604188612a1f565b611aa09190612a1f565b611aaa9036612a32565b803593509050611abb600382612a32565b62ffffff9390931696923563ffffffff169550919350505050565b60008151600203611b2d57600282600181518110611af657611af6612a7d565b602002602001015183600081518110611b1157611b11612a7d565b6020026020010151611b239190612a1f565b61096a9190612b66565b8151600003611b68576040517f9e198af900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b7182611f21565b600060028351611b819190612b66565b905060028351611b919190612b91565b600003611bf1576000838281518110611bac57611bac612a7d565b602002602001015184600184611bc29190612a32565b81518110611bd257611bd2612a7d565b6020026020010151611be49190612a1f565b905061180a600282612b66565b828181518110611c0357611c03612a7d565b6020026020010151915050919050565b6060600080835167ffffffffffffffff811115611c3257611c326127c3565b604051908082528060200260200182016040528015611c5b578160200160208202803683370190505b5090506000845167ffffffffffffffff811115611c7a57611c7a6127c3565b604051908082528060200260200182016040528015611ca3578160200160208202803683370190505b5090506000855167ffffffffffffffff811115611cc257611cc26127c3565b604051908082528060200260200182016040528015611cf557816020015b6060815260200190600190039081611ce05790505b509050600360005b8751811015611d6e578167ffffffffffffffff811115611d1f57611d1f6127c3565b604051908082528060200260200182016040528015611d48578160200160208202803683370190505b50838281518110611d5b57611d5b612a7d565b6020908102919091010152600101611cfd565b506000611d79611639565b90506000611d868261176e565b60405190935061ffff909116915060005b82811015611e47576000611dae8c8a8a8a89611f6f565b90955090506000819003611dee576040517fdfb25a7900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b898114611e375789600003611e0557809950611e37565b6040517f4cbc474200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5060208201604052600101611d97565b50611e528588612218565b985050505050505050915091565b611e68612340565b611e70612392565b60005b825181101561146657611eb8838281518110611e9157611e91612a7d565b6020026020010151838381518110611eab57611eab612a7d565b60200260200101516123fd565b600101611e73565b7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc408326393854611eeb82612498565b6040514281527f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f9060200160405180910390a350565b8051602082016020820281019150805b82811015611f6957815b81811015611f60578151815180821015611f56578084528183525b5050602001611f3b565b50602001611f31565b50505050565b6000806000806000611f8086611a83565b909250905060008060608180600d611f99602088612a1f565b611fa39089612b7a565b611fad9190612a1f565b91506000611fbc60688d612a1f565b611fc69036612a32565b9050600083611fd660418f612a1f565b611fe09190612a1f565b611fea9036612a32565b9050611ff68482612009565b945083602086012095508135925061204b565b604080518381526020818501810190925260009101838382377fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0019392505050565b8265ffffffffffff169a5061206c8660418f6120679190612a1f565b61254e565b9650612077876107d9565b60ff16995050505050505050604e866120909190612a1f565b955060008060005b848110156122055760206120ac858b612a1f565b6120b69190612a1f565b98506120c289856126e6565b909350915060005b8d518110156121fc578d81815181106120e5576120e5612a7d565b602002602001015184036121f45760008c828151811061210757612107612a7d565b6020026020010151905061212081896001901b16151590565b1580156121495750600360ff168e838151811061213f5761213f612a7d565b6020026020010151105b156121ee57838c838151811061216157612161612a7d565b60200260200101518f848151811061217b5761217b612a7d565b60200260200101518151811061219357612193612a7d565b6020026020010181815250508d82815181106121b1576121b1612a7d565b6020026020010180518091906121c690612a45565b9052506001881b81178d83815181106121e1576121e1612a7d565b6020026020010181815250505b506121fc565b6001016120ca565b50600101612098565b5050508594505050509550959350505050565b60606000835167ffffffffffffffff811115612236576122366127c3565b60405190808252806020026020018201604052801561225f578160200160208202803683370190505b509050600360005b8551811015612336578185828151811061228357612283612a7d565b602002602001015110156122e9578481815181106122a3576122a3612a7d565b6020026020010151826040517f2b13aef5000000000000000000000000000000000000000000000000000000008152600401610754929190918252602082015260400190565b600061230d87838151811061230057612300612a7d565b6020026020010151611352565b90508084838151811061232257612322612a7d565b602090810291909101015250600101612267565b5090949350505050565b600061236a7fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b6001017fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385550565b60006123bc7f3d01e4d77237ea0f771f1786da4d4ff757fcba6a92933aa53b1dcef2d6bd6fe25490565b905060006123e87fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b905060006123f582611812565b929092555050565b6124078282610db7565b6000612490836124357fc68d7f1ee07d8668991a8951e720010c9d44c2f11c06b5cac61fbc40832639385490565b60408051602081018490529081018290527f4dd0c77efa6f6d590c97573d8c70b714546e7311202ff7c11c484cc841d91bfc606082015260009060800160405160208183030381529060405280519060200120905092915050565b919091555050565b60007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82111561254a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f53616665436173743a2076616c756520646f65736e27742066697420696e206160448201527f6e20696e743235360000000000000000000000000000000000000000000000006064820152608401610754565b5090565b60003682900380359060208101359060400135831a601b8114801590612578575060ff8116601c14155b156125b2576040517f666b7cba00000000000000000000000000000000000000000000000000000000815260048101879052602401610754565b7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a082111561260f576040517f666b7cba00000000000000000000000000000000000000000000000000000000815260048101879052602401610754565b60408051600081526020810180835288905260ff831691810191909152606081018490526080810183905260019060a0016020604051602081039080840390855afa158015612662573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015194505073ffffffffffffffffffffffffffffffffffffffff84166126dd576040517f666b7cba00000000000000000000000000000000000000000000000000000000815260048101879052602401610754565b50505092915050565b600080806126f48536612a32565b905080359250602081013591506021841061273e576040517fc000fc4200000000000000000000000000000000000000000000000000000000815260048101859052602401610754565b8360200360080282901c9150509250929050565b6000806040838503121561276557600080fd5b50508035926020909101359150565b60006020828403121561278657600080fd5b813573ffffffffffffffffffffffffffffffffffffffff8116811461176757600080fd5b6000602082840312156127bc57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612839576128396127c3565b604052919050565b600067ffffffffffffffff82111561285b5761285b6127c3565b5060051b60200190565b6000602080838503121561287857600080fd5b823567ffffffffffffffff81111561288f57600080fd5b8301601f810185136128a057600080fd5b80356128b36128ae82612841565b6127f2565b81815260059190911b820183019083810190878311156128d257600080fd5b928401925b828410156128f0578335825292840192908401906128d7565b979650505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561293357835183529284019291840191600101612917565b50909695505050505050565b600060208083528351808285015260005b8181101561296c57858101830151858201604001528201612950565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b6000602082840312156129bd57600080fd5b813569ffffffffffffffffffff8116811461176757600080fd5b6000602082840312156129e957600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561096a5761096a6129f0565b8181038181111561096a5761096a6129f0565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612a7657612a766129f0565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b80516fffffffffffffffffffffffffffffffff8116811461094257600080fd5b600080600060608486031215612ae157600080fd5b83519250612af160208501612aac565b9150612aff60408501612aac565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006fffffffffffffffffffffffffffffffff80841680612b5a57612b5a612b08565b92169190910492915050565b600082612b7557612b75612b08565b500490565b808202811582820484141761096a5761096a6129f0565b600082612ba057612ba0612b08565b50069056fea264697066735822122052d444403621a2f697804c30b8ce7032f4d86390ff4333b385db79cc659e106064736f6c63430008110033","source_code":"// SPDX-License-Identifier: BUSL-1.1\n\npragma solidity ^0.8.17;\n\nimport {MergedPriceFeedAdapterWithRoundsPrimaryProd} from \"@redstone-finance/evm-adapters/contracts/price-feeds/data-services/MergedPriceFeedAdapterWithRoundsPrimaryProd.sol\";\nimport {OldGelatoAddress, GelatoAddress} from \"../__addresses/Addresses.sol\";\n\ncontract EthereumMergedAdapterWithRoundsSpkccNavV1 is MergedPriceFeedAdapterWithRoundsPrimaryProd {\n\n  address internal constant MAIN_UPDATER_ADDRESS = 0xBE085EF98eEedfEf036E33B623bBB44a5D105A3E;\n  address internal constant FALLBACK_UPDATER_ADDRESS = 0xCf443a92236D75d2F9288c7Dc1021a2499E846B7;\n  address internal constant MANUAL_UPDATER_ADDRESS = 0x6BD3bb71e0bDbb6213FC31743b9A1f29E71DC950;\n\n  error UpdaterNotAuthorised(address signer);\n\n  function getDataFeedId() public pure virtual override returns (bytes32) {\n    return bytes32(\"SPKCC_NAV\");\n  }\n\n  function requireAuthorisedUpdater(address updater) public view override virtual {\n    if (\n      updater != MAIN_UPDATER_ADDRESS &&\n      updater != FALLBACK_UPDATER_ADDRESS &&\n      updater != MANUAL_UPDATER_ADDRESS &&\n      updater != GelatoAddress.ADDR &&\n      updater != OldGelatoAddress.ADDR\n    ) {\n      revert UpdaterNotAuthorised(updater);\n    }\n  }\n}\n","creation_status":"success","file_path":"contracts/ethereumSpkccNav/EthereumMergedAdapterWithRoundsSpkccNavV1.sol"}