UNPKG

@ethsub/sol

Version:
967 lines 364 kB
{ "contractName": "Address", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Collection of functions related to the address type\",\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/utils/Address.sol\":\"Address\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x28911e614500ae7c607a432a709d35da25f3bc5ddc8bd12b278b66358070c0ea\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://256c8c8af5eb072bc473226ab2b2187149b8fc04f5f4a4820db22527f5ce8e3c\",\"dweb:/ipfs/QmRvi5BhnL7Rxf85KrJhwM6RRhukm4tzoctRdgQEheNyiN\"]}},\"version\":1}", "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212208ccfd6fd57b84258d9d7208fb0633d819ed9b25da91dfd0a18e11c3cdeae554c64736f6c634300060c0033", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212208ccfd6fd57b84258d9d7208fb0633d819ed9b25da91dfd0a18e11c3cdeae554c64736f6c634300060c0033", "immutableReferences": {}, "sourceMap": "134:7684:27:-:0;;;;;;;;;;;;;;;;;;;;;;;;;", "deployedSourceMap": "134:7684:27:-:0;;;;;;;;", "source": "// SPDX-License-Identifier: MIT\n\npragma solidity >=0.6.2 <0.8.0;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize, which returns 0 for contracts in\n // construction, since the code is only stored at the end of the\n // constructor execution.\n\n uint256 size;\n // solhint-disable-next-line no-inline-assembly\n assembly { size := extcodesize(account) }\n return size > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n // solhint-disable-next-line avoid-low-level-calls, avoid-call-value\n (bool success, ) = recipient.call{ value: amount }(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain`call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.call{ value: value }(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.staticcall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return _verifyCallResult(success, returndata, errorMessage);\n }\n\n function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n\n // solhint-disable-next-line no-inline-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n", "sourcePath": "@openzeppelin/contracts/utils/Address.sol", "ast": { "absolutePath": "@openzeppelin/contracts/utils/Address.sol", "exportedSymbols": { "Address": [ 4818 ] }, "id": 4819, "license": "MIT", "nodeType": "SourceUnit", "nodes": [ { "id": 4524, "literals": [ "solidity", ">=", "0.6", ".2", "<", "0.8", ".0" ], "nodeType": "PragmaDirective", "src": "33:31:27" }, { "abstract": false, "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": { "id": 4525, "nodeType": "StructuredDocumentation", "src": "66:67:27", "text": " @dev Collection of functions related to the address type" }, "fullyImplemented": true, "id": 4818, "linearizedBaseContracts": [ 4818 ], "name": "Address", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 4541, "nodeType": "Block", "src": "792:347:27", "statements": [ { "assignments": [ 4534 ], "declarations": [ { "constant": false, "id": 4534, "mutability": "mutable", "name": "size", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4541, "src": "989:12:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4533, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "989:7:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 4535, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "989:12:27" }, { "AST": { "nodeType": "YulBlock", "src": "1076:32:27", "statements": [ { "nodeType": "YulAssignment", "src": "1078:28:27", "value": { "arguments": [ { "name": "account", "nodeType": "YulIdentifier", "src": "1098:7:27" } ], "functionName": { "name": "extcodesize", "nodeType": "YulIdentifier", "src": "1086:11:27" }, "nodeType": "YulFunctionCall", "src": "1086:20:27" }, "variableNames": [ { "name": "size", "nodeType": "YulIdentifier", "src": "1078:4:27" } ] } ] }, "evmVersion": "istanbul", "externalReferences": [ { "declaration": 4528, "isOffset": false, "isSlot": false, "src": "1098:7:27", "valueSize": 1 }, { "declaration": 4534, "isOffset": false, "isSlot": false, "src": "1078:4:27", "valueSize": 1 } ], "id": 4536, "nodeType": "InlineAssembly", "src": "1067:41:27" }, { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4539, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 4537, "name": "size", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4534, "src": "1124:4:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 4538, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1131:1:27", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1124:8:27", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 4532, "id": 4540, "nodeType": "Return", "src": "1117:15:27" } ] }, "documentation": { "id": 4526, "nodeType": "StructuredDocumentation", "src": "156:565:27", "text": " @dev Returns true if `account` is a contract.\n [IMPORTANT]\n ====\n It is unsafe to assume that an address for which this function returns\n false is an externally-owned account (EOA) and not a contract.\n Among others, `isContract` will return false for the following\n types of addresses:\n - an externally-owned account\n - a contract in construction\n - an address where a contract will be created\n - an address where a contract lived, but was destroyed\n ====" }, "id": 4542, "implemented": true, "kind": "function", "modifiers": [], "name": "isContract", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 4529, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4528, "mutability": "mutable", "name": "account", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4542, "src": "746:15:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4527, "name": "address", "nodeType": "ElementaryTypeName", "src": "746:7:27", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "745:17:27" }, "returnParameters": { "id": 4532, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4531, "mutability": "mutable", "name": "", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4542, "src": "786:4:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 4530, "name": "bool", "nodeType": "ElementaryTypeName", "src": "786:4:27", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "785:6:27" }, "scope": 4818, "src": "726:413:27", "stateMutability": "view", "virtual": false, "visibility": "internal" }, { "body": { "id": 4575, "nodeType": "Block", "src": "2127:320:27", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4557, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 4553, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": -28, "src": "2153:4:27", "typeDescriptions": { "typeIdentifier": "t_contract$_Address_$4818", "typeString": "library Address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Address_$4818", "typeString": "library Address" } ], "id": 4552, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "2145:7:27", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": { "id": 4551, "name": "address", "nodeType": "ElementaryTypeName", "src": "2145:7:27", "typeDescriptions": { "typeIdentifier": null, "typeString": null } } }, "id": 4554, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2145:13:27", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 4555, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "balance", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2145:21:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 4556, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4547, "src": "2170:6:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "2145:31:27", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "416464726573733a20696e73756666696369656e742062616c616e6365", "id": 4558, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2178:31:27", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_5597a22abd0ef5332f8053862eb236db7590f17e2b93a53f63a103becfb561f9", "typeString": "literal_string \"Address: insufficient balance\"" }, "value": "Address: insufficient balance" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_5597a22abd0ef5332f8053862eb236db7590f17e2b93a53f63a103becfb561f9", "typeString": "literal_string \"Address: insufficient balance\"" } ], "id": 4550, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "2137:7:27", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 4559, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2137:73:27", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 4560, "nodeType": "ExpressionStatement", "src": "2137:73:27" }, { "assignments": [ 4562, null ], "declarations": [ { "constant": false, "id": 4562, "mutability": "mutable", "name": "success", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4575, "src": "2299:12:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 4561, "name": "bool", "nodeType": "ElementaryTypeName", "src": "2299:4:27", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" }, null ], "id": 4569, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "", "id": 4567, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2349:2:27", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", "typeString": "literal_string \"\"" }, "value": "" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", "typeString": "literal_string \"\"" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470", "typeString": "literal_string \"\"" } ], "expression": { "argumentTypes": null, "id": 4563, "name": "recipient", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4545, "src": "2317:9:27", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "id": 4564, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "call", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "2317:14:27", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "function (bytes memory) payable returns (bool,bytes memory)" } }, "id": 4566, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "names": [ "value" ], "nodeType": "FunctionCallOptions", "options": [ { "argumentTypes": null, "id": 4565, "name": "amount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4547, "src": "2340:6:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "src": "2317:31:27", "typeDescriptions": { "typeIdentifier": "t_function_barecall_payable$_t_bytes_memory_ptr_$returns$_t_bool_$_t_bytes_memory_ptr_$value", "typeString": "function (bytes memory) payable returns (bool,bytes memory)" } }, "id": 4568, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2317:35:27", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "tuple(bool,bytes memory)" } }, "nodeType": "VariableDeclarationStatement", "src": "2298:54:27" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 4571, "name": "success", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4562, "src": "2370:7:27", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, { "argumentTypes": null, "hexValue": "416464726573733a20756e61626c6520746f2073656e642076616c75652c20726563697069656e74206d61792068617665207265766572746564", "id": 4572, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "2379:60:27", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_51ddaa38748c0a1144620fb5bfe8edab31ea437571ad591a7734bbfd0429aeae", "typeString": "literal_string \"Address: unable to send value, recipient may have reverted\"" }, "value": "Address: unable to send value, recipient may have reverted" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" }, { "typeIdentifier": "t_stringliteral_51ddaa38748c0a1144620fb5bfe8edab31ea437571ad591a7734bbfd0429aeae", "typeString": "literal_string \"Address: unable to send value, recipient may have reverted\"" } ], "id": 4570, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ -18, -18 ], "referencedDeclaration": -18, "src": "2362:7:27", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", "typeString": "function (bool,string memory) pure" } }, "id": 4573, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "2362:78:27", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 4574, "nodeType": "ExpressionStatement", "src": "2362:78:27" } ] }, "documentation": { "id": 4543, "nodeType": "StructuredDocumentation", "src": "1145:906:27", "text": " @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n `recipient`, forwarding all available gas and reverting on errors.\n https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n of certain opcodes, possibly making contracts go over the 2300 gas limit\n imposed by `transfer`, making them unable to receive funds via\n `transfer`. {sendValue} removes this limitation.\n https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n IMPORTANT: because control is transferred to `recipient`, care must be\n taken to not create reentrancy vulnerabilities. Consider using\n {ReentrancyGuard} or the\n https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]." }, "id": 4576, "implemented": true, "kind": "function", "modifiers": [], "name": "sendValue", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 4548, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4545, "mutability": "mutable", "name": "recipient", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4576, "src": "2075:25:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, "typeName": { "id": 4544, "name": "address", "nodeType": "ElementaryTypeName", "src": "2075:15:27", "stateMutability": "payable", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4547, "mutability": "mutable", "name": "amount", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4576, "src": "2102:14:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4546, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "2102:7:27", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "2074:43:27" }, "returnParameters": { "id": 4549, "nodeType": "ParameterList", "parameters": [], "src": "2127:0:27" }, "scope": 4818, "src": "2056:391:27", "stateMutability": "nonpayable", "virtual": false, "visibility": "internal" }, { "body": { "id": 4592, "nodeType": "Block", "src": "3277:82:27", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 4587, "name": "target", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4579, "src": "3305:6:27", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 4588, "name": "data", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4581, "src": "3313:4:27", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, { "argumentTypes": null, "hexValue": "416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564", "id": 4589, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "3319:32:27", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_24d7ab5d382116e64324f19950ca9340b8af1ddeb09a8d026e0a3c6a01dcc9df", "typeString": "literal_string \"Address: low-level call failed\"" }, "value": "Address: low-level call failed" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" }, { "typeIdentifier": "t_stringliteral_24d7ab5d382116e64324f19950ca9340b8af1ddeb09a8d026e0a3c6a01dcc9df", "typeString": "literal_string \"Address: low-level call failed\"" } ], "id": 4586, "name": "functionCall", "nodeType": "Identifier", "overloadedDeclarations": [ 4593, 4613 ], "referencedDeclaration": 4613, "src": "3292:12:27", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$_t_bytes_memory_ptr_$", "typeString": "function (address,bytes memory,string memory) returns (bytes memory)" } }, "id": 4590, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "3292:60:27", "tryCall": false, "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, "functionReturnParameters": 4585, "id": 4591, "nodeType": "Return", "src": "3285:67:27" } ] }, "documentation": { "id": 4577, "nodeType": "StructuredDocumentation", "src": "2453:730:27", "text": " @dev Performs a Solidity function call using a low level `call`. A\n plain`call` is an unsafe replacement for a function call: use this\n function instead.\n If `target` reverts with a revert reason, it is bubbled up by this\n function (like regular Solidity function calls).\n Returns the raw returned data. To convert to the expected return value,\n use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n Requirements:\n - `target` must be a contract.\n - calling `target` with `data` must not revert.\n _Available since v3.1._" }, "id": 4593, "implemented": true, "kind": "function", "modifiers": [], "name": "functionCall", "nodeType": "FunctionDefinition", "overrides": null, "parameters": { "id": 4582, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4579, "mutability": "mutable", "name": "target", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4593, "src": "3210:14:27", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4578, "name": "address", "nodeType": "ElementaryTypeName", "src": "3210:7:27", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4581, "mutability": "mutable", "name": "data", "nodeType": "VariableDeclaration", "overrides": null, "scope": 4593, "src": "3226:17:27", "stateVariable": false, "storageLocation": "