@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
1,095 lines • 55 kB
JSON
{
"contractName": "ERC20Lib",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"Dolomite * Library contract for reusable token actions\",\"methods\":{},\"title\":\"ERC20Helper\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/ERC20Lib.sol\":\"ERC20Lib\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/ERC20Lib.sol\":{\"keccak256\":\"0x331086cc36f95ff0d8950848a2aef99f0ff6ce574e2bddf5d6a32a272e8d06c5\",\"urls\":[\"bzz-raw://fe2191ab91ac1a16a3131608f1221939033db21d6778cc763ae68ca1c7286bfa\",\"dweb:/ipfs/QmUauBwNu7EpZyhtMAvB7QayUBCqvAeDQWDTMKasQAuTvc\"]},\"@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": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a72315820d18c04e5556dcc29ae53254b92d8513bc7b29a65496e5bde4065b853a14151856c6578706572696d656e74616cf564736f6c63430005100040",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a72315820d18c04e5556dcc29ae53254b92d8513bc7b29a65496e5bde4065b853a14151856c6578706572696d656e74616cf564736f6c63430005100040",
"sourceMap": "908:371:38:-;;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": "908:371:38:-;;;;;;;;",
"source": "/*\n\n Copyright 2022 Dolomite.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.5.7;\npragma experimental ABIEncoderV2;\n\nimport { IERC20 } from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport { SafeERC20 } from \"@openzeppelin/contracts/token/ERC20/SafeERC20.sol\";\n\n\n/**\n * @title ERC20Helper\n * @author Dolomite\n *\n * Library contract for reusable token actions\n */\nlibrary ERC20Lib {\n using SafeERC20 for IERC20;\n\n // ============ Functions ============\n\n function checkAllowanceAndApprove(\n address token,\n address spender,\n uint256 amount\n ) internal {\n if (IERC20(token).allowance(address(this), spender) < amount) {\n IERC20(token).safeApprove(spender, uint(- 1));\n }\n }\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/ERC20Lib.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/ERC20Lib.sol",
"exportedSymbols": {
"ERC20Lib": [
6074
]
},
"id": 6075,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 6031,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:38"
},
{
"id": 6032,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "619:33:38"
},
{
"absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"file": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"id": 6034,
"nodeType": "ImportDirective",
"scope": 6075,
"sourceUnit": 37553,
"src": "654:72:38",
"symbolAliases": [
{
"foreign": 6033,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "@openzeppelin/contracts/token/ERC20/SafeERC20.sol",
"file": "@openzeppelin/contracts/token/ERC20/SafeERC20.sol",
"id": 6036,
"nodeType": "ImportDirective",
"scope": 6075,
"sourceUnit": 37773,
"src": "727:78:38",
"symbolAliases": [
{
"foreign": 6035,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title ERC20Helper\n@author Dolomite\n * Library contract for reusable token actions",
"fullyImplemented": true,
"id": 6074,
"linearizedBaseContracts": [
6074
],
"name": "ERC20Lib",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 6039,
"libraryName": {
"contractScope": null,
"id": 6037,
"name": "SafeERC20",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 37772,
"src": "937:9:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeERC20_$37772",
"typeString": "library SafeERC20"
}
},
"nodeType": "UsingForDirective",
"src": "931:27:38",
"typeName": {
"contractScope": null,
"id": 6038,
"name": "IERC20",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 37552,
"src": "951:6:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20_$37552",
"typeString": "contract IERC20"
}
}
},
{
"body": {
"id": 6072,
"nodeType": "Block",
"src": "1129:148:38",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 6058,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6053,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38255,
"src": "1175:4:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ERC20Lib_$6074",
"typeString": "library ERC20Lib"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ERC20Lib_$6074",
"typeString": "library ERC20Lib"
}
],
"id": 6052,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1167:7:38",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 6054,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1167:13:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 6055,
"name": "spender",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6043,
"src": "1182:7:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6049,
"name": "token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6041,
"src": "1150:5:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 6048,
"name": "IERC20",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 37552,
"src": "1143:6:38",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20_$37552_$",
"typeString": "type(contract IERC20)"
}
},
"id": 6050,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1143:13:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20_$37552",
"typeString": "contract IERC20"
}
},
"id": 6051,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "allowance",
"nodeType": "MemberAccess",
"referencedDeclaration": 37515,
"src": "1143:23:38",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$",
"typeString": "function (address,address) view external returns (uint256)"
}
},
"id": 6056,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1143:47:38",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 6057,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6045,
"src": "1193:6:38",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1143:56:38",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 6071,
"nodeType": "IfStatement",
"src": "1139:132:38",
"trueBody": {
"id": 6070,
"nodeType": "Block",
"src": "1201:70:38",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6063,
"name": "spender",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6043,
"src": "1241:7:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6066,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "-",
"prefix": true,
"src": "1255:3:38",
"subExpression": {
"argumentTypes": null,
"hexValue": "31",
"id": 6065,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1257:1:38",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"typeDescriptions": {
"typeIdentifier": "t_rational_minus_1_by_1",
"typeString": "int_const -1"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_minus_1_by_1",
"typeString": "int_const -1"
}
],
"id": 6064,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1250:4:38",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": "uint"
},
"id": 6067,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1250:9:38",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6060,
"name": "token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6041,
"src": "1222:5:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 6059,
"name": "IERC20",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 37552,
"src": "1215:6:38",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20_$37552_$",
"typeString": "type(contract IERC20)"
}
},
"id": 6061,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1215:13:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20_$37552",
"typeString": "contract IERC20"
}
},
"id": 6062,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "safeApprove",
"nodeType": "MemberAccess",
"referencedDeclaration": 37651,
"src": "1215:25:38",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$37552_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$37552_$",
"typeString": "function (contract IERC20,address,uint256)"
}
},
"id": 6068,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1215:45:38",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 6069,
"nodeType": "ExpressionStatement",
"src": "1215:45:38"
}
]
}
}
]
},
"documentation": null,
"id": 6073,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "checkAllowanceAndApprove",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6046,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 6041,
"name": "token",
"nodeType": "VariableDeclaration",
"scope": 6073,
"src": "1051:13:38",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 6040,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1051:7:38",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 6043,
"name": "spender",
"nodeType": "VariableDeclaration",
"scope": 6073,
"src": "1074:15:38",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 6042,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1074:7:38",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 6045,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 6073,
"src": "1099:14:38",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 6044,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1099:7:38",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1041:78:38"
},
"returnParameters": {
"id": 6047,
"nodeType": "ParameterList",
"parameters": [],
"src": "1129:0:38"
},
"scope": 6074,
"src": "1008:269:38",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
}
],
"scope": 6075,
"src": "908:371:38"
}
],
"src": "595:685:38"
},
"legacyAST": {
"absolutePath": "/home/cdc218/projects/dolomite/dolomite-protocol-v2/contracts/external/lib/ERC20Lib.sol",
"exportedSymbols": {
"ERC20Lib": [
6074
]
},
"id": 6075,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 6031,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "595:23:38"
},
{
"id": 6032,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "619:33:38"
},
{
"absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"file": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"id": 6034,
"nodeType": "ImportDirective",
"scope": 6075,
"sourceUnit": 37553,
"src": "654:72:38",
"symbolAliases": [
{
"foreign": 6033,
"local": null
}
],
"unitAlias": ""
},
{
"absolutePath": "@openzeppelin/contracts/token/ERC20/SafeERC20.sol",
"file": "@openzeppelin/contracts/token/ERC20/SafeERC20.sol",
"id": 6036,
"nodeType": "ImportDirective",
"scope": 6075,
"sourceUnit": 37773,
"src": "727:78:38",
"symbolAliases": [
{
"foreign": 6035,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title ERC20Helper\n@author Dolomite\n * Library contract for reusable token actions",
"fullyImplemented": true,
"id": 6074,
"linearizedBaseContracts": [
6074
],
"name": "ERC20Lib",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 6039,
"libraryName": {
"contractScope": null,
"id": 6037,
"name": "SafeERC20",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 37772,
"src": "937:9:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeERC20_$37772",
"typeString": "library SafeERC20"
}
},
"nodeType": "UsingForDirective",
"src": "931:27:38",
"typeName": {
"contractScope": null,
"id": 6038,
"name": "IERC20",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 37552,
"src": "951:6:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20_$37552",
"typeString": "contract IERC20"
}
}
},
{
"body": {
"id": 6072,
"nodeType": "Block",
"src": "1129:148:38",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 6058,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6053,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38255,
"src": "1175:4:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ERC20Lib_$6074",
"typeString": "library ERC20Lib"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ERC20Lib_$6074",
"typeString": "library ERC20Lib"
}
],
"id": 6052,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1167:7:38",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 6054,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1167:13:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 6055,
"name": "spender",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6043,
"src": "1182:7:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6049,
"name": "token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6041,
"src": "1150:5:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 6048,
"name": "IERC20",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 37552,
"src": "1143:6:38",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20_$37552_$",
"typeString": "type(contract IERC20)"
}
},
"id": 6050,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1143:13:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20_$37552",
"typeString": "contract IERC20"
}
},
"id": 6051,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "allowance",
"nodeType": "MemberAccess",
"referencedDeclaration": 37515,
"src": "1143:23:38",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$_t_address_$returns$_t_uint256_$",
"typeString": "function (address,address) view external returns (uint256)"
}
},
"id": 6056,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1143:47:38",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 6057,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6045,
"src": "1193:6:38",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1143:56:38",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 6071,
"nodeType": "IfStatement",
"src": "1139:132:38",
"trueBody": {
"id": 6070,
"nodeType": "Block",
"src": "1201:70:38",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6063,
"name": "spender",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6043,
"src": "1241:7:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6066,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "-",
"prefix": true,
"src": "1255:3:38",
"subExpression": {
"argumentTypes": null,
"hexValue": "31",
"id": 6065,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1257:1:38",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"typeDescriptions": {
"typeIdentifier": "t_rational_minus_1_by_1",
"typeString": "int_const -1"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_rational_minus_1_by_1",
"typeString": "int_const -1"
}
],
"id": 6064,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1250:4:38",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_uint256_$",
"typeString": "type(uint256)"
},
"typeName": "uint"
},
"id": 6067,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1250:9:38",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 6060,
"name": "token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6041,
"src": "1222:5:38",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 6059,
"name": "IERC20",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 37552,
"src": "1215:6:38",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20_$37552_$",
"typeString": "type(contract IERC20)"
}
},
"id": 6061,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1215:13:38",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20_$37552",
"typeString": "contract IERC20"
}
},
"id": 6062,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "safeApprove",
"nodeType": "MemberAccess",
"referencedDeclaration": 37651,
"src": "1215:25:38",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$37552_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$37552_$",
"typeString": "function (contract IERC20,address,uint256)"
}
},
"id": 6068,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall