@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
1,138 lines (1,137 loc) • 80.3 kB
JSON
{
"contractName": "ExcessivelySafeCall",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"https://github.com/nomad-xyz\",\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/ExcessivelySafeCall.sol\":\"ExcessivelySafeCall\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/ExcessivelySafeCall.sol\":{\"keccak256\":\"0x9369468538c371057c907f84d438cec6b47673711fe289cc3779f8671314e06b\",\"urls\":[\"bzz-raw://0f59a670f4bc5cf1bd3dd58bdf6c31723d9d84d9da7d9283d6860cdf5f33b7c5\",\"dweb:/ipfs/QmTGuvD5WQD2z56GH35HoPJivKPeeEpbXidJVcbXZyT23C\"]}},\"version\":1}",
"bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820519bc9f4756fa17de73471c6d30fcff8d6254e970dde26c94391a255b68fe52064736f6c63430005100032",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820519bc9f4756fa17de73471c6d30fcff8d6254e970dde26c94391a255b68fe52064736f6c63430005100032",
"sourceMap": "669:2625:95:-;;132:2:-1;166:7;155:9;146:7;137:37;255:7;249:14;246:1;241:23;235:4;232:33;222:2;;269:9;222:2;293:9;290:1;283:20;323:4;314:7;306:22;347:7;338;331:24",
"deployedSourceMap": "669:2625:95:-;;;;;;;;",
"source": "/*\n\n Copyright 2022 Dolomite.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.7;\n\n\n/**\n * @author https://github.com/nomad-xyz\n */\nlibrary ExcessivelySafeCall {\n\n function safeStaticCall(\n address _target,\n bytes4 _selector,\n bytes memory _calldata\n ) internal view returns (bool isSuccess, bytes memory returnData) {\n (isSuccess, returnData) = _target.staticcall(abi.encodeWithSelector(_selector, _calldata));\n }\n\n /// @notice Use when you _really_ really _really_ don't trust the called\n /// contract. This prevents the called contract from causing reversion of\n /// the caller in as many ways as we can.\n /// @dev The main difference between this and a solidity low-level call is\n /// that we limit the number of bytes that the callee can cause to be\n /// copied to caller memory. This prevents stupid things like malicious\n /// contracts returning 10,000,000 bytes causing a local OOG when copying\n /// to memory.\n /// @param _target The address to call\n /// @param _gas The amount of gas to forward to the remote contract\n /// @param _maxCopy The maximum number of bytes of returndata to copy\n /// to memory.\n /// @param _calldata The data to send to the remote contract\n /// @return success and returndata, as `.call()`. Returndata is capped to\n /// `_maxCopy` bytes.\n function excessivelySafeCall(\n address _target,\n uint256 _gas,\n uint16 _maxCopy,\n bytes memory _calldata\n ) internal 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 mem-copying a very large returnData\n // returned by a malicious contract\n /* solium-disable security/no-inline-assembly */\n assembly {\n _success := call(\n _gas, // gas\n _target, // recipient\n 0, // ether value\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 /* solium-enable security/no-inline-assembly */\n return (_success, _returndata);\n }\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/ExcessivelySafeCall.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/ExcessivelySafeCall.sol",
"exportedSymbols": {
"ExcessivelySafeCall": [
27217
]
},
"id": 27218,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 27155,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:95"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@author https://github.com/nomad-xyz",
"fullyImplemented": true,
"id": 27217,
"linearizedBaseContracts": [
27217
],
"name": "ExcessivelySafeCall",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 27181,
"nodeType": "Block",
"src": "881:107:95",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 27179,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"id": 27168,
"name": "isSuccess",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27164,
"src": "892:9:95",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"id": 27169,
"name": "returnData",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27166,
"src": "903:10:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"id": 27170,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "891:23:95",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 27175,
"name": "_selector",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27159,
"src": "959:9:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
{
"argumentTypes": null,
"id": 27176,
"name": "_calldata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27161,
"src": "970:9:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"expression": {
"argumentTypes": null,
"id": 27173,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38094,
"src": "936:3:95",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 27174,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodeWithSelector",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "936:22:95",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (bytes4) pure returns (bytes memory)"
}
},
"id": 27177,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "936:44:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"expression": {
"argumentTypes": null,
"id": 27171,
"name": "_target",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27157,
"src": "917:7:95",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 27172,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "staticcall",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "917:18:95",
"typeDescriptions": {
"typeIdentifier": "t_function_barestaticcall_view$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "function (bytes memory) view returns (bool,bytes memory)"
}
},
"id": 27178,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "917:64:95",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"src": "891:90:95",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 27180,
"nodeType": "ExpressionStatement",
"src": "891:90:95"
}
]
},
"documentation": null,
"id": 27182,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "safeStaticCall",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 27162,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 27157,
"name": "_target",
"nodeType": "VariableDeclaration",
"scope": 27182,
"src": "737:15:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 27156,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "737:7:95",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27159,
"name": "_selector",
"nodeType": "VariableDeclaration",
"scope": 27182,
"src": "762:16:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 27158,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "762:6:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27161,
"name": "_calldata",
"nodeType": "VariableDeclaration",
"scope": 27182,
"src": "788:22:95",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 27160,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "788:5:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "727:89:95"
},
"returnParameters": {
"id": 27167,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 27164,
"name": "isSuccess",
"nodeType": "VariableDeclaration",
"scope": 27182,
"src": "840:14:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 27163,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "840:4:95",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27166,
"name": "returnData",
"nodeType": "VariableDeclaration",
"scope": 27182,
"src": "856:23:95",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 27165,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "856:5:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "839:41:95"
},
"scope": 27217,
"src": "704:284:95",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 27215,
"nodeType": "Block",
"src": "2075:1217:95",
"statements": [
{
"assignments": [
27198
],
"declarations": [
{
"constant": false,
"id": 27198,
"name": "_toCopy",
"nodeType": "VariableDeclaration",
"scope": 27215,
"src": "2121:15:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 27197,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2121:7:95",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 27199,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "2121:15:95"
},
{
"assignments": [
27201
],
"declarations": [
{
"constant": false,
"id": 27201,
"name": "_success",
"nodeType": "VariableDeclaration",
"scope": 27215,
"src": "2146:13:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 27200,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "2146:4:95",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 27202,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "2146:13:95"
},
{
"assignments": [
27204
],
"declarations": [
{
"constant": false,
"id": 27204,
"name": "_returndata",
"nodeType": "VariableDeclaration",
"scope": 27215,
"src": "2169:24:95",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 27203,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2169:5:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 27209,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 27207,
"name": "_maxCopy",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27188,
"src": "2206:8:95",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
],
"id": 27206,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "NewExpression",
"src": "2196:9:95",
"typeDescriptions": {
"typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$",
"typeString": "function (uint256) pure returns (bytes memory)"
},
"typeName": {
"id": 27205,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2200:5:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
}
},
"id": 27208,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "2196:19:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory",
"typeString": "bytes memory"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "2169:46:95"
},
{
"externalReferences": [
{
"_success": {
"declaration": 27201,
"isOffset": false,
"isSlot": false,
"src": "2516:8:95",
"valueSize": 1
}
},
{
"_calldata": {
"declaration": 27190,
"isOffset": false,
"isSlot": false,
"src": "2704:9:95",
"valueSize": 1
}
},
{
"_toCopy": {
"declaration": 27198,
"isOffset": false,
"isSlot": false,
"src": "2934:7:95",
"valueSize": 1
}
},
{
"_maxCopy": {
"declaration": 27188,
"isOffset": false,
"isSlot": false,
"src": "2945:8:95",
"valueSize": 1
}
},
{
"_toCopy": {
"declaration": 27198,
"isOffset": false,
"isSlot": false,
"src": "2851:7:95",
"valueSize": 1
}
},
{
"_calldata": {
"declaration": 27190,
"isOffset": false,
"isSlot": false,
"src": "2655:9:95",
"valueSize": 1
}
},
{
"_gas": {
"declaration": 27186,
"isOffset": false,
"isSlot": false,
"src": "2550:4:95",
"valueSize": 1
}
},
{
"_target": {
"declaration": 27184,
"isOffset": false,
"isSlot": false,
"src": "2579:7:95",
"valueSize": 1
}
},
{
"_toCopy": {
"declaration": 27198,
"isOffset": false,
"isSlot": false,
"src": "2897:7:95",
"valueSize": 1
}
},
{
"_maxCopy": {
"declaration": 27188,
"isOffset": false,
"isSlot": false,
"src": "2906:8:95",
"valueSize": 1
}
},
{
"_returndata": {
"declaration": 27204,
"isOffset": false,
"isSlot": false,
"src": "3039:11:95",
"valueSize": 1
}
},
{
"_toCopy": {
"declaration": 27198,
"isOffset": false,
"isSlot": false,
"src": "3052:7:95",
"valueSize": 1
}
},
{
"_returndata": {
"declaration": 27204,
"isOffset": false,
"isSlot": false,
"src": "3149:11:95",
"valueSize": 1
}
},
{
"_toCopy": {
"declaration": 27198,
"isOffset": false,
"isSlot": false,
"src": "3172:7:95",
"valueSize": 1
}
}
],
"id": 27210,
"nodeType": "InlineAssembly",
"operations": "{\n _success := call(_gas, _target, 0, add(_calldata, 0x20), mload(_calldata), 0, 0)\n _toCopy := returndatasize()\n if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy }\n mstore(_returndata, _toCopy)\n returndatacopy(add(_returndata, 0x20), 0, _toCopy)\n}",
"src": "2493:697:95"
},
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"id": 27211,
"name": "_success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27201,
"src": "3263:8:95",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"id": 27212,
"name": "_returndata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27204,
"src": "3273:11:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"id": 27213,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "3262:23:95",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"functionReturnParameters": 27196,
"id": 27214,
"nodeType": "Return",
"src": "3255:30:95"
}
]
},
"documentation": "@notice Use when you _really_ really _really_ don't trust the called\n contract. This prevents the called contract from causing reversion of\n the caller in as many ways as we can.\n @dev The main difference between this and a solidity low-level call is\n that we limit the number of bytes that the callee can cause to be\n copied to caller memory. This prevents stupid things like malicious\n contracts returning 10,000,000 bytes causing a local OOG when copying\n to memory.\n @param _target The address to call\n @param _gas The amount of gas to forward to the remote contract\n @param _maxCopy The maximum number of bytes of returndata to copy\n to memory.\n @param _calldata The data to send to the remote contract\n @return success and returndata, as `.call()`. Returndata is capped to\n `_maxCopy` bytes.",
"id": 27216,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "excessivelySafeCall",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 27191,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 27184,
"name": "_target",
"nodeType": "VariableDeclaration",
"scope": 27216,
"src": "1936:15:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 27183,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1936:7:95",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27186,
"name": "_gas",
"nodeType": "VariableDeclaration",
"scope": 27216,
"src": "1961:12:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 27185,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1961:7:95",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27188,
"name": "_maxCopy",
"nodeType": "VariableDeclaration",
"scope": 27216,
"src": "1983:15:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
},
"typeName": {
"id": 27187,
"name": "uint16",
"nodeType": "ElementaryTypeName",
"src": "1983:6:95",
"typeDescriptions": {
"typeIdentifier": "t_uint16",
"typeString": "uint16"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27190,
"name": "_calldata",
"nodeType": "VariableDeclaration",
"scope": 27216,
"src": "2008:22:95",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 27189,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2008:5:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1926:110:95"
},
"returnParameters": {
"id": 27196,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 27193,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 27216,
"src": "2055:4:95",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 27192,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "2055:4:95",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27195,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 27216,
"src": "2061:12:95",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 27194,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2061:5:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2054:20:95"
},
"scope": 27217,
"src": "1898:1394:95",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 27218,
"src": "669:2625:95"
}
],
"src": "595:2700:95"
},
"legacyAST": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/ExcessivelySafeCall.sol",
"exportedSymbols": {
"ExcessivelySafeCall": [
27217
]
},
"id": 27218,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 27155,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:95"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@author https://github.com/nomad-xyz",
"fullyImplemented": true,
"id": 27217,
"linearizedBaseContracts": [
27217
],
"name": "ExcessivelySafeCall",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 27181,
"nodeType": "Block",
"src": "881:107:95",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 27179,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"id": 27168,
"name": "isSuccess",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27164,
"src": "892:9:95",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"id": 27169,
"name": "returnData",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27166,
"src": "903:10:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"id": 27170,
"isConstant": false,
"isInlineArray": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "TupleExpression",
"src": "891:23:95",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 27175,
"name": "_selector",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27159,
"src": "959:9:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
{
"argumentTypes": null,
"id": 27176,
"name": "_calldata",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 27161,
"src": "970:9:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"expression": {
"argumentTypes": null,
"id": 27173,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38094,
"src": "936:3:95",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 27174,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodeWithSelector",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "936:22:95",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (bytes4) pure returns (bytes memory)"
}
},
"id": 27177,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "936:44:95",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}