@aragon/apps-payroll
Version:
_**Code in Github:**_ [aragon-apps/apps/payroll](https://github.com/aragon/aragon-apps/tree/master/future-apps/payroll)
1,148 lines • 273 kB
JSON
{
"contractName": "SafeERC20",
"abi": [],
"bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820b186b2a41e82721bf2d14c673b215e901a52478a78541d6a0f59a06a73352e030029",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820b186b2a41e82721bf2d14c673b215e901a52478a78541d6a0f59a06a73352e030029",
"sourceMap": "376:5675:36:-;;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": "376:5675:36:-;;;;;;;;",
"source": "// Inspired by AdEx (https://github.com/AdExNetwork/adex-protocol-eth/blob/b9df617829661a7518ee10f4cb6c4108659dd6d5/contracts/libs/SafeERC20.sol)\n// and 0x (https://github.com/0xProject/0x-monorepo/blob/737d1dc54d72872e24abce5a1dbe1b66d35fa21a/contracts/protocol/contracts/protocol/AssetProxy/ERC20Proxy.sol#L143)\n\npragma solidity ^0.4.24;\n\nimport \"../lib/token/ERC20.sol\";\n\n\nlibrary SafeERC20 {\n // Before 0.5, solidity has a mismatch between `address.transfer()` and `token.transfer()`:\n // https://github.com/ethereum/solidity/issues/3544\n bytes4 private constant TRANSFER_SELECTOR = 0xa9059cbb;\n\n string private constant ERROR_TOKEN_BALANCE_REVERTED = \"SAFE_ERC_20_BALANCE_REVERTED\";\n string private constant ERROR_TOKEN_ALLOWANCE_REVERTED = \"SAFE_ERC_20_ALLOWANCE_REVERTED\";\n\n function invokeAndCheckSuccess(address _addr, bytes memory _calldata)\n private\n returns (bool)\n {\n bool ret;\n assembly {\n let ptr := mload(0x40) // free memory pointer\n\n let success := call(\n gas, // forward all gas\n _addr, // address\n 0, // no value\n add(_calldata, 0x20), // calldata start\n mload(_calldata), // calldata length\n ptr, // write output over free memory\n 0x20 // uint256 return\n )\n\n if gt(success, 0) {\n // Check number of bytes returned from last function call\n switch returndatasize\n\n // No bytes returned: assume success\n case 0 {\n ret := 1\n }\n\n // 32 bytes returned: check if non-zero\n case 0x20 {\n // Only return success if returned data was true\n // Already have output in ptr\n ret := eq(mload(ptr), 1)\n }\n\n // Not sure what was returned: don't mark as success\n default { }\n }\n }\n return ret;\n }\n\n function staticInvoke(address _addr, bytes memory _calldata)\n private\n view\n returns (bool, uint256)\n {\n bool success;\n uint256 ret;\n assembly {\n let ptr := mload(0x40) // free memory pointer\n\n success := staticcall(\n gas, // forward all gas\n _addr, // address\n add(_calldata, 0x20), // calldata start\n mload(_calldata), // calldata length\n ptr, // write output over free memory\n 0x20 // uint256 return\n )\n\n if gt(success, 0) {\n ret := mload(ptr)\n }\n }\n return (success, ret);\n }\n\n /**\n * @dev Same as a standards-compliant ERC20.transfer() that never reverts (returns false).\n * Note that this makes an external call to the token.\n */\n function safeTransfer(ERC20 _token, address _to, uint256 _amount) internal returns (bool) {\n bytes memory transferCallData = abi.encodeWithSelector(\n TRANSFER_SELECTOR,\n _to,\n _amount\n );\n return invokeAndCheckSuccess(_token, transferCallData);\n }\n\n /**\n * @dev Same as a standards-compliant ERC20.transferFrom() that never reverts (returns false).\n * Note that this makes an external call to the token.\n */\n function safeTransferFrom(ERC20 _token, address _from, address _to, uint256 _amount) internal returns (bool) {\n bytes memory transferFromCallData = abi.encodeWithSelector(\n _token.transferFrom.selector,\n _from,\n _to,\n _amount\n );\n return invokeAndCheckSuccess(_token, transferFromCallData);\n }\n\n /**\n * @dev Same as a standards-compliant ERC20.approve() that never reverts (returns false).\n * Note that this makes an external call to the token.\n */\n function safeApprove(ERC20 _token, address _spender, uint256 _amount) internal returns (bool) {\n bytes memory approveCallData = abi.encodeWithSelector(\n _token.approve.selector,\n _spender,\n _amount\n );\n return invokeAndCheckSuccess(_token, approveCallData);\n }\n\n /**\n * @dev Static call into ERC20.balanceOf().\n * Reverts if the call fails for some reason (should never fail).\n */\n function staticBalanceOf(ERC20 _token, address _owner) internal view returns (uint256) {\n bytes memory balanceOfCallData = abi.encodeWithSelector(\n _token.balanceOf.selector,\n _owner\n );\n\n (bool success, uint256 tokenBalance) = staticInvoke(_token, balanceOfCallData);\n require(success, ERROR_TOKEN_BALANCE_REVERTED);\n\n return tokenBalance;\n }\n\n /**\n * @dev Static call into ERC20.allowance().\n * Reverts if the call fails for some reason (should never fail).\n */\n function staticAllowance(ERC20 _token, address _owner, address _spender) internal view returns (uint256) {\n bytes memory allowanceCallData = abi.encodeWithSelector(\n _token.allowance.selector,\n _owner,\n _spender\n );\n\n (bool success, uint256 allowance) = staticInvoke(_token, allowanceCallData);\n require(success, ERROR_TOKEN_ALLOWANCE_REVERTED);\n\n return allowance;\n }\n\n /**\n * @dev Static call into ERC20.totalSupply().\n * Reverts if the call fails for some reason (should never fail).\n */\n function staticTotalSupply(ERC20 _token) internal view returns (uint256) {\n bytes memory totalSupplyCallData = abi.encodeWithSelector(_token.totalSupply.selector);\n\n (bool success, uint256 totalSupply) = staticInvoke(_token, totalSupplyCallData);\n require(success, ERROR_TOKEN_ALLOWANCE_REVERTED);\n\n return totalSupply;\n }\n}\n",
"sourcePath": "@aragon/os/contracts/common/SafeERC20.sol",
"ast": {
"absolutePath": "@aragon/os/contracts/common/SafeERC20.sol",
"exportedSymbols": {
"SafeERC20": [
11153
]
},
"id": 11154,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 10910,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "315:24:36"
},
{
"absolutePath": "@aragon/os/contracts/lib/token/ERC20.sol",
"file": "../lib/token/ERC20.sol",
"id": 10911,
"nodeType": "ImportDirective",
"scope": 11154,
"sourceUnit": 14295,
"src": "341:32:36",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 11153,
"linearizedBaseContracts": [
11153
],
"name": "SafeERC20",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 10914,
"name": "TRANSFER_SELECTOR",
"nodeType": "VariableDeclaration",
"scope": 11153,
"src": "552:54:36",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
},
"typeName": {
"id": 10912,
"name": "bytes4",
"nodeType": "ElementaryTypeName",
"src": "552:6:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30786139303539636262",
"id": 10913,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "596:10:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_2835717307_by_1",
"typeString": "int_const 2835717307"
},
"value": "0xa9059cbb"
},
"visibility": "private"
},
{
"constant": true,
"id": 10917,
"name": "ERROR_TOKEN_BALANCE_REVERTED",
"nodeType": "VariableDeclaration",
"scope": 11153,
"src": "613:85:36",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_string_memory",
"typeString": "string"
},
"typeName": {
"id": 10915,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "613:6:36",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"value": {
"argumentTypes": null,
"hexValue": "534146455f4552435f32305f42414c414e43455f5245564552544544",
"id": 10916,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "668:30:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_e0d6f1573408f815b546b777c74de94d1685d3d390fbf5b918b2e1339b2ed2e7",
"typeString": "literal_string \"SAFE_ERC_20_BALANCE_REVERTED\""
},
"value": "SAFE_ERC_20_BALANCE_REVERTED"
},
"visibility": "private"
},
{
"constant": true,
"id": 10920,
"name": "ERROR_TOKEN_ALLOWANCE_REVERTED",
"nodeType": "VariableDeclaration",
"scope": 11153,
"src": "704:89:36",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_string_memory",
"typeString": "string"
},
"typeName": {
"id": 10918,
"name": "string",
"nodeType": "ElementaryTypeName",
"src": "704:6:36",
"typeDescriptions": {
"typeIdentifier": "t_string_storage_ptr",
"typeString": "string"
}
},
"value": {
"argumentTypes": null,
"hexValue": "534146455f4552435f32305f414c4c4f57414e43455f5245564552544544",
"id": 10919,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "761:32:36",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_73432bcf14a5ead3ed39eed7e97b924b49d284054d4f8b41ba74ac90002bc239",
"typeString": "literal_string \"SAFE_ERC_20_ALLOWANCE_REVERTED\""
},
"value": "SAFE_ERC_20_ALLOWANCE_REVERTED"
},
"visibility": "private"
},
{
"body": {
"id": 10935,
"nodeType": "Block",
"src": "913:1229:36",
"statements": [
{
"assignments": [],
"declarations": [
{
"constant": false,
"id": 10930,
"name": "ret",
"nodeType": "VariableDeclaration",
"scope": 10936,
"src": "923:8:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 10929,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "923:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 10931,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "923:8:36"
},
{
"externalReferences": [
{
"_calldata": {
"declaration": 10924,
"isOffset": false,
"isSlot": false,
"src": "1281:9:36",
"valueSize": 1
}
},
{
"_calldata": {
"declaration": 10924,
"isOffset": false,
"isSlot": false,
"src": "1223:9:36",
"valueSize": 1
}
},
{
"ret": {
"declaration": 10930,
"isOffset": false,
"isSlot": false,
"src": "1701:3:36",
"valueSize": 1
}
},
{
"_addr": {
"declaration": 10922,
"isOffset": false,
"isSlot": false,
"src": "1120:5:36",
"valueSize": 1
}
},
{
"ret": {
"declaration": 10930,
"isOffset": false,
"isSlot": false,
"src": "1952:3:36",
"valueSize": 1
}
}
],
"id": 10932,
"nodeType": "InlineAssembly",
"operations": "{\n let ptr := mload(0x40)\n let success := call(gas(), _addr, 0, add(_calldata, 0x20), mload(_calldata), ptr, 0x20)\n if gt(success, 0)\n {\n switch returndatasize()\n case 0 {\n ret := 1\n }\n case 0x20 {\n ret := eq(mload(ptr), 1)\n }\n default {\n }\n }\n}",
"src": "941:1190:36"
},
{
"expression": {
"argumentTypes": null,
"id": 10933,
"name": "ret",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10930,
"src": "2132:3:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 10928,
"id": 10934,
"nodeType": "Return",
"src": "2125:10:36"
}
]
},
"documentation": null,
"id": 10936,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "invokeAndCheckSuccess",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 10925,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 10922,
"name": "_addr",
"nodeType": "VariableDeclaration",
"scope": 10936,
"src": "831:13:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 10921,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "831:7:36",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 10924,
"name": "_calldata",
"nodeType": "VariableDeclaration",
"scope": 10936,
"src": "846:22:36",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 10923,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "846:5:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "830:39:36"
},
"payable": false,
"returnParameters": {
"id": 10928,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 10927,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 10936,
"src": "903:4:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 10926,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "903:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "902:6:36"
},
"scope": 11153,
"src": "800:1342:36",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "private"
},
{
"body": {
"id": 10958,
"nodeType": "Block",
"src": "2274:648:36",
"statements": [
{
"assignments": [],
"declarations": [
{
"constant": false,
"id": 10948,
"name": "success",
"nodeType": "VariableDeclaration",
"scope": 10959,
"src": "2284:12:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 10947,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "2284:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 10949,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "2284:12:36"
},
{
"assignments": [],
"declarations": [
{
"constant": false,
"id": 10951,
"name": "ret",
"nodeType": "VariableDeclaration",
"scope": 10959,
"src": "2306:11:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 10950,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2306:7:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 10952,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "2306:11:36"
},
{
"externalReferences": [
{
"ret": {
"declaration": 10951,
"isOffset": false,
"isSlot": false,
"src": "2844:3:36",
"valueSize": 1
}
},
{
"_calldata": {
"declaration": 10940,
"isOffset": false,
"isSlot": false,
"src": "2619:9:36",
"valueSize": 1
}
},
{
"_calldata": {
"declaration": 10940,
"isOffset": false,
"isSlot": false,
"src": "2561:9:36",
"valueSize": 1
}
},
{
"success": {
"declaration": 10948,
"isOffset": false,
"isSlot": false,
"src": "2412:7:36",
"valueSize": 1
}
},
{
"success": {
"declaration": 10948,
"isOffset": false,
"isSlot": false,
"src": "2814:7:36",
"valueSize": 1
}
},
{
"_addr": {
"declaration": 10938,
"isOffset": false,
"isSlot": false,
"src": "2508:5:36",
"valueSize": 1
}
}
],
"id": 10953,
"nodeType": "InlineAssembly",
"operations": "{\n let ptr := mload(0x40)\n success := staticcall(gas(), _addr, add(_calldata, 0x20), mload(_calldata), ptr, 0x20)\n if gt(success, 0)\n {\n ret := mload(ptr)\n }\n}",
"src": "2327:573:36"
},
{
"expression": {
"argumentTypes": null,
"components": [
{
"argumentTypes": null,
"id": 10954,
"name": "success",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10948,
"src": "2902:7:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"id": 10955,
"name": "ret",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10951,
"src": "2911:3:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"id": 10956,
"isConstant": false,
"isInlineArray": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "TupleExpression",
"src": "2901:14:36",
"typeDescriptions": {
"typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$",
"typeString": "tuple(bool,uint256)"
}
},
"functionReturnParameters": 10946,
"id": 10957,
"nodeType": "Return",
"src": "2894:21:36"
}
]
},
"documentation": null,
"id": 10959,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": true,
"modifiers": [],
"name": "staticInvoke",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 10941,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 10938,
"name": "_addr",
"nodeType": "VariableDeclaration",
"scope": 10959,
"src": "2170:13:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 10937,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "2170:7:36",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 10940,
"name": "_calldata",
"nodeType": "VariableDeclaration",
"scope": 10959,
"src": "2185:22:36",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 10939,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "2185:5:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2169:39:36"
},
"payable": false,
"returnParameters": {
"id": 10946,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 10943,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 10959,
"src": "2255:4:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 10942,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "2255:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 10945,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 10959,
"src": "2261:7:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 10944,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "2261:7:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "2254:15:36"
},
"scope": 11153,
"src": "2148:774:36",
"stateMutability": "view",
"superFunction": null,
"visibility": "private"
},
{
"body": {
"id": 10984,
"nodeType": "Block",
"src": "3190:214:36",
"statements": [
{
"assignments": [
10971
],
"declarations": [
{
"constant": false,
"id": 10971,
"name": "transferCallData",
"nodeType": "VariableDeclaration",
"scope": 10985,
"src": "3200:29:36",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 10970,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "3200:5:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 10978,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 10974,
"name": "TRANSFER_SELECTOR",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10914,
"src": "3268:17:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes4",
"typeString": "bytes4"
}
},
{
"argumentTypes": null,
"id": 10975,
"name": "_to",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10963,
"src": "3299:3:36",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 10976,
"name": "_amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10965,
"src": "3316:7:36",
"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": 10972,
"name": "abi",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 15140,
"src": "3232:3:36",
"typeDescriptions": {
"typeIdentifier": "t_magic_abi",
"typeString": "abi"
}
},
"id": 10973,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"memberName": "encodeWithSelector",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "3232:22:36",
"typeDescriptions": {
"typeIdentifier": "t_function_abiencodewithselector_pure$_t_bytes4_$returns$_t_bytes_memory_ptr_$",
"typeString": "function (bytes4) pure returns (bytes memory)"
}
},
"id": 10977,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3232:101:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "3200:133:36"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 10980,
"name": "_token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10961,
"src": "3372:6:36",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ERC20_$14294",
"typeString": "contract ERC20"
}
},
{
"argumentTypes": null,
"id": 10981,
"name": "transferCallData",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10971,
"src": "3380:16:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ERC20_$14294",
"typeString": "contract ERC20"
},
{
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes memory"
}
],
"id": 10979,
"name": "invokeAndCheckSuccess",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10936,
"src": "3350:21:36",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_bytes_memory_ptr_$returns$_t_bool_$",
"typeString": "function (address,bytes memory) returns (bool)"
}
},
"id": 10982,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "3350:47:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 10969,
"id": 10983,
"nodeType": "Return",
"src": "3343:54:36"
}
]
},
"documentation": "@dev Same as a standards-compliant ERC20.transfer() that never reverts (returns false).\n Note that this makes an external call to the token.",
"id": 10985,
"implemented": true,
"isConstructor": false,
"isDeclaredConst": false,
"modifiers": [],
"name": "safeTransfer",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 10966,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 10961,
"name": "_token",
"nodeType": "VariableDeclaration",
"scope": 10985,
"src": "3122:12:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ERC20_$14294",
"typeString": "contract ERC20"
},
"typeName": {
"contractScope": null,
"id": 10960,
"name": "ERC20",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 14294,
"src": "3122:5:36",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ERC20_$14294",
"typeString": "contract ERC20"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 10963,
"name": "_to",
"nodeType": "VariableDeclaration",
"scope": 10985,
"src": "3136:11:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 10962,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "3136:7:36",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 10965,
"name": "_amount",
"nodeType": "VariableDeclaration",
"scope": 10985,
"src": "3149:15:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 10964,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "3149:7:36",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "3121:44:36"
},
"payable": false,
"returnParameters": {
"id": 10969,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 10968,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 10985,
"src": "3184:4:36",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 10967,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "3184:4:36",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "3183:6:36"
},
"scope": 11153,
"src": "3100:304:36",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 11015,
"nodeType": "Block",
"src": "3695:252:36",
"statements": [
{
"assignments": [
10999
],
"declarations": [
{
"constant": false,
"id": 10999,
"name": "transferFromCallData",
"nodeType": "VariableDeclaration",
"scope": 11016,
"src": "3705:33:36",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_bytes_memory_ptr",
"typeString": "bytes"
},
"typeName": {
"id": 10998,
"name": "bytes",
"nodeType": "ElementaryTypeName",
"src": "3705:5:36",
"typeDescriptions": {
"typeIdentifier": "t_bytes_storage_ptr",
"typeString": "bytes"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 11009,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 11002,
"name": "_token",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 10987,
"src": "3777:6:36",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ERC20_$14294",
"typeString": "contract ERC20"
}
},
"id": 11003,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transferFrom",
"nodeType": "MemberAccess",
"referencedDeclaration": 14277,
"src": "3777:19:36",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (address,addr