@kollateral/kollateral-contracts
Version:
1,083 lines (1,082 loc) • 209 kB
JSON
{
"contractName": "KollateralInvokable",
"abi": [],
"metadata": "{\"compiler\":{\"version\":\"0.5.16+commit.9c3226ce\"},\"language\":\"Solidity\",\"output\":{\"abi\":[],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/Users/kbrizzle/code/kollateral/protocol/contracts/helpers/KollateralInvokable.sol\":\"KollateralInvokable\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/Users/kbrizzle/code/kollateral/protocol/contracts/ExtendedMath.sol\":{\"keccak256\":\"0x9b4a67b1242134b64f557613259bfb51268d488cbc7b27cb2bc72c2f21f2b71f\",\"urls\":[\"bzz-raw://47bc3f04cddcbbe7a0373a074d50bbc1720ef7d73266532aab07474ea426ab43\",\"dweb:/ipfs/QmdPdivc8yXbmvDL1nG8xXHJF7qcfx6JqQoCFBv1ohDmdP\"]},\"/Users/kbrizzle/code/kollateral/protocol/contracts/Invoker.sol\":{\"keccak256\":\"0xc6c6e31ef43758db90ef5f21ff27519ea736f40088abf4b635ac29ba658eb784\",\"urls\":[\"bzz-raw://50968c9a288e9c44d61a1912fc3a44c57fc6c07ab564be99e1b3395c89583b0d\",\"dweb:/ipfs/QmNeN8jTLcwx31J6vyxdgS2e5uyToZNstWWQ28xAK6kEAU\"]},\"/Users/kbrizzle/code/kollateral/protocol/contracts/KToken.sol\":{\"keccak256\":\"0x748a3edca97018638a9ed18f3484977c124517f2261af8a7be3e1b8ee2fbe8a8\",\"urls\":[\"bzz-raw://9b5d42beda89cdf788e79cec733d96c4c4eaf896694948ee2c0fa5bb46d3972c\",\"dweb:/ipfs/Qmc9sGpHe3CTiEG9gzrdHtCgsuHBfAToTBGYmL8a4JL3J1\"]},\"/Users/kbrizzle/code/kollateral/protocol/contracts/helpers/KollateralInvokable.sol\":{\"keccak256\":\"0x653d1d930de94774c0e4ca7beb155db84656dc24ad94071bdb16a9b013c92f78\",\"urls\":[\"bzz-raw://6656eca4d9385d22725cac49012f7eb6042aa1519680affed0673858111b2af0\",\"dweb:/ipfs/QmfWENLFW34soWoHM2bT2BcD7ALcjsgtkcezGW9wu5rx1e\"]},\"/Users/kbrizzle/code/kollateral/protocol/contracts/interfaces/IInvoker.sol\":{\"keccak256\":\"0x8ad397e0611b31884a19bed7b27712530efb95ecf032fc8b8e0c25f4d3190569\",\"urls\":[\"bzz-raw://b23aa7fa654935abb0286ceac8eaf281589b866b75f0cc5b2d8971e1378e98c1\",\"dweb:/ipfs/QmVqYaxBEQVGfXUXVSFXaG6ZfFz5dEwkjDoMprZqbLAnyN\"]},\"/Users/kbrizzle/code/kollateral/protocol/contracts/interfaces/IKToken.sol\":{\"keccak256\":\"0x5b03d279a41856eef739da4ee50155425bbd95d99d80e4b910ec5abb91a99e40\",\"urls\":[\"bzz-raw://4ef7259b5604ef20e62b2503bc34d4052f99b85a18a80b072b8883bb7f9559de\",\"dweb:/ipfs/QmUsVQH9M3FoB4rpJGZJpZrbk2kcDFyRg5E5WfAKqHYkok\"]},\"@openzeppelin/contracts/GSN/Context.sol\":{\"keccak256\":\"0x90a3995645af7562d84b9d69363ffa5ae7217714ab61e951bf7bc450f40e4061\",\"urls\":[\"bzz-raw://216ef9d6b614db4eb46970b4e84903f2534a45572dd30a79f0041f1a5830f436\",\"dweb:/ipfs/QmNPrJ4MWKUAWzKXpUqeyKRUfosaoANZAqXgvepdrCwZAG\"]},\"@openzeppelin/contracts/access/Roles.sol\":{\"keccak256\":\"0xb002c378d7b82a101bd659c341518953ca0919d342c0a400196982c0e7e7bcdb\",\"urls\":[\"bzz-raw://00a788c4631466c220b385bdd100c571d24b2deccd657615cfbcef6cadf669a4\",\"dweb:/ipfs/QmTEwDbjJNxmMNCDMqtuou3dyM8Wtp8Q9NFvn7SAVM7Jf3\"]},\"@openzeppelin/contracts/access/roles/PauserRole.sol\":{\"keccak256\":\"0xd1b5c934bab36d753c22987ad98c7614cb50ebf641371a83c96f8138619d7c30\",\"urls\":[\"bzz-raw://69c4bb822caae3d1bfd38e81f03b6d618d4d83cbb8e9f8236d28e1c4fe1d0d81\",\"dweb:/ipfs/QmWamstbFhdySmocF2TSKYVLLZF24JG4aXMvHiRdWKv3RA\"]},\"@openzeppelin/contracts/lifecycle/Pausable.sol\":{\"keccak256\":\"0xd3e5a49edfb74654d122962cc60b917d1c60461e669a7262fd7aba201fac1260\",\"urls\":[\"bzz-raw://0307a3cae4df037aee16fb0b0d94849cb4d9b20d7d7182c185f3efac6d2caec0\",\"dweb:/ipfs/QmezTANBfrJmCvxfmfyfcfFGtbcUEUtoJCjfxKnAePiNoE\"]},\"@openzeppelin/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x640b6dee7a4b830bdfd52b5031a07fc2b12209f5b2e29e5d364a7d37f69d8076\",\"urls\":[\"bzz-raw://31113152e1ddb78fe7a4197f247591ca894e93f916867beb708d8e747b6cc74f\",\"dweb:/ipfs/QmbZaJyXdpsYGykVhHH9qpVGQg9DGCxE2QufbCUy3daTgq\"]},\"@openzeppelin/contracts/ownership/Ownable.sol\":{\"keccak256\":\"0xecd8ab29d9a5771c3964d0cd1788c4a5098a0081b20fb275da850a22b1c59806\",\"urls\":[\"bzz-raw://696a75bc2c55407ce8251ccc7d19ecb1b7b2be1796a160a6524312babcc7e3d4\",\"dweb:/ipfs/QmQViKEp3y99h9uhRssE29TmjBKRnFMaoz3eJZ4eggggg2\"]},\"@openzeppelin/contracts/token/ERC20/ERC20.sol\":{\"keccak256\":\"0x65a4078c03875c25413a068ce9cfdd7e68a90f8786612d1189c89341e6e3b802\",\"urls\":[\"bzz-raw://45c0d95495b944fbb1aa09d900b0ab530903a432125ab8fddfa05064a7988991\",\"dweb:/ipfs/Qma2VeknkKA1THeubGzshWFk44BktXkXP1UKp9Un2uDSsu\"]},\"@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol\":{\"keccak256\":\"0x4a3a810b7ebe742e897e1fd428b3eeed2196d3acea58eaf9c566ed10d545d2ed\",\"urls\":[\"bzz-raw://28d03f328e19e4099d5013de0649afaeaabac1a614e130767ab1cb4aca9775b6\",\"dweb:/ipfs/Qmb9iW7yNuYehB2NfhRMs9TakqbLVQhBhmGMkaDZ5g1Eb4\"]},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0xe5bb0f57cff3e299f360052ba50f1ea0fff046df2be070b6943e0e3c3fdad8a9\",\"urls\":[\"bzz-raw://59fd025151435da35faa8093a5c7a17de02de9d08ad27275c5cdf05050820d91\",\"dweb:/ipfs/QmQMvwEcPhoRXzbXyrdoeRtvLoifUW9Qh7Luho7bmUPRkc\"]},\"@openzeppelin/contracts/utils/ReentrancyGuard.sol\":{\"keccak256\":\"0xe86fdc15fbc379ecf14d6aa4f51b87c0be8476e114e23c171b790a6717230655\",\"urls\":[\"bzz-raw://81905037f66d37ed211a4e3430af74f36e18b3a5d5b688e6d7d5ee199824a41a\",\"dweb:/ipfs/QmTcpgNKqLVRbcgNSUHazAbVf2bz5uh5mPkAijGeYW7Sqb\"]}},\"version\":1}",
"bytecode": "0x6080604052348015600f57600080fd5b50603e80601d6000396000f3fe6080604052600080fdfea265627a7a7231582060976e3a373542cc8802272ecb02e354bbccc0dd88268b986a21194440eeac4d64736f6c63430005100032",
"deployedBytecode": "0x6080604052600080fdfea265627a7a7231582060976e3a373542cc8802272ecb02e354bbccc0dd88268b986a21194440eeac4d64736f6c63430005100032",
"sourceMap": "184:1779:7:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;184:1779:7;;;;;;;",
"deployedSourceMap": "184:1779:7:-;;;;;",
"source": "pragma solidity ^0.5.0;\n\nimport \"@openzeppelin/contracts/math/SafeMath.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"../Invoker.sol\";\nimport \"../KToken.sol\";\n\ncontract KollateralInvokable {\n using SafeMath for uint256;\n\n function currentKTokenAddress() internal view returns (address) {\n return Invoker(msg.sender).currentKTokenAddress();\n }\n\n function currentTokenAddress() internal view returns (address) {\n return Invoker(msg.sender).currentTokenAddress();\n }\n\n function currentTokenAmount() internal view returns (uint256) {\n return Invoker(msg.sender).currentTokenAmount();\n }\n\n function currentExpectedBalance() internal view returns (uint256) {\n return Invoker(msg.sender).currentExpectedBalance();\n }\n\n function currentKTokenTotalReserve() internal view returns (uint256) {\n return KToken(currentKTokenAddress()).totalReserve();\n }\n\n function currentOutstandingTokenAmount() internal view returns (uint256) {\n return currentExpectedBalance().sub(currentKTokenTotalReserve());\n }\n\n function isKTokenKEther() internal view returns (bool) {\n return KToken(currentKTokenAddress()).isKEther();\n }\n\n function repay() internal returns (bool) {\n return repayAmount(currentOutstandingTokenAmount());\n }\n\n function repayAmount(uint256 amount) internal returns (bool) {\n if (isKTokenKEther()) {\n address payable kEtherAddress = address(uint160(currentKTokenAddress()));\n require(address(this).balance >= amount, \"KollateralInvokable: not enough ether balance\");\n kEtherAddress.transfer(amount);\n return true;\n } else {\n IERC20 token = IERC20(currentTokenAddress());\n require(token.balanceOf(address(this)) >= amount, \"KollateralInvokable: not enough token balance\");\n return token.transfer(currentKTokenAddress(), amount);\n }\n }\n}\n",
"sourcePath": "/Users/kbrizzle/code/kollateral/protocol/contracts/helpers/KollateralInvokable.sol",
"ast": {
"absolutePath": "/Users/kbrizzle/code/kollateral/protocol/contracts/helpers/KollateralInvokable.sol",
"exportedSymbols": {
"KollateralInvokable": [
1819
]
},
"id": 1820,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1643,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:7"
},
{
"absolutePath": "@openzeppelin/contracts/math/SafeMath.sol",
"file": "@openzeppelin/contracts/math/SafeMath.sol",
"id": 1644,
"nodeType": "ImportDirective",
"scope": 1820,
"sourceUnit": 2904,
"src": "25:51:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"file": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"id": 1645,
"nodeType": "ImportDirective",
"scope": 1820,
"sourceUnit": 3550,
"src": "77:56:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/kbrizzle/code/kollateral/protocol/contracts/Invoker.sol",
"file": "../Invoker.sol",
"id": 1646,
"nodeType": "ImportDirective",
"scope": 1820,
"sourceUnit": 422,
"src": "134:24:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/Users/kbrizzle/code/kollateral/protocol/contracts/KToken.sol",
"file": "../KToken.sol",
"id": 1647,
"nodeType": "ImportDirective",
"scope": 1820,
"sourceUnit": 1117,
"src": "159:23:7",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 1819,
"linearizedBaseContracts": [
1819
],
"name": "KollateralInvokable",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 1650,
"libraryName": {
"contractScope": null,
"id": 1648,
"name": "SafeMath",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 2903,
"src": "225:8:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SafeMath_$2903",
"typeString": "library SafeMath"
}
},
"nodeType": "UsingForDirective",
"src": "219:27:7",
"typeName": {
"id": 1649,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "238:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
{
"body": {
"id": 1662,
"nodeType": "Block",
"src": "316:66:7",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1656,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3596,
"src": "341:3:7",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 1657,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "341:10:7",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 1655,
"name": "Invoker",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 421,
"src": "333:7:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Invoker_$421_$",
"typeString": "type(contract Invoker)"
}
},
"id": 1658,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "333:19:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Invoker_$421",
"typeString": "contract Invoker"
}
},
"id": 1659,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "currentKTokenAddress",
"nodeType": "MemberAccess",
"referencedDeclaration": 352,
"src": "333:40:7",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_address_$",
"typeString": "function () view external returns (address)"
}
},
"id": 1660,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "333:42:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"functionReturnParameters": 1654,
"id": 1661,
"nodeType": "Return",
"src": "326:49:7"
}
]
},
"documentation": null,
"id": 1663,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentKTokenAddress",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1651,
"nodeType": "ParameterList",
"parameters": [],
"src": "281:2:7"
},
"returnParameters": {
"id": 1654,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1653,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1663,
"src": "307:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1652,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "307:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "306:9:7"
},
"scope": 1819,
"src": "252:130:7",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 1675,
"nodeType": "Block",
"src": "451:65:7",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1669,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3596,
"src": "476:3:7",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 1670,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "476:10:7",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 1668,
"name": "Invoker",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 421,
"src": "468:7:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Invoker_$421_$",
"typeString": "type(contract Invoker)"
}
},
"id": 1671,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "468:19:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Invoker_$421",
"typeString": "contract Invoker"
}
},
"id": 1672,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "currentTokenAddress",
"nodeType": "MemberAccess",
"referencedDeclaration": 362,
"src": "468:39:7",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_address_$",
"typeString": "function () view external returns (address)"
}
},
"id": 1673,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "468:41:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"functionReturnParameters": 1667,
"id": 1674,
"nodeType": "Return",
"src": "461:48:7"
}
]
},
"documentation": null,
"id": 1676,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentTokenAddress",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1664,
"nodeType": "ParameterList",
"parameters": [],
"src": "416:2:7"
},
"returnParameters": {
"id": 1667,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1666,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1676,
"src": "442:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 1665,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "442:7:7",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "441:9:7"
},
"scope": 1819,
"src": "388:128:7",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 1688,
"nodeType": "Block",
"src": "584:64:7",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1682,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3596,
"src": "609:3:7",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 1683,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "609:10:7",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 1681,
"name": "Invoker",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 421,
"src": "601:7:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Invoker_$421_$",
"typeString": "type(contract Invoker)"
}
},
"id": 1684,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "601:19:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Invoker_$421",
"typeString": "contract Invoker"
}
},
"id": 1685,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "currentTokenAmount",
"nodeType": "MemberAccess",
"referencedDeclaration": 336,
"src": "601:38:7",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 1686,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "601:40:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 1680,
"id": 1687,
"nodeType": "Return",
"src": "594:47:7"
}
]
},
"documentation": null,
"id": 1689,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentTokenAmount",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1677,
"nodeType": "ParameterList",
"parameters": [],
"src": "549:2:7"
},
"returnParameters": {
"id": 1680,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1679,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1689,
"src": "575:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1678,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "575:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "574:9:7"
},
"scope": 1819,
"src": "522:126:7",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 1701,
"nodeType": "Block",
"src": "720:68:7",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 1695,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3596,
"src": "745:3:7",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 1696,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "745:10:7",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 1694,
"name": "Invoker",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 421,
"src": "737:7:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Invoker_$421_$",
"typeString": "type(contract Invoker)"
}
},
"id": 1697,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "737:19:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Invoker_$421",
"typeString": "contract Invoker"
}
},
"id": 1698,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "currentExpectedBalance",
"nodeType": "MemberAccess",
"referencedDeclaration": 344,
"src": "737:42:7",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 1699,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "737:44:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 1693,
"id": 1700,
"nodeType": "Return",
"src": "730:51:7"
}
]
},
"documentation": null,
"id": 1702,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentExpectedBalance",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1690,
"nodeType": "ParameterList",
"parameters": [],
"src": "685:2:7"
},
"returnParameters": {
"id": 1693,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1692,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1702,
"src": "711:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1691,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "711:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "710:9:7"
},
"scope": 1819,
"src": "654:134:7",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 1714,
"nodeType": "Block",
"src": "863:69:7",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 1708,
"name": "currentKTokenAddress",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1663,
"src": "887:20:7",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_address_$",
"typeString": "function () view returns (address)"
}
},
"id": 1709,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "887:22:7",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 1707,
"name": "KToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1116,
"src": "880:6:7",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_KToken_$1116_$",
"typeString": "type(contract KToken)"
}
},
"id": 1710,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "880:30:7",
"typeDescriptions": {
"typeIdentifier": "t_contract$_KToken_$1116",
"typeString": "contract KToken"
}
},
"id": 1711,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "totalReserve",
"nodeType": "MemberAccess",
"referencedDeclaration": 1030,
"src": "880:43:7",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint256_$",
"typeString": "function () view external returns (uint256)"
}
},
"id": 1712,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "880:45:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 1706,
"id": 1713,
"nodeType": "Return",
"src": "873:52:7"
}
]
},
"documentation": null,
"id": 1715,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentKTokenTotalReserve",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1703,
"nodeType": "ParameterList",
"parameters": [],
"src": "828:2:7"
},
"returnParameters": {
"id": 1706,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1705,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1715,
"src": "854:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 1704,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "854:7:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "853:9:7"
},
"scope": 1819,
"src": "794:138:7",
"stateMutability": "view",
"superFunction": null,
"visibility": "internal"
},
{
"body": {
"id": 1727,
"nodeType": "Block",
"src": "1011:81:7",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 1723,
"name": "currentKTokenTotalReserve",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1715,
"src": "1057:25:7",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$",
"typeString": "function () view returns (uint256)"
}
},
"id": 1724,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1057:27:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"id": 1720,
"name": "currentExpectedBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1702,
"src": "1028:22:7",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$",
"typeString": "function () view returns (uint256)"
}
},
"id": 1721,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1028:24:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 1722,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sub",
"nodeType": "MemberAccess",
"referencedDeclaration": 2759,
"src": "1028:28:7",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 1725,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1028:57:7",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 1719,
"id": 1726,
"nodeType": "Return",
"src": "1021:64:7"
}
]
},
"documentation": null,
"id": 1728,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "currentOutstandingTokenAmount",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 1716,
"nodeType": "ParameterList",
"parameters": [],
"src": "976:2:7"
},
"returnParameters": {
"id": 1719,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 1718,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 1728,
"src": "1002:7:7",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {