{
    "Function": "callOperator",
    "File": "contracts/libraries/OperatorHelpers.sol",
    "Parent Contracts": [],
    "High-Level Calls": [
        "IOperatorSelector",
        "IOperatorSelector"
    ],
    "Internal Calls": [
        "abi.encode()",
        "bytes.concat()"
    ],
    "Library Calls": [],
    "Low-Level Calls": [
        "delegatecall"
    ],
    "Code": "function callOperator(\n        address _operator,\n        bool _commit,\n        bytes calldata _calldata\n    ) internal returns (bool success, bytes memory data) {\n        // The operator address needs to be the first parameter of the operator delegatecall.\n        // We assume that the calldata given by the user are only the params, without the signature.\n        // Parameters are concatenated and padded to 32 bytes.\n        // We are concatenating the selector + operator address + given params\n        bytes4 selector;\n        if (_commit) {\n            selector = IOperatorSelector(_operator).getCommitSelector();\n        } else {\n            selector = IOperatorSelector(_operator).getRevertSelector();\n        }\n\n        bytes memory safeCalldata = bytes.concat(selector, abi.encode(_operator), _calldata);\n\n        (success, data) = _operator.delegatecall(safeCalldata);\n    }"
}