{
    "Function": "excessivelySafeStaticCall",
    "File": "contracts/contracts/nomad-core/libs/ExcessivelySafeCall.sol",
    "Parent Contracts": [],
    "High-Level Calls": [],
    "Internal Calls": [
        "returndatacopy(uint256,uint256,uint256)",
        "mload(uint256)",
        "mstore(uint256,uint256)",
        "returndatasize()",
        "staticcall(uint256,uint256,uint256,uint256,uint256,uint256)"
    ],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "function excessivelySafeStaticCall(\n    address _target,\n    uint256 _gas,\n    uint16 _maxCopy,\n    bytes memory _calldata\n  ) internal view returns (bool, bytes memory) {\n    // set up for assembly call\n    uint256 _toCopy;\n    bool _success;\n    bytes memory _returnData = new bytes(_maxCopy);\n    // dispatch message to recipient\n    // by assembly calling \"handle\" function\n    // we call via assembly to avoid memcopying a very large returndata\n    // returned by a malicious contract\n    assembly {\n      _success := staticcall(\n        _gas, // gas\n        _target, // recipient\n        add(_calldata, 0x20), // inloc\n        mload(_calldata), // inlen\n        0, // outloc\n        0 // outlen\n      )\n      // limit our copy to 256 bytes\n      _toCopy := returndatasize()\n      if gt(_toCopy, _maxCopy) {\n        _toCopy := _maxCopy\n      }\n      // Store the length of the copied bytes\n      mstore(_returnData, _toCopy)\n      // copy the bytes from returndata[0:_toCopy]\n      returndatacopy(add(_returnData, 0x20), 0, _toCopy)\n    }\n    return (_success, _returnData);\n  }"
}