@andrekorol/kollateral-contracts
Version:
Kollateral protocol, the flash loan building block
1,221 lines • 90.7 kB
JSON
{
"contractName": "BalanceCarrier",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.7.3+commit.9bfce1f6\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/BalanceCarrier.sol\":\"BalanceCarrier\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/BalanceCarrier.sol\":{\"keccak256\":\"0x69e63e482d839c831c8c32f002e6454f6a8d9e602b39e9cdc1c0649451df3337\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://0a40661372b8f95cbed7714a16323b435ccbe85205178d32bc6012e47bfc0640\",\"dweb:/ipfs/QmTyHr1Ag4AkcyazzTT5GDcWabAMHPTrELoGhL85ZWDgBy\"]},\"/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/ExternalCaller.sol\":{\"keccak256\":\"0x54f88a1f0ac5dd7ab99a0519124cb09f1e19b4efb9baf240bc2500f8caa0b4ff\",\"license\":\"Apache-2.0\",\"urls\":[\"bzz-raw://3170671378d20b47498224d065e33fccc223ae772d7f0af2c5ef314f94b75c98\",\"dweb:/ipfs/Qme8ZEEBnBG5Vvj8uyJCD2YVPcLx6funKsSSCpGkTyn1zi\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xbd74f587ab9b9711801baf667db1426e4a03fd2d7f15af33e0e0d0394e7cef76\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2d0913dfbfce90d170df0d496ad7596c0778518e5fa7aba6c32562522546f66b\",\"dweb:/ipfs/QmR6B8nLj2PJf5e1JWD9Nk7ErkAwkqUwadCnvE82FJr1RU\"]}},\"version\":1}",
"bytecode": "0x",
"deployedBytecode": "0x",
"immutableReferences": {},
"generatedSources": [],
"deployedGeneratedSources": [],
"sourceMap": "",
"deployedSourceMap": "",
"source": "/*\n\n Copyright 2020 Kollateral LLC.\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\n// SPDX-License-Identifier: Apache-2.0\npragma solidity ^0.7.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ExternalCaller.sol\";\n\nabstract contract BalanceCarrier is ExternalCaller {\n address private _ethTokenAddress;\n\n constructor(address ethTokenAddress) {\n _ethTokenAddress = ethTokenAddress;\n }\n\n function transfer(\n address tokenAddress,\n address to,\n uint256 amount\n ) internal returns (bool) {\n if (tokenAddress == _ethTokenAddress) {\n externalTransfer(to, amount);\n return true;\n } else {\n return IERC20(tokenAddress).transfer(to, amount);\n }\n }\n\n function balanceOf(address tokenAddress) internal view returns (uint256) {\n if (tokenAddress == _ethTokenAddress) {\n return address(this).balance;\n } else {\n return IERC20(tokenAddress).balanceOf(address(this));\n }\n }\n}\n",
"sourcePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/BalanceCarrier.sol",
"ast": {
"absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/BalanceCarrier.sol",
"exportedSymbols": {
"BalanceCarrier": [
1464
],
"ExternalCaller": [
1563
],
"IERC20": [
6165
]
},
"id": 1465,
"license": "Apache-2.0",
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1384,
"literals": [
"solidity",
"^",
"0.7",
".0"
],
"nodeType": "PragmaDirective",
"src": "640:23:7"
},
{
"absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"file": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"id": 1385,
"nodeType": "ImportDirective",
"scope": 1465,
"sourceUnit": 6166,
"src": "665:56:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/ExternalCaller.sol",
"file": "./ExternalCaller.sol",
"id": 1386,
"nodeType": "ImportDirective",
"scope": 1465,
"sourceUnit": 1564,
"src": "722:30:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"abstract": true,
"baseContracts": [
{
"baseName": {
"id": 1387,
"name": "ExternalCaller",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1563,
"src": "790:14:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ExternalCaller_$1563",
"typeString": "contract ExternalCaller"
}
},
"id": 1388,
"nodeType": "InheritanceSpecifier",
"src": "790:14:7"
}
],
"contractDependencies": [
1563
],
"contractKind": "contract",
"fullyImplemented": true,
"id": 1464,
"linearizedBaseContracts": [
1464,
1563
],
"name": "BalanceCarrier",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 1390,
"mutability": "mutable",
"name": "_ethTokenAddress",
"nodeType": "VariableDeclaration",
"scope": 1464,
"src": "811:32:7",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1389,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "811:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "private"
},
{
"body": {
"id": 1399,
"nodeType": "Block",
"src": "887:51:7",
"statements": [
{
"expression": {
"id": 1397,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"id": 1395,
"name": "_ethTokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1390,
"src": "897:16:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"id": 1396,
"name": "ethTokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1392,
"src": "916:15:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "897:34:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 1398,
"nodeType": "ExpressionStatement",
"src": "897:34:7"
}
]
},
"id": 1400,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1393,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1392,
"mutability": "mutable",
"name": "ethTokenAddress",
"nodeType": "VariableDeclaration",
"scope": 1400,
"src": "862:23:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1391,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "862:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "861:25:7"
},
"returnParameters": {
"id": 1394,
"nodeType": "ParameterList",
"parameters": [],
"src": "887:0:7"
},
"scope": 1464,
"src": "850:88:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 1432,
"nodeType": "Block",
"src": "1066:211:7",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 1413,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 1411,
"name": "tokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1402,
"src": "1080:12:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"id": 1412,
"name": "_ethTokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1390,
"src": "1096:16:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1080:32:7",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 1430,
"nodeType": "Block",
"src": "1198:73:7",
"statements": [
{
"expression": {
"arguments": [
{
"id": 1426,
"name": "to",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1404,
"src": "1249:2:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 1427,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1406,
"src": "1253:6:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"arguments": [
{
"id": 1423,
"name": "tokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1402,
"src": "1226:12:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 1422,
"name": "IERC20",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6165,
"src": "1219:6:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20_$6165_$",
"typeString": "type(contract IERC20)"
}
},
"id": 1424,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1219:20:7",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20_$6165",
"typeString": "contract IERC20"
}
},
"id": 1425,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "transfer",
"nodeType": "MemberAccess",
"referencedDeclaration": 6114,
"src": "1219:29:7",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$_t_bool_$",
"typeString": "function (address,uint256) external returns (bool)"
}
},
"id": 1428,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1219:41:7",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"functionReturnParameters": 1410,
"id": 1429,
"nodeType": "Return",
"src": "1212:48:7"
}
]
},
"id": 1431,
"nodeType": "IfStatement",
"src": "1076:195:7",
"trueBody": {
"id": 1421,
"nodeType": "Block",
"src": "1114:78:7",
"statements": [
{
"expression": {
"arguments": [
{
"id": 1415,
"name": "to",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1404,
"src": "1145:2:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"id": 1416,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1406,
"src": "1149:6:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 1414,
"name": "externalTransfer",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1533,
"src": "1128:16:7",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_nonpayable$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (address,uint256)"
}
},
"id": 1417,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1128:28:7",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1418,
"nodeType": "ExpressionStatement",
"src": "1128:28:7"
},
{
"expression": {
"hexValue": "74727565",
"id": 1419,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1177:4:7",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"functionReturnParameters": 1410,
"id": 1420,
"nodeType": "Return",
"src": "1170:11:7"
}
]
}
}
]
},
"id": 1433,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "transfer",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1407,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1402,
"mutability": "mutable",
"name": "tokenAddress",
"nodeType": "VariableDeclaration",
"scope": 1433,
"src": "971:20:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1401,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "971:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1404,
"mutability": "mutable",
"name": "to",
"nodeType": "VariableDeclaration",
"scope": 1433,
"src": "1001:10:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1403,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1001:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 1406,
"mutability": "mutable",
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 1433,
"src": "1021:14:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1405,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1021:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "961:80:7"
},
"returnParameters": {
"id": 1410,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1409,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1433,
"src": "1060:4:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 1408,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "1060:4:7",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"visibility": "internal"
}
],
"src": "1059:6:7"
},
"scope": 1464,
"src": "944:333:7",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
{
"body": {
"id": 1462,
"nodeType": "Block",
"src": "1356:190:7",
"statements": [
{
"condition": {
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 1442,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"id": 1440,
"name": "tokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1435,
"src": "1370:12:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"id": 1441,
"name": "_ethTokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1390,
"src": "1386:16:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "1370:32:7",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 1460,
"nodeType": "Block",
"src": "1463:77:7",
"statements": [
{
"expression": {
"arguments": [
{
"arguments": [
{
"id": 1456,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "1523:4:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_BalanceCarrier_$1464",
"typeString": "contract BalanceCarrier"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_BalanceCarrier_$1464",
"typeString": "contract BalanceCarrier"
}
],
"id": 1455,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1515:7:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 1454,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1515:7:7",
"typeDescriptions": {}
}
},
"id": 1457,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1515:13:7",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"expression": {
"arguments": [
{
"id": 1451,
"name": "tokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1435,
"src": "1491:12:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 1450,
"name": "IERC20",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 6165,
"src": "1484:6:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_IERC20_$6165_$",
"typeString": "type(contract IERC20)"
}
},
"id": 1452,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1484:20:7",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_contract$_IERC20_$6165",
"typeString": "contract IERC20"
}
},
"id": 1453,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balanceOf",
"nodeType": "MemberAccess",
"referencedDeclaration": 6104,
"src": "1484:30:7",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view external returns (uint256)"
}
},
"id": 1458,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1484:45:7",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 1439,
"id": 1459,
"nodeType": "Return",
"src": "1477:52:7"
}
]
},
"id": 1461,
"nodeType": "IfStatement",
"src": "1366:174:7",
"trueBody": {
"id": 1449,
"nodeType": "Block",
"src": "1404:53:7",
"statements": [
{
"expression": {
"expression": {
"arguments": [
{
"id": 1445,
"name": "this",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": -28,
"src": "1433:4:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_BalanceCarrier_$1464",
"typeString": "contract BalanceCarrier"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_BalanceCarrier_$1464",
"typeString": "contract BalanceCarrier"
}
],
"id": 1444,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1425:7:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": {
"id": 1443,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1425:7:7",
"typeDescriptions": {}
}
},
"id": 1446,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1425:13:7",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 1447,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "balance",
"nodeType": "MemberAccess",
"src": "1425:21:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 1439,
"id": 1448,
"nodeType": "Return",
"src": "1418:28:7"
}
]
}
}
]
},
"id": 1463,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "balanceOf",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1436,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1435,
"mutability": "mutable",
"name": "tokenAddress",
"nodeType": "VariableDeclaration",
"scope": 1463,
"src": "1302:20:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1434,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "1302:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"visibility": "internal"
}
],
"src": "1301:22:7"
},
"returnParameters": {
"id": 1439,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1438,
"mutability": "mutable",
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1463,
"src": "1347:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1437,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "1347:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
}
],
"src": "1346:9:7"
},
"scope": 1464,
"src": "1283:263:7",
"stateMutability": "view",
"virtual": false,
"visibility": "internal"
}
],
"scope": 1465,
"src": "754:794:7"
}
],
"src": "640:909:7"
},
"legacyAST": {
"attributes": {
"absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/BalanceCarrier.sol",
"exportedSymbols": {
"BalanceCarrier": [
1464
],
"ExternalCaller": [
1563
],
"IERC20": [
6165
]
},
"license": "Apache-2.0"
},
"children": [
{
"attributes": {
"literals": [
"solidity",
"^",
"0.7",
".0"
]
},
"id": 1384,
"name": "PragmaDirective",
"src": "640:23:7"
},
{
"attributes": {
"SourceUnit": 6166,
"absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"file": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"scope": 1465,
"symbolAliases": [
null
],
"unitAlias": ""
},
"id": 1385,
"name": "ImportDirective",
"src": "665:56:7"
},
{
"attributes": {
"SourceUnit": 1564,
"absolutePath": "/Users/andrekorol/src/kollateral/protocol/contracts/common/utils/ExternalCaller.sol",
"file": "./ExternalCaller.sol",
"scope": 1465,
"symbolAliases": [
null
],
"unitAlias": ""
},
"id": 1386,
"name": "ImportDirective",
"src": "722:30:7"
},
{
"attributes": {
"abstract": true,
"contractDependencies": [
1563
],
"contractKind": "contract",
"fullyImplemented": true,
"linearizedBaseContracts": [
1464,
1563
],
"name": "BalanceCarrier",
"scope": 1465
},
"children": [
{
"attributes": {},
"children": [
{
"attributes": {
"name": "ExternalCaller",
"referencedDeclaration": 1563,
"type": "contract ExternalCaller"
},
"id": 1387,
"name": "UserDefinedTypeName",
"src": "790:14:7"
}
],
"id": 1388,
"name": "InheritanceSpecifier",
"src": "790:14:7"
},
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "_ethTokenAddress",
"scope": 1464,
"stateVariable": true,
"storageLocation": "default",
"type": "address",
"visibility": "private"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 1389,
"name": "ElementaryTypeName",
"src": "811:7:7"
}
],
"id": 1390,
"name": "VariableDeclaration",
"src": "811:32:7"
},
{
"attributes": {
"implemented": true,
"isConstructor": true,
"kind": "constructor",
"modifiers": [
null
],
"name": "",
"scope": 1464,
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "internal"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"mutability": "mutable",
"name": "ethTokenAddress",
"scope": 1400,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 1391,
"name": "ElementaryTypeName",
"src": "862:7:7"
}
],
"id": 1392,
"name": "VariableDeclaration",
"src": "862:23:7"
}
],
"id": 1393,
"name": "ParameterList",
"src": "861:25:7"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 1394,
"name": "ParameterList",
"src": "887:0:7"
},
{
"children": [
{
"children": [
{
"attributes": {
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address"
},
"children": [
{
"attributes": {
"overloadedDeclarations": [
null
],
"referencedDeclaration": 1390,
"type": "