creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "src/v0.8/interfaces/ChainlinkRequestInterface.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ChainlinkRequestInterface {\n  function oracleRequest(\n    address sender,\n    uint256 requestPrice,\n    bytes32 serviceAgreementID,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 nonce,\n    uint256 dataVersion,\n    bytes calldata data\n  ) external;\n\n  function cancelOracleRequest(\n    bytes32 requestId,\n    uint256 payment,\n    bytes4 callbackFunctionId,\n    uint256 expiration\n  ) external;\n}\n"
      },
      "src/v0.8/interfaces/OperatorInterface.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {OracleInterface} from \"./OracleInterface.sol\";\nimport {ChainlinkRequestInterface} from \"./ChainlinkRequestInterface.sol\";\n\ninterface OperatorInterface is OracleInterface, ChainlinkRequestInterface {\n  function operatorRequest(\n    address sender,\n    uint256 payment,\n    bytes32 specId,\n    bytes4 callbackFunctionId,\n    uint256 nonce,\n    uint256 dataVersion,\n    bytes calldata data\n  ) external;\n\n  function fulfillOracleRequest2(\n    bytes32 requestId,\n    uint256 payment,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 expiration,\n    bytes calldata data\n  ) external returns (bool);\n\n  function ownerTransferAndCall(address to, uint256 value, bytes calldata data) external returns (bool success);\n\n  function distributeFunds(address payable[] calldata receivers, uint256[] calldata amounts) external payable;\n}\n"
      },
      "src/v0.8/interfaces/OracleInterface.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface OracleInterface {\n  function fulfillOracleRequest(\n    bytes32 requestId,\n    uint256 payment,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 expiration,\n    bytes32 data\n  ) external returns (bool);\n\n  function withdraw(address recipient, uint256 amount) external;\n\n  function withdrawable() external view returns (uint256);\n}\n"
      },
      "src/v0.8/operatorforwarder/AuthorizedReceiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport {IAuthorizedReceiver} from \"./interfaces/IAuthorizedReceiver.sol\";\n\n// solhint-disable gas-custom-errors\nabstract contract AuthorizedReceiver is IAuthorizedReceiver {\n  mapping(address sender => bool authorized) private s_authorizedSenders;\n  address[] private s_authorizedSenderList;\n\n  event AuthorizedSendersChanged(address[] senders, address changedBy);\n\n  // @notice Sets the fulfillment permission for a given node. Use `true` to allow, `false` to disallow.\n  // @param senders The addresses of the authorized Chainlink node\n  function setAuthorizedSenders(address[] calldata senders) external override validateAuthorizedSenderSetter {\n    require(senders.length > 0, \"Must have at least 1 sender\");\n    // Set previous authorized senders to false\n    uint256 authorizedSendersLength = s_authorizedSenderList.length;\n    for (uint256 i = 0; i < authorizedSendersLength; ++i) {\n      s_authorizedSenders[s_authorizedSenderList[i]] = false;\n    }\n    // Set new to true\n    for (uint256 i = 0; i < senders.length; ++i) {\n      require(s_authorizedSenders[senders[i]] == false, \"Must not have duplicate senders\");\n      s_authorizedSenders[senders[i]] = true;\n    }\n    // Replace list\n    s_authorizedSenderList = senders;\n    emit AuthorizedSendersChanged(senders, msg.sender);\n  }\n\n  // @notice Retrieve a list of authorized senders\n  // @return array of addresses\n  function getAuthorizedSenders() external view override returns (address[] memory) {\n    return s_authorizedSenderList;\n  }\n\n  // @notice Use this to check if a node is authorized for fulfilling requests\n  // @param sender The address of the Chainlink node\n  // @return The authorization status of the node\n  function isAuthorizedSender(address sender) public view override returns (bool) {\n    return s_authorizedSenders[sender];\n  }\n\n  // @notice customizable guard of who can update the authorized sender list\n  // @return bool whether sender can update authorized sender list\n  function _canSetAuthorizedSenders() internal virtual returns (bool);\n\n  // @notice validates the sender is an authorized sender\n  function _validateIsAuthorizedSender() internal view {\n    require(isAuthorizedSender(msg.sender), \"Not authorized sender\");\n  }\n\n  // @notice prevents non-authorized addresses from calling this method\n  modifier validateAuthorizedSender() {\n    _validateIsAuthorizedSender();\n    _;\n  }\n\n  // @notice prevents non-authorized addresses from calling this method\n  modifier validateAuthorizedSenderSetter() {\n    require(_canSetAuthorizedSenders(), \"Cannot set authorized senders\");\n    _;\n  }\n}\n"
      },
      "src/v0.8/operatorforwarder/LinkTokenReceiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\n// solhint-disable gas-custom-errors\nabstract contract LinkTokenReceiver {\n  // @notice Called when LINK is sent to the contract via `transferAndCall`\n  // @dev The data payload's first 2 words will be overwritten by the `sender` and `amount`\n  // values to ensure correctness. Calls oracleRequest.\n  // @param sender Address of the sender\n  // @param amount Amount of LINK sent (specified in wei)\n  // @param data Payload of the transaction\n  function onTokenTransfer(\n    address sender,\n    uint256 amount,\n    bytes memory data\n  ) public validateFromLINK permittedFunctionsForLINK(data) {\n    assembly {\n      // solhint-disable-next-line avoid-low-level-calls\n      mstore(add(data, 36), sender) // ensure correct sender is passed\n      // solhint-disable-next-line avoid-low-level-calls\n      mstore(add(data, 68), amount) // ensure correct amount is passed0.8.19\n    }\n    // solhint-disable-next-line avoid-low-level-calls\n    (bool success, ) = address(this).delegatecall(data); // calls oracleRequest\n    require(success, \"Unable to create request\");\n  }\n\n  function getChainlinkToken() public view virtual returns (address);\n\n  // @notice Validate the function called on token transfer\n  function _validateTokenTransferAction(bytes4 funcSelector, bytes memory data) internal virtual;\n\n  // @dev Reverts if not sent from the LINK token\n  modifier validateFromLINK() {\n    require(msg.sender == getChainlinkToken(), \"Must use LINK token\");\n    _;\n  }\n\n  // @dev Reverts if the given data does not begin with the `oracleRequest` function selector\n  // @param data The data payload of the request\n  modifier permittedFunctionsForLINK(bytes memory data) {\n    bytes4 funcSelector;\n    assembly {\n      // solhint-disable-next-line avoid-low-level-calls\n      funcSelector := mload(add(data, 32))\n    }\n    _validateTokenTransferAction(funcSelector, data);\n    _;\n  }\n}\n"
      },
      "src/v0.8/operatorforwarder/Operator.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.19;\n\nimport {AuthorizedReceiver} from \"./AuthorizedReceiver.sol\";\nimport {LinkTokenReceiver} from \"./LinkTokenReceiver.sol\";\nimport {ConfirmedOwner} from \"../shared/access/ConfirmedOwner.sol\";\nimport {LinkTokenInterface} from \"../shared/interfaces/LinkTokenInterface.sol\";\nimport {IAuthorizedReceiver} from \"./interfaces/IAuthorizedReceiver.sol\";\nimport {OperatorInterface} from \"../interfaces/OperatorInterface.sol\";\nimport {IOwnable} from \"../shared/interfaces/IOwnable.sol\";\nimport {IWithdrawal} from \"./interfaces/IWithdrawal.sol\";\nimport {OracleInterface} from \"../interfaces/OracleInterface.sol\";\nimport {SafeCast} from \"../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/math/SafeCast.sol\";\n\n// @title The Chainlink Operator contract\n// @notice Node operators can deploy this contract to fulfill requests sent to them\n// solhint-disable gas-custom-errors\ncontract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, OperatorInterface, IWithdrawal {\n  struct Commitment {\n    bytes31 paramsHash;\n    uint8 dataVersion;\n  }\n\n  uint256 public constant EXPIRYTIME = 5 minutes;\n  uint256 private constant MAXIMUM_DATA_VERSION = 256;\n  uint256 private constant MINIMUM_CONSUMER_GAS_LIMIT = 400000;\n  uint256 private constant SELECTOR_LENGTH = 4;\n  uint256 private constant EXPECTED_REQUEST_WORDS = 2;\n  uint256 private constant MINIMUM_REQUEST_LENGTH = SELECTOR_LENGTH + (32 * EXPECTED_REQUEST_WORDS);\n  // We initialize fields to 1 instead of 0 so that the first invocation\n  // does not cost more gas.\n  uint256 private constant ONE_FOR_CONSISTENT_GAS_COST = 1;\n  // oracleRequest is intended for version 1, enabling single word responses\n  bytes4 private constant ORACLE_REQUEST_SELECTOR = this.oracleRequest.selector;\n  // operatorRequest is intended for version 2, enabling multi-word responses\n  bytes4 private constant OPERATOR_REQUEST_SELECTOR = this.operatorRequest.selector;\n\n  LinkTokenInterface internal immutable i_linkToken;\n  mapping(bytes32 => Commitment) private s_commitments;\n  mapping(address => bool) private s_owned;\n  // Tokens sent for requests that have not been fulfilled yet\n  uint256 private s_tokensInEscrow = ONE_FOR_CONSISTENT_GAS_COST;\n\n  event OracleRequest(\n    bytes32 indexed specId,\n    address requester,\n    bytes32 requestId,\n    uint256 payment,\n    address callbackAddr,\n    bytes4 callbackFunctionId,\n    uint256 cancelExpiration,\n    uint256 dataVersion,\n    bytes data\n  );\n\n  event CancelOracleRequest(bytes32 indexed requestId);\n\n  event OracleResponse(bytes32 indexed requestId);\n\n  event OwnableContractAccepted(address indexed acceptedContract);\n\n  event TargetsUpdatedAuthorizedSenders(address[] targets, address[] senders, address changedBy);\n\n  // @notice Deploy with the address of the LINK token\n  // @dev Sets the LinkToken address for the imported LinkTokenInterface\n  // @param link The address of the LINK token\n  // @param owner The address of the owner\n  constructor(address link, address owner) ConfirmedOwner(owner) {\n    i_linkToken = LinkTokenInterface(link); // external but already deployed and unalterable\n  }\n\n  string public constant typeAndVersion = \"Operator 1.0.0\";\n\n  // @notice Creates the Chainlink request. This is a backwards compatible API\n  // with the Oracle.sol contract, but the behavior changes because\n  // callbackAddress is assumed to be the same as the request sender.\n  // @param callbackAddress The consumer of the request\n  // @param payment The amount of payment given (specified in wei)\n  // @param specId The Job Specification ID\n  // @param callbackAddress The address the oracle data will be sent to\n  // @param callbackFunctionId The callback function ID for the response\n  // @param nonce The nonce sent by the requester\n  // @param dataVersion The specified data version\n  // @param data The extra request parameters\n  function oracleRequest(\n    address sender,\n    uint256 payment,\n    bytes32 specId,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 nonce,\n    uint256 dataVersion,\n    bytes calldata data\n  ) external override validateFromLINK {\n    (bytes32 requestId, uint256 expiration) = _verifyAndProcessOracleRequest(\n      sender,\n      payment,\n      callbackAddress,\n      callbackFunctionId,\n      nonce,\n      dataVersion\n    );\n    emit OracleRequest(specId, sender, requestId, payment, sender, callbackFunctionId, expiration, dataVersion, data);\n  }\n\n  // @notice Creates the Chainlink request\n  // @dev Stores the hash of the params as the on-chain commitment for the request.\n  // Emits OracleRequest event for the Chainlink node to detect.\n  // @param sender The sender of the request\n  // @param payment The amount of payment given (specified in wei)\n  // @param specId The Job Specification ID\n  // @param callbackFunctionId The callback function ID for the response\n  // @param nonce The nonce sent by the requester\n  // @param dataVersion The specified data version\n  // @param data The extra request parameters\n  function operatorRequest(\n    address sender,\n    uint256 payment,\n    bytes32 specId,\n    bytes4 callbackFunctionId,\n    uint256 nonce,\n    uint256 dataVersion,\n    bytes calldata data\n  ) external override validateFromLINK {\n    (bytes32 requestId, uint256 expiration) = _verifyAndProcessOracleRequest(\n      sender,\n      payment,\n      sender,\n      callbackFunctionId,\n      nonce,\n      dataVersion\n    );\n    emit OracleRequest(specId, sender, requestId, payment, sender, callbackFunctionId, expiration, dataVersion, data);\n  }\n\n  // @notice Called by the Chainlink node to fulfill requests\n  // @dev Given params must hash back to the commitment stored from `oracleRequest`.\n  // Will call the callback address' callback function without bubbling up error\n  // checking in a `require` so that the node can get paid.\n  // @param requestId The fulfillment request ID that must match the requester's\n  // @param payment The payment amount that will be released for the oracle (specified in wei)\n  // @param callbackAddress The callback address to call for fulfillment\n  // @param callbackFunctionId The callback function ID to use for fulfillment\n  // @param expiration The expiration that the node should respond by before the requester can cancel\n  // @param data The data to return to the consuming contract\n  // @return Status if the external call was successful\n  function fulfillOracleRequest(\n    bytes32 requestId,\n    uint256 payment,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 expiration,\n    bytes32 data\n  )\n    external\n    override\n    validateAuthorizedSender\n    validateRequestId(requestId)\n    validateCallbackAddress(callbackAddress)\n    returns (bool)\n  {\n    _verifyOracleRequestAndProcessPayment(requestId, payment, callbackAddress, callbackFunctionId, expiration, 1);\n    emit OracleResponse(requestId);\n    require(gasleft() >= MINIMUM_CONSUMER_GAS_LIMIT, \"Must provide consumer enough gas\");\n    // All updates to the oracle's fulfillment should come before calling the\n    // callback(addr+functionId) as it is untrusted.\n    // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern\n    (bool success, ) = callbackAddress.call(abi.encodeWithSelector(callbackFunctionId, requestId, data)); // solhint-disable-line avoid-low-level-calls\n    return success;\n  }\n\n  // @notice Called by the Chainlink node to fulfill requests with multi-word support\n  // @dev Given params must hash back to the commitment stored from `oracleRequest`.\n  // Will call the callback address' callback function without bubbling up error\n  // checking in a `require` so that the node can get paid.\n  // @param requestId The fulfillment request ID that must match the requester's\n  // @param payment The payment amount that will be released for the oracle (specified in wei)\n  // @param callbackAddress The callback address to call for fulfillment\n  // @param callbackFunctionId The callback function ID to use for fulfillment\n  // @param expiration The expiration that the node should respond by before the requester can cancel\n  // @param data The data to return to the consuming contract\n  // @return Status if the external call was successful\n  function fulfillOracleRequest2(\n    bytes32 requestId,\n    uint256 payment,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 expiration,\n    bytes calldata data\n  )\n    external\n    override\n    validateAuthorizedSender\n    validateRequestId(requestId)\n    validateCallbackAddress(callbackAddress)\n    validateMultiWordResponseId(requestId, data)\n    returns (bool)\n  {\n    _verifyOracleRequestAndProcessPayment(requestId, payment, callbackAddress, callbackFunctionId, expiration, 2);\n    emit OracleResponse(requestId);\n    require(gasleft() >= MINIMUM_CONSUMER_GAS_LIMIT, \"Must provide consumer enough gas\");\n    // All updates to the oracle's fulfillment should come before calling the\n    // callback(addr+functionId) as it is untrusted.\n    // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern\n    (bool success, ) = callbackAddress.call(abi.encodePacked(callbackFunctionId, data)); // solhint-disable-line avoid-low-level-calls\n    return success;\n  }\n\n  // @notice Transfer the ownership of ownable contracts. This is primarily\n  // intended for Authorized Forwarders but could possibly be extended to work\n  // with future contracts.OracleInterface\n  // @param ownable list of addresses to transfer\n  // @param newOwner address to transfer ownership to\n  function transferOwnableContracts(address[] calldata ownable, address newOwner) external onlyOwner {\n    for (uint256 i = 0; i < ownable.length; ++i) {\n      s_owned[ownable[i]] = false;\n      IOwnable(ownable[i]).transferOwnership(newOwner);\n    }\n  }\n\n  // @notice Accept the ownership of an ownable contract. This is primarily\n  // intended for Authorized Forwarders but could possibly be extended to work\n  // with future contracts.\n  // @dev Must be the pending owner on the contract\n  // @param ownable list of addresses of Ownable contracts to accept\n  function acceptOwnableContracts(address[] calldata ownable) public validateAuthorizedSenderSetter {\n    for (uint256 i = 0; i < ownable.length; ++i) {\n      s_owned[ownable[i]] = true;\n      emit OwnableContractAccepted(ownable[i]);\n      IOwnable(ownable[i]).acceptOwnership();\n    }\n  }\n\n  // @notice Sets the fulfillment permission for\n  // @param targets The addresses to set permissions on\n  // @param senders The addresses that are allowed to send updates\n  function setAuthorizedSendersOn(\n    address[] calldata targets,\n    address[] calldata senders\n  ) public validateAuthorizedSenderSetter {\n    emit TargetsUpdatedAuthorizedSenders(targets, senders, msg.sender);\n\n    for (uint256 i = 0; i < targets.length; ++i) {\n      IAuthorizedReceiver(targets[i]).setAuthorizedSenders(senders);\n    }\n  }\n\n  // @notice Accepts ownership of ownable contracts and then immediately sets\n  // the authorized sender list on each of the newly owned contracts. This is\n  // primarily intended for Authorized Forwarders but could possibly be\n  // extended to work with future contracts.\n  // @param targets The addresses to set permissions on\n  // @param senders The addresses that are allowed to send updates\n  function acceptAuthorizedReceivers(\n    address[] calldata targets,\n    address[] calldata senders\n  ) external validateAuthorizedSenderSetter {\n    acceptOwnableContracts(targets);\n    setAuthorizedSendersOn(targets, senders);\n  }\n\n  // @notice Allows the node operator to withdraw earned LINK to a given address\n  // @dev The owner of the contract can be another wallet and does not have to be a Chainlink node\n  // @param recipient The address to send the LINK token to\n  // @param amount The amount to send (specified in wei)\n  function withdraw(\n    address recipient,\n    uint256 amount\n  ) external override(OracleInterface, IWithdrawal) onlyOwner validateAvailableFunds(amount) {\n    assert(i_linkToken.transfer(recipient, amount));\n  }\n\n  // @notice Displays the amount of LINK that is available for the node operator to withdraw\n  // @dev We use `ONE_FOR_CONSISTENT_GAS_COST` in place of 0 in storage\n  // @return The amount of withdrawable LINK on the contract\n  function withdrawable() external view override(OracleInterface, IWithdrawal) returns (uint256) {\n    return _fundsAvailable();\n  }\n\n  // @notice Forward a call to another contract\n  // @dev Only callable by the owner\n  // @param to address\n  // @param data to forward\n  function ownerForward(address to, bytes calldata data) external onlyOwner validateNotToLINK(to) {\n    require(to.code.length != 0, \"Must forward to a contract\");\n    // solhint-disable-next-line avoid-low-level-calls\n    (bool status, ) = to.call(data);\n    require(status, \"Forwarded call failed\");\n  }\n\n  // @notice Interact with other LinkTokenReceiver contracts by calling transferAndCall\n  // @param to The address to transfer to.\n  // @param value The amount to be transferred.\n  // @param data The extra data to be passed to the receiving contract.\n  // @return success bool\n  function ownerTransferAndCall(\n    address to,\n    uint256 value,\n    bytes calldata data\n  ) external override onlyOwner validateAvailableFunds(value) returns (bool success) {\n    return i_linkToken.transferAndCall(to, value, data);\n  }\n\n  // @notice Distribute funds to multiple addresses using ETH send\n  // to this payable function.\n  // @dev Array length must be equal, ETH sent must equal the sum of amounts.\n  // A malicious receiver could cause the distribution to revert, in which case\n  // it is expected that the address is removed from the list.\n  // @param receivers list of addresses\n  // @param amounts list of amounts\n  function distributeFunds(address payable[] calldata receivers, uint256[] calldata amounts) external payable {\n    require(receivers.length > 0 && receivers.length == amounts.length, \"Invalid array length(s)\");\n    uint256 valueRemaining = msg.value;\n    for (uint256 i = 0; i < receivers.length; ++i) {\n      uint256 sendAmount = amounts[i];\n      valueRemaining = valueRemaining - sendAmount;\n      (bool success, ) = receivers[i].call{value: sendAmount}(\"\");\n      require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n    require(valueRemaining == 0, \"Too much ETH sent\");\n  }\n\n  // @notice Allows recipient to cancel requests sent to this oracle contract.\n  // Will transfer the LINK sent for the request back to the recipient address.\n  // @dev Given params must hash to a commitment stored on the contract in order\n  // for the request to be valid. Emits CancelOracleRequest event.\n  // @param requestId The request ID\n  // @param payment The amount of payment given (specified in wei)\n  // @param callbackFunc The requester's specified callback function selector\n  // @param expiration The time of the expiration for the request\n  function cancelOracleRequest(\n    bytes32 requestId,\n    uint256 payment,\n    bytes4 callbackFunc,\n    uint256 expiration\n  ) public override {\n    bytes31 paramsHash = _buildParamsHash(payment, msg.sender, callbackFunc, expiration);\n    require(s_commitments[requestId].paramsHash == paramsHash, \"Params do not match request ID\");\n    // solhint-disable-next-line not-rely-on-time\n    require(expiration <= block.timestamp, \"Request is not expired\");\n\n    delete s_commitments[requestId];\n    emit CancelOracleRequest(requestId);\n\n    // Free up the escrowed funds, as we're sending them back to the requester\n    s_tokensInEscrow -= payment;\n    i_linkToken.transfer(msg.sender, payment);\n  }\n\n  // @notice Allows requester to cancel requests sent to this oracle contract.\n  // Will transfer the LINK sent for the request back to the recipient address.\n  // @dev Given params must hash to a commitment stored on the contract in order\n  // for the request to be valid. Emits CancelOracleRequest event.\n  // @param nonce The nonce used to generate the request ID\n  // @param payment The amount of payment given (specified in wei)\n  // @param callbackFunc The requester's specified callback function selector\n  // @param expiration The time of the expiration for the request\n  function cancelOracleRequestByRequester(\n    uint256 nonce,\n    uint256 payment,\n    bytes4 callbackFunc,\n    uint256 expiration\n  ) external {\n    cancelOracleRequest(keccak256(abi.encodePacked(msg.sender, nonce)), payment, callbackFunc, expiration);\n  }\n\n  // @notice Returns the address of the LINK token\n  // @dev This is the public implementation for chainlinkTokenAddress, which is\n  // an internal method of the ChainlinkClient contract\n  function getChainlinkToken() public view override returns (address) {\n    return address(i_linkToken);\n  }\n\n  // @notice Require that the token transfer action is valid\n  // @dev OPERATOR_REQUEST_SELECTOR = multiword, ORACLE_REQUEST_SELECTOR = singleword\n  function _validateTokenTransferAction(bytes4 funcSelector, bytes memory data) internal pure override {\n    require(data.length >= MINIMUM_REQUEST_LENGTH, \"Invalid request length\");\n    require(\n      funcSelector == OPERATOR_REQUEST_SELECTOR || funcSelector == ORACLE_REQUEST_SELECTOR,\n      \"Must use whitelisted functions\"\n    );\n  }\n\n  // @notice Verify the Oracle Request and record necessary information\n  // @param sender The sender of the request\n  // @param payment The amount of payment given (specified in wei)\n  // @param callbackAddress The callback address for the response\n  // @param callbackFunctionId The callback function ID for the response\n  // @param nonce The nonce sent by the requester\n  function _verifyAndProcessOracleRequest(\n    address sender,\n    uint256 payment,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 nonce,\n    uint256 dataVersion\n  ) private validateNotToLINK(callbackAddress) returns (bytes32 requestId, uint256 expiration) {\n    requestId = keccak256(abi.encodePacked(sender, nonce));\n    require(s_commitments[requestId].paramsHash == 0, \"Must use a unique ID\");\n    // solhint-disable-next-line not-rely-on-time\n    expiration = block.timestamp + EXPIRYTIME;\n    bytes31 paramsHash = _buildParamsHash(payment, callbackAddress, callbackFunctionId, expiration);\n    s_commitments[requestId] = Commitment(paramsHash, SafeCast.toUint8(dataVersion));\n    s_tokensInEscrow = s_tokensInEscrow + payment;\n    return (requestId, expiration);\n  }\n\n  // @notice Verify the Oracle request and unlock escrowed payment\n  // @param requestId The fulfillment request ID that must match the requester's\n  // @param payment The payment amount that will be released for the oracle (specified in wei)\n  // @param callbackAddress The callback address to call for fulfillment\n  // @param callbackFunctionId The callback function ID to use for fulfillment\n  // @param expiration The expiration that the node should respond by before the requester can cancel\n  function _verifyOracleRequestAndProcessPayment(\n    bytes32 requestId,\n    uint256 payment,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 expiration,\n    uint256 dataVersion\n  ) internal {\n    bytes31 paramsHash = _buildParamsHash(payment, callbackAddress, callbackFunctionId, expiration);\n    require(s_commitments[requestId].paramsHash == paramsHash, \"Params do not match request ID\");\n    require(s_commitments[requestId].dataVersion <= SafeCast.toUint8(dataVersion), \"Data versions must match\");\n    s_tokensInEscrow = s_tokensInEscrow - payment;\n    delete s_commitments[requestId];\n  }\n\n  // @notice Build the bytes31 hash from the payment, callback and expiration.\n  // @param payment The payment amount that will be released for the oracle (specified in wei)\n  // @param callbackAddress The callback address to call for fulfillment\n  // @param callbackFunctionId The callback function ID to use for fulfillment\n  // @param expiration The expiration that the node should respond by before the requester can cancel\n  // @return hash bytes31\n  function _buildParamsHash(\n    uint256 payment,\n    address callbackAddress,\n    bytes4 callbackFunctionId,\n    uint256 expiration\n  ) internal pure returns (bytes31) {\n    return bytes31(keccak256(abi.encodePacked(payment, callbackAddress, callbackFunctionId, expiration)));\n  }\n\n  // @notice Returns the LINK available in this contract, not locked in escrow\n  // @return uint256 LINK tokens available\n  function _fundsAvailable() private view returns (uint256) {\n    return i_linkToken.balanceOf(address(this)) - (s_tokensInEscrow - ONE_FOR_CONSISTENT_GAS_COST);\n  }\n\n  // @notice concrete implementation of AuthorizedReceiver\n  // @return bool of whether sender is authorized\n  function _canSetAuthorizedSenders() internal view override returns (bool) {\n    return isAuthorizedSender(msg.sender) || owner() == msg.sender;\n  }\n\n  // MODIFIERS\n\n  // @dev Reverts if the first 32 bytes of the bytes array is not equal to requestId\n  // @param requestId bytes32\n  // @param data bytes\n  modifier validateMultiWordResponseId(bytes32 requestId, bytes calldata data) {\n    require(data.length >= 32, \"Response must be > 32 bytes\");\n    bytes32 firstDataWord;\n    assembly {\n      firstDataWord := calldataload(data.offset)\n    }\n    require(requestId == firstDataWord, \"First word must be requestId\");\n    _;\n  }\n\n  // @dev Reverts if amount requested is greater than withdrawable balance\n  // @param amount The given amount to compare to `s_withdrawableTokens`\n  modifier validateAvailableFunds(uint256 amount) {\n    require(_fundsAvailable() >= amount, \"Amount requested is greater than withdrawable balance\");\n    _;\n  }\n\n  // @dev Reverts if request ID does not exist\n  // @param requestId The given request ID to check in stored `commitments`\n  modifier validateRequestId(bytes32 requestId) {\n    require(s_commitments[requestId].paramsHash != 0, \"Must have a valid requestId\");\n    _;\n  }\n\n  // @dev Reverts if the callback address is the LINK token\n  // @param to The callback address\n  modifier validateNotToLINK(address to) {\n    require(to != address(i_linkToken), \"Cannot call to LINK\");\n    _;\n  }\n\n  // @dev Reverts if the target address is owned by the operator\n  modifier validateCallbackAddress(address callbackAddress) {\n    require(!s_owned[callbackAddress], \"Cannot call owned contract\");\n    _;\n  }\n}\n"
      },
      "src/v0.8/operatorforwarder/interfaces/IAuthorizedReceiver.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IAuthorizedReceiver {\n  function isAuthorizedSender(address sender) external view returns (bool);\n\n  function getAuthorizedSenders() external returns (address[] memory);\n\n  function setAuthorizedSenders(address[] calldata senders) external;\n}\n"
      },
      "src/v0.8/operatorforwarder/interfaces/IWithdrawal.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWithdrawal {\n  // @notice transfer LINK held by the contract belonging to msg.sender to\n  // another address\n  // @param recipient is the address to send the LINK to\n  // @param amount is the amount of LINK to send\n  function withdraw(address recipient, uint256 amount) external;\n\n  // @notice query the available amount of LINK to withdraw by msg.sender\n  function withdrawable() external view returns (uint256);\n}\n"
      },
      "src/v0.8/shared/access/ConfirmedOwner.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ConfirmedOwnerWithProposal} from \"./ConfirmedOwnerWithProposal.sol\";\n\n/// @title The ConfirmedOwner contract\n/// @notice A contract with helpers for basic contract ownership.\ncontract ConfirmedOwner is ConfirmedOwnerWithProposal {\n  constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {}\n}\n"
      },
      "src/v0.8/shared/access/ConfirmedOwnerWithProposal.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IOwnable} from \"../interfaces/IOwnable.sol\";\n\n/// @title The ConfirmedOwner contract\n/// @notice A contract with helpers for basic contract ownership.\ncontract ConfirmedOwnerWithProposal is IOwnable {\n  address private s_owner;\n  address private s_pendingOwner;\n\n  event OwnershipTransferRequested(address indexed from, address indexed to);\n  event OwnershipTransferred(address indexed from, address indexed to);\n\n  constructor(address newOwner, address pendingOwner) {\n    // solhint-disable-next-line gas-custom-errors\n    require(newOwner != address(0), \"Cannot set owner to zero\");\n\n    s_owner = newOwner;\n    if (pendingOwner != address(0)) {\n      _transferOwnership(pendingOwner);\n    }\n  }\n\n  /// @notice Allows an owner to begin transferring ownership to a new address.\n  function transferOwnership(address to) public override onlyOwner {\n    _transferOwnership(to);\n  }\n\n  /// @notice Allows an ownership transfer to be completed by the recipient.\n  function acceptOwnership() external override {\n    // solhint-disable-next-line gas-custom-errors\n    require(msg.sender == s_pendingOwner, \"Must be proposed owner\");\n\n    address oldOwner = s_owner;\n    s_owner = msg.sender;\n    s_pendingOwner = address(0);\n\n    emit OwnershipTransferred(oldOwner, msg.sender);\n  }\n\n  /// @notice Get the current owner\n  function owner() public view override returns (address) {\n    return s_owner;\n  }\n\n  /// @notice validate, transfer ownership, and emit relevant events\n  function _transferOwnership(address to) private {\n    // solhint-disable-next-line gas-custom-errors\n    require(to != msg.sender, \"Cannot transfer to self\");\n\n    s_pendingOwner = to;\n\n    emit OwnershipTransferRequested(s_owner, to);\n  }\n\n  /// @notice validate access\n  function _validateOwnership() internal view {\n    // solhint-disable-next-line gas-custom-errors\n    require(msg.sender == s_owner, \"Only callable by owner\");\n  }\n\n  /// @notice Reverts if called by anyone other than the contract owner.\n  modifier onlyOwner() {\n    _validateOwnership();\n    _;\n  }\n}\n"
      },
      "src/v0.8/shared/interfaces/IOwnable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IOwnable {\n  function owner() external returns (address);\n\n  function transferOwnership(address recipient) external;\n\n  function acceptOwnership() external;\n}\n"
      },
      "src/v0.8/shared/interfaces/LinkTokenInterface.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface LinkTokenInterface {\n  function allowance(address owner, address spender) external view returns (uint256 remaining);\n\n  function approve(address spender, uint256 value) external returns (bool success);\n\n  function balanceOf(address owner) external view returns (uint256 balance);\n\n  function decimals() external view returns (uint8 decimalPlaces);\n\n  function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);\n\n  function increaseApproval(address spender, uint256 subtractedValue) external;\n\n  function name() external view returns (string memory tokenName);\n\n  function symbol() external view returns (string memory tokenSymbol);\n\n  function totalSupply() external view returns (uint256 totalTokensIssued);\n\n  function transfer(address to, uint256 value) external returns (bool success);\n\n  function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool success);\n\n  function transferFrom(address from, address to, uint256 value) external returns (bool success);\n}\n"
      },
      "src/v0.8/vendor/openzeppelin-solidity/v4.8.3/contracts/utils/math/SafeCast.sol": {
        "content": "// 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"
      }
    },
    "settings": {
      "remappings": [
        "ds-test/=foundry-lib/forge-std/lib/ds-test/src/",
        "forge-std/=foundry-lib/forge-std/src/",
        "@openzeppelin/=node_modules/@openzeppelin/",
        "hardhat/=node_modules/hardhat/",
        "@eth-optimism/=node_modules/@eth-optimism/",
        "@scroll-tech/=node_modules/@scroll-tech/",
        "erc4626-tests/=foundry-lib/openzeppelin-contracts/lib/erc4626-tests/",
        "openzeppelin-contracts/=foundry-lib/openzeppelin-contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 1000000
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "none",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}