{
    "Function": "_payForServiceHook",
    "File": "src/contracts/middleware/PaymentManager.sol",
    "Parent Contracts": [
        "src/contracts/permissions/Pausable.sol",
        "src/contracts/interfaces/IPausable.sol",
        "src/contracts/interfaces/IPaymentManager.sol",
        "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [
        "abi.encodeWithSelector()",
        "mload(uint256)",
        "call(uint256,uint256,uint256,uint256,uint256,uint256,uint256)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function _payForServiceHook(IDelegationTerms dt, uint256 amount) internal {\n        /**\n         * We use low-level call functionality here to ensure that an operator cannot maliciously make this function fail in order to prevent undelegation.\n         * In particular, in-line assembly is also used to prevent the copying of uncapped return data which is also a potential DoS vector.\n         */\n        // format calldata\n        bytes memory lowLevelCalldata = abi.encodeWithSelector(IDelegationTerms.payForService.selector, paymentToken, amount);\n        // Prepare memory for low-level call return data. We accept a max return data length of 32 bytes\n        bool success;\n        bytes32[1] memory returnData;\n        // actually make the call\n        assembly {\n            success := call(\n                // gas provided to this context\n                LOW_LEVEL_GAS_BUDGET,\n                // address to call\n                dt,\n                // value in wei for call\n                0,\n                // memory location to copy for calldata\n                add(lowLevelCalldata, 32),\n                // length of memory to copy for calldata\n                mload(lowLevelCalldata),\n                // memory location to copy return data\n                returnData,\n                // byte size of return data to copy to memory\n                32\n            )\n        }\n        // if the call fails, we emit a special event rather than reverting\n        if (!success) {\n            emit OnPayForServiceCallFailure(dt, returnData[0]);\n        }\n    }"
}