@dolomite-exchange/dolomite-margin
Version:
Ethereum Smart Contracts and TypeScript library used for the DolomiteMargin trading protocol
1,037 lines (1,036 loc) • 150 kB
JSON
{
"contractName": "Token",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"author\":\"dYdX * This library contains basic functions for interacting with ERC20 tokens. Modified to work with tokens that don't adhere strictly to the ERC20 standard (for example tokens that don't return a boolean value on success).\",\"methods\":{},\"title\":\"Token\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Token.sol\":\"Token\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":true,\"runs\":10000},\"remappings\":[]},\"sources\":{\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IERC20Detailed.sol\":{\"keccak256\":\"0x22a62e2a8155e70300773721902f4b9118e17aa0bb5d9d1b046050a014cfb223\",\"urls\":[\"bzz-raw://03af737a33c552fbe58f6f1fbd5496854fdc28dd57be4365d56663725c083a18\",\"dweb:/ipfs/QmbgLqGAQEd6tXsZB8QaPNCAMiU6nNzP75wNbKdS65BuUF\"]},\"/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Token.sol\":{\"keccak256\":\"0x095b5f8eb3665f6e246200311efc8a654fa3e90f9a1a522e27a4d089e8ab3917\",\"urls\":[\"bzz-raw://5db812b752a03d601d424e6e21be38153477082af0acf51b5c98eefa5553ed18\",\"dweb:/ipfs/QmbE549QUXYTurpx8hSMLBJvuBpfYqyNE6FBCgHJDY8PLf\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xe5bb0f57cff3e299f360052ba50f1ea0fff046df2be070b6943e0e3c3fdad8a9\",\"urls\":[\"bzz-raw://59fd025151435da35faa8093a5c7a17de02de9d08ad27275c5cdf05050820d91\",\"dweb:/ipfs/QmQMvwEcPhoRXzbXyrdoeRtvLoifUW9Qh7Luho7bmUPRkc\"]}},\"version\":1}",
"bytecode": "0x60636023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a72315820250ee886967c47be53344828a2fea648f88343eb2f77a0fab8a19c02834a6e376c6578706572696d656e74616cf564736f6c63430005100040",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea365627a7a72315820250ee886967c47be53344828a2fea648f88343eb2f77a0fab8a19c02834a6e376c6578706572696d656e74616cf564736f6c63430005100040",
"sourceMap": "1001:1916:103:-;;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": "1001:1916:103:-;;;;;;;;",
"source": "/*\n\n Copyright 2019 dYdX Trading Inc.\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 { IERC20Detailed } from \"../interfaces/IERC20Detailed.sol\";\n\n\n/**\n * @title Token\n * @author dYdX\n *\n * This library contains basic functions for interacting with ERC20 tokens. Modified to work with\n * tokens that don't adhere strictly to the ERC20 standard (for example tokens that don't return a\n * boolean value on success).\n */\nlibrary Token {\n\n // ============ Library Functions ============\n\n function transfer(\n address token,\n address to,\n uint256 amount\n )\n internal\n {\n if (amount == 0 || to == address(this)) {\n return;\n }\n\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(IERC20Detailed(token).transfer.selector, to, amount),\n \"Token: transfer failed\"\n );\n }\n\n function transferFrom(\n address token,\n address from,\n address to,\n uint256 amount\n )\n internal\n {\n if (amount == 0 || to == from) {\n return;\n }\n\n // solium-disable arg-overflow\n _callOptionalReturn(\n token,\n abi.encodeWithSelector(IERC20Detailed(token).transferFrom.selector, from, to, amount),\n \"Token: transferFrom failed\"\n );\n // solium-enable arg-overflow\n }\n\n // ============ Private Functions ============\n\n function _callOptionalReturn(address token, bytes memory data, string memory error) 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 contain contract code. Not needed since tokens are manually added\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\n // solium-disable-next-line security/no-low-level-calls\n (bool success, bytes memory returnData) = token.call(data);\n require(success, error);\n\n if (returnData.length != 0) {\n // Return data is optional\n require(abi.decode(returnData, (bool)), error);\n }\n }\n\n}\n",
"sourcePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Token.sol",
"ast": {
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/lib/Token.sol",
"exportedSymbols": {
"Token": [
30850
]
},
"id": 30851,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 30731,
"literals": [
"solidity",
"^",
"0.5",
".7"
],
"nodeType": "PragmaDirective",
"src": "603:23:103"
},
{
"id": 30732,
"literals": [
"experimental",
"ABIEncoderV2"
],
"nodeType": "PragmaDirective",
"src": "627:33:103"
},
{
"absolutePath": "/home/cdc218/projects/dolomite-protocol-v2/contracts/protocol/interfaces/IERC20Detailed.sol",
"file": "../interfaces/IERC20Detailed.sol",
"id": 30734,
"nodeType": "ImportDirective",
"scope": 30851,
"sourceUnit": 24716,
"src": "662:66:103",
"symbolAliases": [
{
"foreign": 30733,
"local": null
}
],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": "@title Token\n@author dYdX\n * This library contains basic functions for interacting with ERC20 tokens. Modified to work with\ntokens that don't adhere strictly to the ERC20 standard (for example tokens that don't return a\nboolean value on success).",
"fullyImplemented": true,
"id": 30850,
"linearizedBaseContracts": [
30850
],
"name": "Token",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 30770,
"nodeType": "Block",
"src": "1186:273:103",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 30751,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 30745,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 30743,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30740,
"src": "1200:6:103",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 30744,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1210:1:103",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1200:11:103",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "||",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 30750,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 30746,
"name": "to",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30738,
"src": "1215:2:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 30748,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38161,
"src": "1229:4:103",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Token_$30850",
"typeString": "library Token"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_Token_$30850",
"typeString": "library Token"
}
],
"id": 30747,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1221:7:103",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 30749,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1221:13:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1215:19:103",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "1200:34:103",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 30754,
"nodeType": "IfStatement",
"src": "1196:71:103",
"trueBody": {
"id": 30753,
"nodeType": "Block",
"src": "1236:31:103",
"statements": [
{
"expression": null,
"functionReturnParameters": 30742,
"id": 30752,
"nodeType": "Return",
"src": "1250:7:103"
}
]
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 30756,
"name": "token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30736,
"src": "1310:5:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 30760,
"name": "token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30736,
"src": "1367:5:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 30759,
"name": "IERC20Detailed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 24715,
"src": "1352:14:103",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Detailed_$24715_$",
"typeString": "type(contract IERC20Detailed)"
}
},
"id": 30761,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1352:21:103",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Detailed_$24715",
"typeString": "contract IERC20Detailed"
}
},
"id": 30762,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transfer",
"nodeType": "MemberAccess",
"referencedDeclaration": 37506,
"src": "1352:30:103",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (address,uint256) external returns (bool)"
}
},
"id": 30763,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "selector",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1352:39:103",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
{
"argumentTypes": null,
"id": 30764,
"name": "to",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30738,
"src": "1393:2:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 30765,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30740,
"src": "1397:6:103",
"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": 30757,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38094,
"src": "1329:3:103",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 30758,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodeWithSelector",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1329:22:103",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (bytes4) pure returns (bytes memory)"
}
},
"id": 30766,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1329:75:103",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"argumentTypes": null,
"hexValue": "546f6b656e3a207472616e73666572206661696c6564",
"id": 30767,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1418:24:103",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9cdd6e38d96d44a5b15a4b19a209464c70467f5d8eaf84c22635ec6f7f740b89",
"typeString": "literal_string \"Token: transfer failed\""
},
"value": "Token: transfer failed"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_stringliteral_9cdd6e38d96d44a5b15a4b19a209464c70467f5d8eaf84c22635ec6f7f740b89",
"typeString": "literal_string \"Token: transfer failed\""
}
],
"id": 30755,
"name": "_callOptionalReturn",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30849,
"src": "1277:19:103",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (address,bytes memory,string memory)"
}
},
"id": 30768,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1277:175:103",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 30769,
"nodeType": "ExpressionStatement",
"src": "1277:175:103"
}
]
},
"documentation": null,
"id": 30771,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "transfer",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 30741,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 30736,
"name": "token",
"nodeType": "VariableDeclaration",
"scope": 30771,
"src": "1101:13:103",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 30735,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1101:7:103",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 30738,
"name": "to",
"nodeType": "VariableDeclaration",
"scope": 30771,
"src": "1124:10:103",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 30737,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1124:7:103",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 30740,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 30771,
"src": "1144:14:103",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 30739,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1144:7:103",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "1091:73:103"
},
"returnParameters": {
"id": 30742,
"nodeType": "ParameterList",
"parameters": [],
"src": "1186:0:103"
},
"scope": 30850,
"src": "1074:385:103",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 30808,
"nodeType": "Block",
"src": "1603:355:103",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 30788,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 30784,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 30782,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30779,
"src": "1617:6:103",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 30783,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1627:1:103",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1617:11:103",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "||",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 30787,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 30785,
"name": "to",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30777,
"src": "1632:2:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 30786,
"name": "from",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30775,
"src": "1638:4:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1632:10:103",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "1617:25:103",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 30791,
"nodeType": "IfStatement",
"src": "1613:62:103",
"trueBody": {
"id": 30790,
"nodeType": "Block",
"src": "1644:31:103",
"statements": [
{
"expression": null,
"functionReturnParameters": 30781,
"id": 30789,
"nodeType": "Return",
"src": "1658:7:103"
}
]
}
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 30793,
"name": "token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30773,
"src": "1757:5:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 30797,
"name": "token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30773,
"src": "1814:5:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 30796,
"name": "IERC20Detailed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 24715,
"src": "1799:14:103",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20Detailed_$24715_$",
"typeString": "type(contract IERC20Detailed)"
}
},
"id": 30798,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1799:21:103",
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20Detailed_$24715",
"typeString": "contract IERC20Detailed"
}
},
"id": 30799,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transferFrom",
"nodeType": "MemberAccess",
"referencedDeclaration": 37535,
"src": "1799:34:103",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (address,address,uint256) external returns (bool)"
}
},
"id": 30800,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "selector",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1799:43:103",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
{
"argumentTypes": null,
"id": 30801,
"name": "from",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30775,
"src": "1844:4:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 30802,
"name": "to",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30777,
"src": "1850:2:103",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 30803,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30779,
"src": "1854:6:103",
"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": 30794,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 38094,
"src": "1776:3:103",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 30795,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodeWithSelector",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "1776:22:103",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (bytes4) pure returns (bytes memory)"
}
},
"id": 30804,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1776:85:103",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
{
"argumentTypes": null,
"hexValue": "546f6b656e3a207472616e7366657246726f6d206661696c6564",
"id": 30805,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1875:28:103",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_bf3127ff8a9fe06ec617586f80f617ddef22690daaa124944d3af05dd5eccc7c",
"typeString": "literal_string \"Token: transferFrom failed\""
},
"value": "Token: transferFrom failed"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
},
{
"typeIdentifier": "t_stringliteral_bf3127ff8a9fe06ec617586f80f617ddef22690daaa124944d3af05dd5eccc7c",
"typeString": "literal_string \"Token: transferFrom failed\""
}
],
"id": 30792,
"name": "_callOptionalReturn",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 30849,
"src": "1724:19:103",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (address,bytes memory,string memory)"
}
},
"id": 30806,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1724:189:103",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 30807,
"nodeType": "ExpressionStatement",
"src": "1724:189:103"
}
]
},
"documentation": null,
"id": 30809,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "transferFrom",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 30780,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 30773,
"name": "token",
"nodeType": "VariableDeclaration",
"scope": 30809,
"src": "1496:13:103",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 30772,
"name": "address",
"nodeType": "ElementaryTypeName",