UNPKG

@gooddollar/goodcontracts

Version:
1,092 lines (1,091 loc) 301 kB
{ "contractName": "SafeERC20", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@daostack/arc/contracts/libs/SafeERC20.sol\":\"SafeERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@daostack/arc/contracts/libs/SafeERC20.sol\":{\"keccak256\":\"0xf6727d432f67046145b078f40c1cc4f6be7b0d12a6678ecaf457edf7550d244c\",\"urls\":[\"bzz-raw://5dba7734c4fed446c084a707761cbc66ba22b8b93ef53c8d4a22a76b6e271690\",\"dweb:/ipfs/QmP2VpPKUqLh4ZZs6LaxHVpCN1zCmiorygL9bMub4mbYCw\"]},\"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x079c4e23ee448f529e43bfa3c4e8fb4be52cd0318ee923a276835bedf45b93d8\",\"urls\":[\"bzz-raw://ee762ff5b7746e41d27dcbcea00c7a3034b58adb1b45ddadddb5b721aff450df\",\"dweb:/ipfs/QmdxqtgEFZjHCoiYyz6pUAQ5iBm7As25jcyEbZoTaAgyDa\"]},\"openzeppelin-solidity/contracts/utils/Address.sol\":{\"keccak256\":\"0x5c731061b804fa256fc8c05150eafe5d20b6bb94541a8f187912bf84f7033f34\",\"urls\":[\"bzz-raw://a3c2d9f046beebab7fb41b1b124a6a124a36f510f7c67365861402ac831bdc71\",\"dweb:/ipfs/QmUtASRgitregbKH83anopLtF9vFQe3BKeAjhUa6F7t9YV\"]}},\"version\":1}", "bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820f1482a58aa9e0ce09b569447d4796864674a8c740915b55f1881e0ad51df851b64736f6c63430005100032", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72315820f1482a58aa9e0ce09b569447d4796864674a8c740915b55f1881e0ad51df851b64736f6c63430005100032", "sourceMap": "613:2351:56:-;;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": "613:2351:56:-;;;;;;;;", "source": "/*\n\nSafeERC20 by daostack.\nThe code is based on a fix by SECBIT Team.\n\nUSE WITH CAUTION & NO WARRANTY\n\nREFERENCE & RELATED READING\n- https://github.com/ethereum/solidity/issues/4116\n- https://medium.com/@chris_77367/explaining-unexpected-reverts-starting-with-solidity-0-4-22-3ada6e82308c\n- https://medium.com/coinmonks/missing-return-value-bug-at-least-130-tokens-affected-d67bf08521ca\n- https://gist.github.com/BrendanChou/88a2eeb80947ff00bcf58ffdafeaeb61\n\n*/\npragma solidity ^0.5.4;\n\nimport \"openzeppelin-solidity/contracts/utils/Address.sol\";\nimport \"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol\";\n\nlibrary SafeERC20 {\n using Address for address;\n\n bytes4 constant private TRANSFER_SELECTOR = bytes4(keccak256(bytes(\"transfer(address,uint256)\")));\n bytes4 constant private TRANSFERFROM_SELECTOR = bytes4(keccak256(bytes(\"transferFrom(address,address,uint256)\")));\n bytes4 constant private APPROVE_SELECTOR = bytes4(keccak256(bytes(\"approve(address,uint256)\")));\n\n function safeTransfer(address _erc20Addr, address _to, uint256 _value) internal {\n\n // Must be a contract addr first!\n require(_erc20Addr.isContract());\n\n (bool success, bytes memory returnValue) =\n // solhint-disable-next-line avoid-low-level-calls\n _erc20Addr.call(abi.encodeWithSelector(TRANSFER_SELECTOR, _to, _value));\n // call return false when something wrong\n require(success);\n //check return value\n require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));\n }\n\n function safeTransferFrom(address _erc20Addr, address _from, address _to, uint256 _value) internal {\n\n // Must be a contract addr first!\n require(_erc20Addr.isContract());\n\n (bool success, bytes memory returnValue) =\n // solhint-disable-next-line avoid-low-level-calls\n _erc20Addr.call(abi.encodeWithSelector(TRANSFERFROM_SELECTOR, _from, _to, _value));\n // call return false when something wrong\n require(success);\n //check return value\n require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));\n }\n\n function safeApprove(address _erc20Addr, address _spender, uint256 _value) internal {\n\n // Must be a contract addr first!\n require(_erc20Addr.isContract());\n\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero.\n require((_value == 0) || (IERC20(_erc20Addr).allowance(address(this), _spender) == 0));\n\n (bool success, bytes memory returnValue) =\n // solhint-disable-next-line avoid-low-level-calls\n _erc20Addr.call(abi.encodeWithSelector(APPROVE_SELECTOR, _spender, _value));\n // call return false when something wrong\n require(success);\n //check return value\n require(returnValue.length == 0 || (returnValue.length == 32 && (returnValue[31] != 0)));\n }\n}\n", "sourcePath": "@daostack/arc/contracts/libs/SafeERC20.sol", "ast": { "absolutePath": "@daostack/arc/contracts/libs/SafeERC20.sol", "exportedSymbols": { "SafeERC20": [ 14724 ] }, "id": 14725, "nodeType": "SourceUnit", "nodes": [ { "id": 14506, "literals": [ "solidity", "^", "0.5", ".4" ], "nodeType": "PragmaDirective", "src": "462:23:56" }, { "absolutePath": "openzeppelin-solidity/contracts/utils/Address.sol", "file": "openzeppelin-solidity/contracts/utils/Address.sol", "id": 14507, "nodeType": "ImportDirective", "scope": 14725, "sourceUnit": 22157, "src": "487:59:56", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol", "file": "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol", "id": 14508, "nodeType": "ImportDirective", "scope": 14725, "sourceUnit": 22138, "src": "547:64:56", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": null, "fullyImplemented": true, "id": 14724, "linearizedBaseContracts": [ 14724 ], "name": "SafeERC20", "nodeType": "ContractDefinition", "nodes": [ { "id": 14511, "libraryName": { "contractScope": null, "id": 14509, "name": "Address", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 22156, "src": "643:7:56", "typeDescriptions": { "typeIdentifier": "t_contract$_Address_$22156", "typeString": "library Address" } }, "nodeType": "UsingForDirective", "src": "637:26:56", "typeName": { "id": 14510, "name": "address", "nodeType": "ElementaryTypeName", "src": "655:7:56", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } }, { "constant": true, "id": 14520, "name": "TRANSFER_SELECTOR", "nodeType": "VariableDeclaration", "scope": 14724, "src": "669:97:56", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "typeName": { "id": 14512, "name": "bytes4", "nodeType": "ElementaryTypeName", "src": "669:6:56", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "value": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "7472616e7366657228616464726573732c75696e7432353629", "id": 14516, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "736:27:56", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_a9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b", "typeString": "literal_string \"transfer(address,uint256)\"" }, "value": "transfer(address,uint256)" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_a9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b", "typeString": "literal_string \"transfer(address,uint256)\"" } ], "id": 14515, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "730:5:56", "typeDescriptions": { "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", "typeString": "type(bytes storage pointer)" }, "typeName": "bytes" }, "id": 14517, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "730:34:56", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } ], "id": 14514, "name": "keccak256", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22165, "src": "720:9:56", "typeDescriptions": { "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", "typeString": "function (bytes memory) pure returns (bytes32)" } }, "id": 14518, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "720:45:56", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } ], "id": 14513, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "713:6:56", "typeDescriptions": { "typeIdentifier": "t_type$_t_bytes4_$", "typeString": "type(bytes4)" }, "typeName": "bytes4" }, "id": 14519, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "713:53:56", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "visibility": "private" }, { "constant": true, "id": 14529, "name": "TRANSFERFROM_SELECTOR", "nodeType": "VariableDeclaration", "scope": 14724, "src": "772:113:56", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "typeName": { "id": 14521, "name": "bytes4", "nodeType": "ElementaryTypeName", "src": "772:6:56", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "value": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "7472616e7366657246726f6d28616464726573732c616464726573732c75696e7432353629", "id": 14525, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "843:39:56", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_23b872dd7302113369cda2901243429419bec145408fa8b352b3dd92b66c680b", "typeString": "literal_string \"transferFrom(address,address,uint256)\"" }, "value": "transferFrom(address,address,uint256)" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_23b872dd7302113369cda2901243429419bec145408fa8b352b3dd92b66c680b", "typeString": "literal_string \"transferFrom(address,address,uint256)\"" } ], "id": 14524, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "837:5:56", "typeDescriptions": { "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", "typeString": "type(bytes storage pointer)" }, "typeName": "bytes" }, "id": 14526, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "837:46:56", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } ], "id": 14523, "name": "keccak256", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22165, "src": "827:9:56", "typeDescriptions": { "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", "typeString": "function (bytes memory) pure returns (bytes32)" } }, "id": 14527, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "827:57:56", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } ], "id": 14522, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "820:6:56", "typeDescriptions": { "typeIdentifier": "t_type$_t_bytes4_$", "typeString": "type(bytes4)" }, "typeName": "bytes4" }, "id": 14528, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "820:65:56", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "visibility": "private" }, { "constant": true, "id": 14538, "name": "APPROVE_SELECTOR", "nodeType": "VariableDeclaration", "scope": 14724, "src": "891:95:56", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, "typeName": { "id": 14530, "name": "bytes4", "nodeType": "ElementaryTypeName", "src": "891:6:56", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "value": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "617070726f766528616464726573732c75696e7432353629", "id": 14534, "isConstant": false, "isLValue": false, "isPure": true, "kind": "string", "lValueRequested": false, "nodeType": "Literal", "src": "957:26:56", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_stringliteral_095ea7b334ae44009aa867bfb386f5c3b4b443ac6f0ee573fa91c4608fbadfba", "typeString": "literal_string \"approve(address,uint256)\"" }, "value": "approve(address,uint256)" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_stringliteral_095ea7b334ae44009aa867bfb386f5c3b4b443ac6f0ee573fa91c4608fbadfba", "typeString": "literal_string \"approve(address,uint256)\"" } ], "id": 14533, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "951:5:56", "typeDescriptions": { "typeIdentifier": "t_type$_t_bytes_storage_ptr_$", "typeString": "type(bytes storage pointer)" }, "typeName": "bytes" }, "id": 14535, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "951:33:56", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } ], "id": 14532, "name": "keccak256", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22165, "src": "941:9:56", "typeDescriptions": { "typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$", "typeString": "function (bytes memory) pure returns (bytes32)" } }, "id": 14536, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "941:44:56", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } ], "id": 14531, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "934:6:56", "typeDescriptions": { "typeIdentifier": "t_type$_t_bytes4_$", "typeString": "type(bytes4)" }, "typeName": "bytes4" }, "id": 14537, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "934:52:56", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, "visibility": "private" }, { "body": { "id": 14591, "nodeType": "Block", "src": "1073:487:56", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [], "expression": { "argumentTypes": [], "expression": { "argumentTypes": null, "id": 14548, "name": "_erc20Addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14540, "src": "1134:10:56", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 14549, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "isContract", "nodeType": "MemberAccess", "referencedDeclaration": 22155, "src": "1134:21:56", "typeDescriptions": { "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_bool_$bound_to$_t_address_$", "typeString": "function (address) view returns (bool)" } }, "id": 14550, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1134:23:56", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 14547, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 22174, 22175 ], "referencedDeclaration": 22174, "src": "1126:7:56", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 14551, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1126:32:56", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 14552, "nodeType": "ExpressionStatement", "src": "1126:32:56" }, { "assignments": [ 14554, 14556 ], "declarations": [ { "constant": false, "id": 14554, "name": "success", "nodeType": "VariableDeclaration", "scope": 14591, "src": "1170:12:56", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 14553, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1170:4:56", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 14556, "name": "returnValue", "nodeType": "VariableDeclaration", "scope": 14591, "src": "1184:24:56", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes" }, "typeName": { "id": 14555, "name": "bytes", "nodeType": "ElementaryTypeName", "src": "1184:5:56", "typeDescriptions": { "typeIdentifier": "t_bytes_storage_ptr", "typeString": "bytes" } }, "value": null, "visibility": "internal" } ], "id": 14566, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 14561, "name": "TRANSFER_SELECTOR", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14520, "src": "1318:17:56", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, { "argumentTypes": null, "id": 14562, "name": "_to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14542, "src": "1337:3:56", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 14563, "name": "_value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14544, "src": "1342:6:56", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 14559, "name": "abi", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22158, "src": "1295:3:56", "typeDescriptions": { "typeIdentifier": "t_magic_abi", "typeString": "abi" } }, "id": 14560, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "encodeWithSelector", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1295:22:56", "typeDescriptions": { "typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$", "typeString": "function (bytes4) pure returns (bytes memory)" } }, "id": 14564, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1295:54:56", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } ], "expression": { "argumentTypes": null, "id": 14557, "name": "_erc20Addr", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14540, "src": "1279:10:56", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 14558, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "call", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1279:15:56", "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": 14565, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1279:71:56", "typeDescriptions": { "typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$", "typeString": "tuple(bool,bytes memory)" } }, "nodeType": "VariableDeclarationStatement", "src": "1169:181:56" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 14568, "name": "success", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14554, "src": "1418:7:56", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 14567, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 22174, 22175 ], "referencedDeclaration": 22174, "src": "1410:7:56", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 14569, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1410:16:56", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 14570, "nodeType": "ExpressionStatement", "src": "1410:16:56" }, { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 14588, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 14575, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 14572, "name": "returnValue", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14556, "src": "1473:11:56", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, "id": 14573, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1473:18:56", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 14574, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1495:1:56", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1473:23:56", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "||", "rightExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 14586, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 14579, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 14576, "name": "returnValue", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 14556, "src": "1501:11:56", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } }, "id": 14577, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1501:18:56", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "3332", "id": 14578, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1523:2:56", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_32_by_1", "typeString": "int_const 32" }, "value": "32" }, "src": "1501:24:56", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&",