@gooddollar/goodcontracts
Version:
GoodDollar Contracts
1,097 lines • 301 kB
JSON
{
"contractName": "SafeERC20",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.4+commit.9549d8ff\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@daostack/arc/contracts/libs/SafeERC20.sol\":\"SafeERC20\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@daostack/arc/contracts/libs/SafeERC20.sol\":{\"keccak256\":\"0xf6727d432f67046145b078f40c1cc4f6be7b0d12a6678ecaf457edf7550d244c\",\"urls\":[\"bzzr://cd706a2dc7540d093b591a280b464256c596ddad598b68886e6db2e7958f9916\"]},\"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x079c4e23ee448f529e43bfa3c4e8fb4be52cd0318ee923a276835bedf45b93d8\",\"urls\":[\"bzzr://48248e86f64407a95f241d6c5c8cfea6b4d4ebf4ebb467e5c98c8af3868fafe4\"]},\"openzeppelin-solidity/contracts/utils/Address.sol\":{\"keccak256\":\"0x5c731061b804fa256fc8c05150eafe5d20b6bb94541a8f187912bf84f7033f34\",\"urls\":[\"bzzr://63fc4af0d7a99a770925b96a6cf48f25fc00d30274266f82db05f30baa238267\"]}},\"version\":1}",
"bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea165627a7a723058208a680bd431902a61b641c479e843f6f416fc94d4f7dbf37c3c6c20172866f34a0029",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea165627a7a723058208a680bd431902a61b641c479e843f6f416fc94d4f7dbf37c3c6c20172866f34a0029",
"sourceMap": "613:2351:47:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24",
"deployedSourceMap": "613:2351:47:-;;;;;;;;",
"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": [
9335
]
},
"id": 9336,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 9117,
"literals": [
"solidity",
"^",
"0.5",
".4"
],
"nodeType": "PragmaDirective",
"src": "462:23:47"
},
{
"absolutePath": "openzeppelin-solidity/contracts/utils/Address.sol",
"file": "openzeppelin-solidity/contracts/utils/Address.sol",
"id": 9118,
"nodeType": "ImportDirective",
"scope": 9336,
"sourceUnit": 16768,
"src": "487:59:47",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol",
"file": "openzeppelin-solidity/contracts/token/ERC20/IERC20.sol",
"id": 9119,
"nodeType": "ImportDirective",
"scope": 9336,
"sourceUnit": 16749,
"src": "547:64:47",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 9335,
"linearizedBaseContracts": [
9335
],
"name": "SafeERC20",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 9122,
"libraryName": {
"contractScope": null,
"id": 9120,
"name": "Address",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 16767,
"src": "643:7:47",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Address_$16767",
"typeString": "library Address"
}
},
"nodeType": "UsingForDirective",
"src": "637:26:47",
"typeName": {
"id": 9121,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "655:7:47",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
},
{
"constant": true,
"id": 9131,
"name": "TRANSFER_SELECTOR",
"nodeType": "VariableDeclaration",
"scope": 9335,
"src": "669:97:47",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 9123,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "669:6:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "7472616e7366657228616464726573732c75696e7432353629",
"id": 9127,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "736:27:47",
"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": 9126,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "730:5:47",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes_storage_ptr_$",
"typeString": "type(bytes storage pointer)"
},
"typeName": "bytes"
},
"id": 9128,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "730:34:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 9125,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16776,
"src": "720:9:47",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 9129,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "720:45:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 9124,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "713:6:47",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes4_$",
"typeString": "type(bytes4)"
},
"typeName": "bytes4"
},
"id": 9130,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "713:53:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"visibility": "private"
},
{
"constant": true,
"id": 9140,
"name": "TRANSFERFROM_SELECTOR",
"nodeType": "VariableDeclaration",
"scope": 9335,
"src": "772:113:47",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 9132,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "772:6:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "7472616e7366657246726f6d28616464726573732c616464726573732c75696e7432353629",
"id": 9136,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "843:39:47",
"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": 9135,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "837:5:47",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes_storage_ptr_$",
"typeString": "type(bytes storage pointer)"
},
"typeName": "bytes"
},
"id": 9137,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "837:46:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 9134,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16776,
"src": "827:9:47",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 9138,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "827:57:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 9133,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "820:6:47",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes4_$",
"typeString": "type(bytes4)"
},
"typeName": "bytes4"
},
"id": 9139,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "820:65:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"visibility": "private"
},
{
"constant": true,
"id": 9149,
"name": "APPROVE_SELECTOR",
"nodeType": "VariableDeclaration",
"scope": 9335,
"src": "891:95:47",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 9141,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "891:6:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "617070726f766528616464726573732c75696e7432353629",
"id": 9145,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "957:26:47",
"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": 9144,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "951:5:47",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes_storage_ptr_$",
"typeString": "type(bytes storage pointer)"
},
"typeName": "bytes"
},
"id": 9146,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "951:33:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 9143,
"name": "keccak256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16776,
"src": "941:9:47",
"typeDescriptions": {
"typeIdentifier": "t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$",
"typeString": "function (bytes memory) pure returns (bytes32)"
}
},
"id": 9147,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "941:44:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"id": 9142,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "934:6:47",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes4_$",
"typeString": "type(bytes4)"
},
"typeName": "bytes4"
},
"id": 9148,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "934:52:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"visibility": "private"
},
{
"body": {
"id": 9202,
"nodeType": "Block",
"src": "1073:487:47",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 9159,
"name": "_erc20Addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9151,
"src": "1134:10:47",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 9160,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "isContract",
"nodeType": "MemberAccess",
"referencedDeclaration": 16766,
"src": "1134:21:47",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_bool_$bound_to$_t_address_$",
"typeString": "function (address) view returns (bool)"
}
},
"id": 9161,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1134:23:47",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 9158,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
16785,
16786
],
"referencedDeclaration": 16785,
"src": "1126:7:47",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 9162,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1126:32:47",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 9163,
"nodeType": "ExpressionStatement",
"src": "1126:32:47"
},
{
"assignments": [
9165,
9167
],
"declarations": [
{
"constant": false,
"id": 9165,
"name": "success",
"nodeType": "VariableDeclaration",
"scope": 9202,
"src": "1170:12:47",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 9164,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1170:4:47",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 9167,
"name": "returnValue",
"nodeType": "VariableDeclaration",
"scope": 9202,
"src": "1184:24:47",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 9166,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "1184:5:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 9177,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 9172,
"name": "TRANSFER_SELECTOR",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9131,
"src": "1318:17:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
{
"argumentTypes": null,
"id": 9173,
"name": "_to",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9153,
"src": "1337:3:47",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 9174,
"name": "_value",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9155,
"src": "1342:6:47",
"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": 9170,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16769,
"src": "1295:3:47",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 9171,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodeWithSelector",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1295:22:47",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (bytes4) pure returns (bytes memory)"
}
},
"id": 9175,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1295:54:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"expression": {
"argumentTypes": null,
"id": 9168,
"name": "_erc20Addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9151,
"src": "1279:10:47",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 9169,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "call",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1279:15:47",
"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": 9176,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1279:71:47",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_bytes_memory_ptr_$",
"typeString": "tuple(bool,bytes memory)"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "1169:181:47"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 9179,
"name": "success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9165,
"src": "1418:7:47",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 9178,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
16785,
16786
],
"referencedDeclaration": 16785,
"src": "1410:7:47",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 9180,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1410:16:47",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 9181,
"nodeType": "ExpressionStatement",
"src": "1410:16:47"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 9199,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 9186,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 9183,
"name": "returnValue",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9167,
"src": "1473:11:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"id": 9184,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1473:18:47",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 9185,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1495:1:47",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1473:23:47",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "||",
"rightExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 9197,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 9190,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 9187,
"name": "returnValue",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9167,
"src": "1501:11:47",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"id": 9188,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1501:18:47",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "3332",
"id": 9189,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1523:2:47",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_32_by_1",
"typeString": "int_const 32"
},
"value": "32"
},
"src": "1501:24:47",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"commonTyp