UNPKG

@dolomite-exchange/dolomite-margin

Version:

Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol

1,011 lines (1,010 loc) 288 kB
{ "contractName": "SafeERC20", "abi": [], "metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"details\":\"Wrappers around ERC20 operations that throw on failure (when the token contract returns false). Tokens that return no value (and instead revert or throw on failure) are also supported, non-reverting calls are assumed to be successful. To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract, which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\",\"methods\":{},\"title\":\"SafeERC20\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\":\"SafeERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzz-raw://31113152e1ddb78fe7a4197f247591ca894e93f916867beb708d8e747b6cc74f\",\"dweb:/ipfs/QmbZaJyXdpsYGykVhHH9qpVGQg9DGCxE2QufbCUy3daTgq\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xe5bb0f57cff3e299f360052ba50f1ea0fff046df2be070b6943e0e3c3fdad8a9\",\"urls\":[\"bzz-raw://59fd025151435da35faa8093a5c7a17de02de9d08ad27275c5cdf05050820d91\",\"dweb:/ipfs/QmQMvwEcPhoRXzbXyrdoeRtvLoifUW9Qh7Luho7bmUPRkc\"]},\"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\":{\"keccak256\":\"0x6f2c9955d65c522b80f4b8792f076512d2df947d2112cbc4d98a4781ed42ede2\",\"urls\":[\"bzz-raw://7d8ec81683520c06baeef3f7e06cd82bd6fd5fa611f26857f475f6c829540aff\",\"dweb:/ipfs/QmTDkFzKnrpiV1UKnSoiZAHPuguWzokrr4pFbSPvyaSo56\"]},\"@openzeppelin/contracts/utils/Address.sol\":{\"keccak256\":\"0x1a8e5072509c5ea7365eb1d48030b9be865140c8fb779968da0a459a0e174a11\",\"urls\":[\"bzz-raw://03335b7b07c7c8c8d613cfdd8ec39a0b5ec133ee510bf2fe6cc5a496767bef4b\",\"dweb:/ipfs/Qmebp4nzPja645c9yXSdJkGq96oU3am3LUnG2K3R7XxyKf\"]}},\"version\":1}", "bytecode": "0x60556023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a723158200c7df7c51eb650df6106b8b5ab69c29887237245dcb8d334121042839e38cfd264736f6c63430005100032", "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a723158200c7df7c51eb650df6106b8b5ab69c29887237245dcb8d334121042839e38cfd264736f6c63430005100032", "sourceMap": "574:3189:153:-;;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": "574:3189:153:-;;;;;;;;", "source": "pragma solidity ^0.5.0;\n\nimport \"./IERC20.sol\";\nimport \"../../math/SafeMath.sol\";\nimport \"../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using SafeMath for uint256;\n using Address for address;\n\n function safeTransfer(IERC20 token, address to, uint256 value) internal {\n callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {\n callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n function safeApprove(IERC20 token, address spender, uint256 value) internal {\n // safeApprove should only be called when setting an initial allowance,\n // or when resetting it to zero. To increase and decrease it, use\n // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n // solhint-disable-next-line max-line-length\n require((value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).add(value);\n callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {\n uint256 newAllowance = token.allowance(address(this), spender).sub(value, \"SafeERC20: decreased allowance below zero\");\n callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n /**\n * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n * on the return value: the return value is optional (but if data is returned, it must not be false).\n * @param token The token targeted by the call.\n * @param data The call data (encoded using abi.encode or one of its variants).\n */\n function callOptionalReturn(IERC20 token, bytes memory data) private {\n // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n // we're implementing it ourselves.\n\n // A Solidity high level call has three parts:\n // 1. The target address is checked to verify it contains contract code\n // 2. The call itself is made, and success asserted\n // 3. The return value is decoded, which in turn checks the size of the returned data.\n // solhint-disable-next-line max-line-length\n require(address(token).isContract(), \"SafeERC20: call to non-contract\");\n\n // solhint-disable-next-line avoid-low-level-calls\n (bool success, bytes memory returndata) = address(token).call(data);\n require(success, \"SafeERC20: low-level call failed\");\n\n if (returndata.length > 0) { // Return data is optional\n // solhint-disable-next-line max-line-length\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n", "sourcePath": "@openzeppelin/contracts/token/ERC20/SafeERC20.sol", "ast": { "absolutePath": "@openzeppelin/contracts/token/ERC20/SafeERC20.sol", "exportedSymbols": { "SafeERC20": [ 37772 ] }, "id": 37773, "nodeType": "SourceUnit", "nodes": [ { "id": 37554, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:153" }, { "absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol", "file": "./IERC20.sol", "id": 37555, "nodeType": "ImportDirective", "scope": 37773, "sourceUnit": 37553, "src": "25:22:153", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts/math/SafeMath.sol", "file": "../../math/SafeMath.sol", "id": 37556, "nodeType": "ImportDirective", "scope": 37773, "sourceUnit": 37366, "src": "48:33:153", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@openzeppelin/contracts/utils/Address.sol", "file": "../../utils/Address.sol", "id": 37557, "nodeType": "ImportDirective", "scope": 37773, "sourceUnit": 37848, "src": "82:33:153", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "library", "documentation": "@title SafeERC20\n@dev Wrappers around ERC20 operations that throw on failure (when the token\ncontract returns false). Tokens that return no value (and instead revert or\nthrow on failure) are also supported, non-reverting calls are assumed to be\nsuccessful.\nTo use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,\nwhich allows you to call the safe operations as `token.safeTransfer(...)`, etc.", "fullyImplemented": true, "id": 37772, "linearizedBaseContracts": [ 37772 ], "name": "SafeERC20", "nodeType": "ContractDefinition", "nodes": [ { "id": 37560, "libraryName": { "contractScope": null, "id": 37558, "name": "SafeMath", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 37365, "src": "604:8:153", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeMath_$37365", "typeString": "library SafeMath" } }, "nodeType": "UsingForDirective", "src": "598:27:153", "typeName": { "id": 37559, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "617:7:153", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } }, { "id": 37563, "libraryName": { "contractScope": null, "id": 37561, "name": "Address", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 37847, "src": "636:7:153", "typeDescriptions": { "typeIdentifier": "t_contract$_Address_$37847", "typeString": "library Address" } }, "nodeType": "UsingForDirective", "src": "630:26:153", "typeName": { "id": 37562, "name": "address", "nodeType": "ElementaryTypeName", "src": "648:7:153", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } }, { "body": { "id": 37584, "nodeType": "Block", "src": "734:102:153", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 37573, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37565, "src": "763:5:153", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 37576, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37565, "src": "793:5:153", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" } }, "id": 37577, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "transfer", "nodeType": "MemberAccess", "referencedDeclaration": 37506, "src": "793:14:153", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,uint256) external returns (bool)" } }, "id": 37578, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "selector", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "793:23:153", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, { "argumentTypes": null, "id": 37579, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37567, "src": "818:2:153", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 37580, "name": "value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37569, "src": "822:5:153", "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": 37574, "name": "abi", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38094, "src": "770:3:153", "typeDescriptions": { "typeIdentifier": "t_magic_abi", "typeString": "abi" } }, "id": 37575, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "encodeWithSelector", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "770:22:153", "typeDescriptions": { "typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$", "typeString": "function (bytes4) pure returns (bytes memory)" } }, "id": 37581, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "770:58:153", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" }, { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } ], "id": 37572, "name": "callOptionalReturn", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37771, "src": "744:18:153", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$37552_$_t_bytes_memory_ptr_$returns$__$", "typeString": "function (contract IERC20,bytes memory)" } }, "id": 37582, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "744:85:153", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 37583, "nodeType": "ExpressionStatement", "src": "744:85:153" } ] }, "documentation": null, "id": 37585, "implemented": true, "kind": "function", "modifiers": [], "name": "safeTransfer", "nodeType": "FunctionDefinition", "parameters": { "id": 37570, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37565, "name": "token", "nodeType": "VariableDeclaration", "scope": 37585, "src": "684:12:153", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" }, "typeName": { "contractScope": null, "id": 37564, "name": "IERC20", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 37552, "src": "684:6:153", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 37567, "name": "to", "nodeType": "VariableDeclaration", "scope": 37585, "src": "698:10:153", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 37566, "name": "address", "nodeType": "ElementaryTypeName", "src": "698:7:153", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 37569, "name": "value", "nodeType": "VariableDeclaration", "scope": 37585, "src": "710:13:153", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 37568, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "710:7:153", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "683:41:153" }, "returnParameters": { "id": 37571, "nodeType": "ParameterList", "parameters": [], "src": "734:0:153" }, "scope": 37772, "src": "662:174:153", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 37609, "nodeType": "Block", "src": "932:112:153", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 37597, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37587, "src": "961:5:153", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 37600, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37587, "src": "991:5:153", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" } }, "id": 37601, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "transferFrom", "nodeType": "MemberAccess", "referencedDeclaration": 37535, "src": "991:18:153", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,address,uint256) external returns (bool)" } }, "id": 37602, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "selector", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "991:27:153", "typeDescriptions": { "typeIdentifier": "t_bytes4", "typeString": "bytes4" } }, { "argumentTypes": null, "id": 37603, "name": "from", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37589, "src": "1020:4:153", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 37604, "name": "to", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37591, "src": "1026:2:153", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 37605, "name": "value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37593, "src": "1030:5:153", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bytes4", "typeString": "bytes4" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 37598, "name": "abi", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38094, "src": "968:3:153", "typeDescriptions": { "typeIdentifier": "t_magic_abi", "typeString": "abi" } }, "id": 37599, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "encodeWithSelector", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "968:22:153", "typeDescriptions": { "typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$", "typeString": "function (bytes4) pure returns (bytes memory)" } }, "id": 37606, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "968:68:153", "typeDescriptions": { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" }, { "typeIdentifier": "t_bytes_memory_ptr", "typeString": "bytes memory" } ], "id": 37596, "name": "callOptionalReturn", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37771, "src": "942:18:153", "typeDescriptions": { "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$37552_$_t_bytes_memory_ptr_$returns$__$", "typeString": "function (contract IERC20,bytes memory)" } }, "id": 37607, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "942:95:153", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 37608, "nodeType": "ExpressionStatement", "src": "942:95:153" } ] }, "documentation": null, "id": 37610, "implemented": true, "kind": "function", "modifiers": [], "name": "safeTransferFrom", "nodeType": "FunctionDefinition", "parameters": { "id": 37594, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 37587, "name": "token", "nodeType": "VariableDeclaration", "scope": 37610, "src": "868:12:153", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" }, "typeName": { "contractScope": null, "id": 37586, "name": "IERC20", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 37552, "src": "868:6:153", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 37589, "name": "from", "nodeType": "VariableDeclaration", "scope": 37610, "src": "882:12:153", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 37588, "name": "address", "nodeType": "ElementaryTypeName", "src": "882:7:153", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 37591, "name": "to", "nodeType": "VariableDeclaration", "scope": 37610, "src": "896:10:153", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 37590, "name": "address", "nodeType": "ElementaryTypeName", "src": "896:7:153", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 37593, "name": "value", "nodeType": "VariableDeclaration", "scope": 37610, "src": "908:13:153", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 37592, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "908:7:153", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "867:55:153" }, "returnParameters": { "id": 37595, "nodeType": "ParameterList", "parameters": [], "src": "932:0:153" }, "scope": 37772, "src": "842:202:153", "stateMutability": "nonpayable", "superFunction": null, "visibility": "internal" }, { "body": { "id": 37650, "nodeType": "Block", "src": "1126:536:153", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 37634, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 37622, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 37620, "name": "value", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37616, "src": "1415:5:153", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 37621, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1424:1:153", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1415:10:153", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "id": 37623, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "1414:12:153", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "||", "rightExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 37632, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 37627, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 38253, "src": "1455:4:153", "typeDescriptions": { "typeIdentifier": "t_contract$_SafeERC20_$37772", "typeString": "library SafeERC20" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_SafeERC20_$37772", "typeString": "library SafeERC20" } ], "id": 37626, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1447:7:153", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 37628, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1447:13:153", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 37629, "name": "spender", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37614, "src": "1462:7:153", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_address", "typeString": "address" } ], "expression": { "argumentTypes": null, "id": 37624, "name": "token", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 37612, "src": "1431:5:153", "typeDescriptions": { "typeIdentifier": "t_contract$_IERC20_$37552", "typeString": "contract IERC20" } }, "id": 37625, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "allowance", "nodeType": "MemberAccess", "referencedDeclaration": 37515, "src": "1431:15:153", "typeDescriptions": { "typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$", "typeString": "function (address,address) view external returns (uint256)" } }, "id": 37630, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1431:39:153", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==",