Skip to content

Instantly share code, notes, and snippets.

@rocky
Last active February 27, 2019 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rocky/a00769de657277e6e69571f50632ac0e to your computer and use it in GitHub Desktop.
Save rocky/a00769de657277e6e69571f50632ac0e to your computer and use it in GitHub Desktop.
more MythX-friendly solc JSON
{
"contracts": {
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol": {
"ConvertLib": {
"abi": [
{
"constant": true,
"inputs": [
{
"name": "amount",
"type": "uint256"
},
{
"name": "conversionRate",
"type": "uint256"
}
],
"name": "convert",
"outputs": [
{
"name": "convertedAmount",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
}
],
"devdoc": {
"methods": {}
},
"evm": {
"assembly": " /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":34:189 library ConvertLib{... */\n dataSize(sub_0)\n dataOffset(sub_0)\n /* \"--CODEGEN--\":132:134 */\n 0x0b\n /* \"--CODEGEN--\":166:173 */\n dup3\n /* \"--CODEGEN--\":155:164 */\n dup3\n /* \"--CODEGEN--\":146:153 */\n dup3\n /* \"--CODEGEN--\":137:174 */\n codecopy\n /* \"--CODEGEN--\":252:259 */\n dup1\n /* \"--CODEGEN--\":246:260 */\n mload\n /* \"--CODEGEN--\":243:244 */\n 0x00\n /* \"--CODEGEN--\":238:261 */\n byte\n /* \"--CODEGEN--\":232:236 */\n 0x73\n /* \"--CODEGEN--\":229:262 */\n eq\n /* \"--CODEGEN--\":270:271 */\n 0x00\n /* \"--CODEGEN--\":265:285 */\n dup2\n eq\n tag_2\n jumpi\n /* \"--CODEGEN--\":222:285 */\n jump(tag_1)\n /* \"--CODEGEN--\":265:285 */\ntag_2:\n /* \"--CODEGEN--\":274:283 */\n invalid\n /* \"--CODEGEN--\":222:285 */\ntag_1:\n pop\n /* \"--CODEGEN--\":298:307 */\n address\n /* \"--CODEGEN--\":295:296 */\n 0x00\n /* \"--CODEGEN--\":288:308 */\n mstore\n /* \"--CODEGEN--\":328:332 */\n 0x73\n /* \"--CODEGEN--\":319:326 */\n dup2\n /* \"--CODEGEN--\":311:333 */\n mstore8\n /* \"--CODEGEN--\":352:359 */\n dup3\n /* \"--CODEGEN--\":343:350 */\n dup2\n /* \"--CODEGEN--\":336:360 */\n return\nstop\n\nsub_0: assembly {\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":34:189 library ConvertLib{... */\n eq(address, deployTimeAddress())\n mstore(0x40, 0x80)\n jumpi(tag_1, lt(calldatasize, 0x04))\n calldataload(0x00)\n 0x0100000000000000000000000000000000000000000000000000000000\n swap1\n div\n dup1\n 0x96e4ee3d\n eq\n tag_2\n jumpi\n tag_1:\n 0x00\n dup1\n revert\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":55:187 function convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount)... */\n tag_2:\n tag_3\n 0x04\n dup1\n calldatasize\n sub\n /* \"--CODEGEN--\":13:15 */\n 0x40\n /* \"--CODEGEN--\":8:11 */\n dup2\n /* \"--CODEGEN--\":5:16 */\n lt\n /* \"--CODEGEN--\":2:4 */\n iszero\n tag_4\n jumpi\n /* \"--CODEGEN--\":29:30 */\n 0x00\n /* \"--CODEGEN--\":26:27 */\n dup1\n /* \"--CODEGEN--\":19:31 */\n revert\n /* \"--CODEGEN--\":2:4 */\n tag_4:\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":55:187 function convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount)... */\n dup2\n add\n swap1\n dup1\n dup1\n calldataload\n swap1\n 0x20\n add\n swap1\n swap3\n swap2\n swap1\n dup1\n calldataload\n swap1\n 0x20\n add\n swap1\n swap3\n swap2\n swap1\n pop\n pop\n pop\n tag_5\n jump\t// in\n tag_3:\n mload(0x40)\n dup1\n dup3\n dup2\n mstore\n 0x20\n add\n swap2\n pop\n pop\n mload(0x40)\n dup1\n swap2\n sub\n swap1\n return\n tag_5:\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":126:146 uint convertedAmount */\n 0x00\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":169:183 conversionRate */\n dup2\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":160:166 amount */\n dup4\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":160:183 amount * conversionRate */\n mul\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":153:183 return amount * conversionRate */\n swap1\n pop\n /* \"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":55:187 function convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount)... */\n swap3\n swap2\n pop\n pop\n jump\t// out\n\n auxdata: 0xa165627a7a7230582094ca199c801839337331343f733fa7283c9d7f430a20e7ec95933a083287a6d80029\n}\n",
"bytecode": {
"linkReferences": {},
"object": "60d761002f600b82828239805160001a6073146000811461001f57610021565bfe5b5030600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106050576000357c01000000000000000000000000000000000000000000000000000000009004806396e4ee3d146055575b600080fd5b608860048036036040811015606957600080fd5b810190808035906020019092919080359060200190929190505050609e565b6040518082815260200191505060405180910390f35b600081830290509291505056fea165627a7a7230582094ca199c801839337331343f733fa7283c9d7f430a20e7ec95933a083287a6d80029",
"opcodes": "PUSH1 0xD7 PUSH2 0x2F PUSH1 0xB DUP3 DUP3 DUP3 CODECOPY DUP1 MLOAD PUSH1 0x0 BYTE PUSH1 0x73 EQ PUSH1 0x0 DUP2 EQ PUSH2 0x1F JUMPI PUSH2 0x21 JUMP JUMPDEST INVALID JUMPDEST POP ADDRESS PUSH1 0x0 MSTORE PUSH1 0x73 DUP2 MSTORE8 DUP3 DUP2 RETURN INVALID PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x50 JUMPI PUSH1 0x0 CALLDATALOAD PUSH29 0x100000000000000000000000000000000000000000000000000000000 SWAP1 DIV DUP1 PUSH4 0x96E4EE3D EQ PUSH1 0x55 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x88 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x40 DUP2 LT ISZERO PUSH1 0x69 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH1 0x9E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP2 DUP4 MUL SWAP1 POP SWAP3 SWAP2 POP POP JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 SWAP5 0xca NOT SWAP13 DUP1 XOR CODECOPY CALLER PUSH20 0x31343F733FA7283C9D7F430A20E7EC95933A0832 DUP8 0xa6 0xd8 STOP 0x29 ",
"sourceMap": "34:155:0:-;;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"
},
"deployedBytecode": {
"linkReferences": {},
"object": "73000000000000000000000000000000000000000030146080604052600436106050576000357c01000000000000000000000000000000000000000000000000000000009004806396e4ee3d146055575b600080fd5b608860048036036040811015606957600080fd5b810190808035906020019092919080359060200190929190505050609e565b6040518082815260200191505060405180910390f35b600081830290509291505056fea165627a7a7230582094ca199c801839337331343f733fa7283c9d7f430a20e7ec95933a083287a6d80029",
"opcodes": "PUSH20 0x0 ADDRESS EQ PUSH1 0x80 PUSH1 0x40 MSTORE PUSH1 0x4 CALLDATASIZE LT PUSH1 0x50 JUMPI PUSH1 0x0 CALLDATALOAD PUSH29 0x100000000000000000000000000000000000000000000000000000000 SWAP1 DIV DUP1 PUSH4 0x96E4EE3D EQ PUSH1 0x55 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH1 0x88 PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0x40 DUP2 LT ISZERO PUSH1 0x69 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 DUP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP1 SWAP3 SWAP2 SWAP1 POP POP POP PUSH1 0x9E JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 DUP3 DUP2 MSTORE PUSH1 0x20 ADD SWAP2 POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH1 0x0 DUP2 DUP4 MUL SWAP1 POP SWAP3 SWAP2 POP POP JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 SWAP5 0xca NOT SWAP13 DUP1 XOR CODECOPY CALLER PUSH20 0x31343F733FA7283C9D7F430A20E7EC95933A0832 DUP8 0xa6 0xd8 STOP 0x29 ",
"sourceMap": "34:155:0:-;;;;;;;;;;;;;;;;;;;;;;;;;55:132;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;55:132:0;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;126:20;169:14;160:6;:23;153:30;;55:132;;;;:::o"
},
"gasEstimates": {
"creation": {
"codeDepositCost": "43000",
"executionCost": "143",
"totalCost": "43143"
},
"external": {
"convert(uint256,uint256)": "304"
}
},
"legacyAssembly": {
".code": [
{
"begin": 34,
"end": 189,
"name": "PUSH #[$]",
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 34,
"end": 189,
"name": "PUSH [$]",
"value": "0000000000000000000000000000000000000000000000000000000000000000"
},
{
"begin": 132,
"end": 134,
"name": "PUSH",
"value": "B"
},
{
"begin": 166,
"end": 173,
"name": "DUP3"
},
{
"begin": 155,
"end": 164,
"name": "DUP3"
},
{
"begin": 146,
"end": 153,
"name": "DUP3"
},
{
"begin": 137,
"end": 174,
"name": "CODECOPY"
},
{
"begin": 252,
"end": 259,
"name": "DUP1"
},
{
"begin": 246,
"end": 260,
"name": "MLOAD"
},
{
"begin": 243,
"end": 244,
"name": "PUSH",
"value": "0"
},
{
"begin": 238,
"end": 261,
"name": "BYTE"
},
{
"begin": 232,
"end": 236,
"name": "PUSH",
"value": "73"
},
{
"begin": 229,
"end": 262,
"name": "EQ"
},
{
"begin": 270,
"end": 271,
"name": "PUSH",
"value": "0"
},
{
"begin": 265,
"end": 285,
"name": "DUP2"
},
{
"begin": 265,
"end": 285,
"name": "EQ"
},
{
"begin": 265,
"end": 285,
"name": "PUSH [tag]",
"value": "2"
},
{
"begin": 265,
"end": 285,
"name": "JUMPI"
},
{
"begin": 222,
"end": 285,
"name": "PUSH [tag]",
"value": "1"
},
{
"begin": 222,
"end": 285,
"name": "JUMP"
},
{
"begin": 265,
"end": 285,
"name": "tag",
"value": "2"
},
{
"begin": 265,
"end": 285,
"name": "JUMPDEST"
},
{
"begin": 274,
"end": 283,
"name": "INVALID"
},
{
"begin": 222,
"end": 285,
"name": "tag",
"value": "1"
},
{
"begin": 222,
"end": 285,
"name": "JUMPDEST"
},
{
"begin": 222,
"end": 285,
"name": "POP"
},
{
"begin": 298,
"end": 307,
"name": "ADDRESS"
},
{
"begin": 295,
"end": 296,
"name": "PUSH",
"value": "0"
},
{
"begin": 288,
"end": 308,
"name": "MSTORE"
},
{
"begin": 328,
"end": 332,
"name": "PUSH",
"value": "73"
},
{
"begin": 319,
"end": 326,
"name": "DUP2"
},
{
"begin": 311,
"end": 333,
"name": "MSTORE8"
},
{
"begin": 352,
"end": 359,
"name": "DUP3"
},
{
"begin": 343,
"end": 350,
"name": "DUP2"
},
{
"begin": 336,
"end": 360,
"name": "RETURN"
}
],
".data": {
"0": {
".auxdata": "a165627a7a7230582094ca199c801839337331343f733fa7283c9d7f430a20e7ec95933a083287a6d80029",
".code": [
{
"begin": 34,
"end": 189,
"name": "PUSHDEPLOYADDRESS"
},
{
"begin": 34,
"end": 189,
"name": "ADDRESS"
},
{
"begin": 34,
"end": 189,
"name": "EQ"
},
{
"begin": 34,
"end": 189,
"name": "PUSH",
"value": "80"
},
{
"begin": 34,
"end": 189,
"name": "PUSH",
"value": "40"
},
{
"begin": 34,
"end": 189,
"name": "MSTORE"
},
{
"begin": 34,
"end": 189,
"name": "PUSH",
"value": "4"
},
{
"begin": 34,
"end": 189,
"name": "CALLDATASIZE"
},
{
"begin": 34,
"end": 189,
"name": "LT"
},
{
"begin": 34,
"end": 189,
"name": "PUSH [tag]",
"value": "1"
},
{
"begin": 34,
"end": 189,
"name": "JUMPI"
},
{
"begin": 34,
"end": 189,
"name": "PUSH",
"value": "0"
},
{
"begin": 34,
"end": 189,
"name": "CALLDATALOAD"
},
{
"begin": 34,
"end": 189,
"name": "PUSH",
"value": "100000000000000000000000000000000000000000000000000000000"
},
{
"begin": 34,
"end": 189,
"name": "SWAP1"
},
{
"begin": 34,
"end": 189,
"name": "DIV"
},
{
"begin": 34,
"end": 189,
"name": "DUP1"
},
{
"begin": 34,
"end": 189,
"name": "PUSH",
"value": "96E4EE3D"
},
{
"begin": 34,
"end": 189,
"name": "EQ"
},
{
"begin": 34,
"end": 189,
"name": "PUSH [tag]",
"value": "2"
},
{
"begin": 34,
"end": 189,
"name": "JUMPI"
},
{
"begin": 34,
"end": 189,
"name": "tag",
"value": "1"
},
{
"begin": 34,
"end": 189,
"name": "JUMPDEST"
},
{
"begin": 34,
"end": 189,
"name": "PUSH",
"value": "0"
},
{
"begin": 34,
"end": 189,
"name": "DUP1"
},
{
"begin": 34,
"end": 189,
"name": "REVERT"
},
{
"begin": 55,
"end": 187,
"name": "tag",
"value": "2"
},
{
"begin": 55,
"end": 187,
"name": "JUMPDEST"
},
{
"begin": 55,
"end": 187,
"name": "PUSH [tag]",
"value": "3"
},
{
"begin": 55,
"end": 187,
"name": "PUSH",
"value": "4"
},
{
"begin": 55,
"end": 187,
"name": "DUP1"
},
{
"begin": 55,
"end": 187,
"name": "CALLDATASIZE"
},
{
"begin": 55,
"end": 187,
"name": "SUB"
},
{
"begin": 13,
"end": 15,
"name": "PUSH",
"value": "40"
},
{
"begin": 8,
"end": 11,
"name": "DUP2"
},
{
"begin": 5,
"end": 16,
"name": "LT"
},
{
"begin": 2,
"end": 4,
"name": "ISZERO"
},
{
"begin": 2,
"end": 4,
"name": "PUSH [tag]",
"value": "4"
},
{
"begin": 2,
"end": 4,
"name": "JUMPI"
},
{
"begin": 29,
"end": 30,
"name": "PUSH",
"value": "0"
},
{
"begin": 26,
"end": 27,
"name": "DUP1"
},
{
"begin": 19,
"end": 31,
"name": "REVERT"
},
{
"begin": 2,
"end": 4,
"name": "tag",
"value": "4"
},
{
"begin": 2,
"end": 4,
"name": "JUMPDEST"
},
{
"begin": 55,
"end": 187,
"name": "DUP2"
},
{
"begin": 55,
"end": 187,
"name": "ADD"
},
{
"begin": 55,
"end": 187,
"name": "SWAP1"
},
{
"begin": 55,
"end": 187,
"name": "DUP1"
},
{
"begin": 55,
"end": 187,
"name": "DUP1"
},
{
"begin": 55,
"end": 187,
"name": "CALLDATALOAD"
},
{
"begin": 55,
"end": 187,
"name": "SWAP1"
},
{
"begin": 55,
"end": 187,
"name": "PUSH",
"value": "20"
},
{
"begin": 55,
"end": 187,
"name": "ADD"
},
{
"begin": 55,
"end": 187,
"name": "SWAP1"
},
{
"begin": 55,
"end": 187,
"name": "SWAP3"
},
{
"begin": 55,
"end": 187,
"name": "SWAP2"
},
{
"begin": 55,
"end": 187,
"name": "SWAP1"
},
{
"begin": 55,
"end": 187,
"name": "DUP1"
},
{
"begin": 55,
"end": 187,
"name": "CALLDATALOAD"
},
{
"begin": 55,
"end": 187,
"name": "SWAP1"
},
{
"begin": 55,
"end": 187,
"name": "PUSH",
"value": "20"
},
{
"begin": 55,
"end": 187,
"name": "ADD"
},
{
"begin": 55,
"end": 187,
"name": "SWAP1"
},
{
"begin": 55,
"end": 187,
"name": "SWAP3"
},
{
"begin": 55,
"end": 187,
"name": "SWAP2"
},
{
"begin": 55,
"end": 187,
"name": "SWAP1"
},
{
"begin": 55,
"end": 187,
"name": "POP"
},
{
"begin": 55,
"end": 187,
"name": "POP"
},
{
"begin": 55,
"end": 187,
"name": "POP"
},
{
"begin": 55,
"end": 187,
"name": "PUSH [tag]",
"value": "5"
},
{
"begin": 55,
"end": 187,
"name": "JUMP",
"value": "[in]"
},
{
"begin": 55,
"end": 187,
"name": "tag",
"value": "3"
},
{
"begin": 55,
"end": 187,
"name": "JUMPDEST"
},
{
"begin": 55,
"end": 187,
"name": "PUSH",
"value": "40"
},
{
"begin": 55,
"end": 187,
"name": "MLOAD"
},
{
"begin": 55,
"end": 187,
"name": "DUP1"
},
{
"begin": 55,
"end": 187,
"name": "DUP3"
},
{
"begin": 55,
"end": 187,
"name": "DUP2"
},
{
"begin": 55,
"end": 187,
"name": "MSTORE"
},
{
"begin": 55,
"end": 187,
"name": "PUSH",
"value": "20"
},
{
"begin": 55,
"end": 187,
"name": "ADD"
},
{
"begin": 55,
"end": 187,
"name": "SWAP2"
},
{
"begin": 55,
"end": 187,
"name": "POP"
},
{
"begin": 55,
"end": 187,
"name": "POP"
},
{
"begin": 55,
"end": 187,
"name": "PUSH",
"value": "40"
},
{
"begin": 55,
"end": 187,
"name": "MLOAD"
},
{
"begin": 55,
"end": 187,
"name": "DUP1"
},
{
"begin": 55,
"end": 187,
"name": "SWAP2"
},
{
"begin": 55,
"end": 187,
"name": "SUB"
},
{
"begin": 55,
"end": 187,
"name": "SWAP1"
},
{
"begin": 55,
"end": 187,
"name": "RETURN"
},
{
"begin": 55,
"end": 187,
"name": "tag",
"value": "5"
},
{
"begin": 55,
"end": 187,
"name": "JUMPDEST"
},
{
"begin": 126,
"end": 146,
"name": "PUSH",
"value": "0"
},
{
"begin": 169,
"end": 183,
"name": "DUP2"
},
{
"begin": 160,
"end": 166,
"name": "DUP4"
},
{
"begin": 160,
"end": 183,
"name": "MUL"
},
{
"begin": 153,
"end": 183,
"name": "SWAP1"
},
{
"begin": 153,
"end": 183,
"name": "POP"
},
{
"begin": 55,
"end": 187,
"name": "SWAP3"
},
{
"begin": 55,
"end": 187,
"name": "SWAP2"
},
{
"begin": 55,
"end": 187,
"name": "POP"
},
{
"begin": 55,
"end": 187,
"name": "POP"
},
{
"begin": 55,
"end": 187,
"name": "JUMP",
"value": "[out]"
}
]
}
}
},
"methodIdentifiers": {
"convert(uint256,uint256)": "96e4ee3d"
}
},
"metadata": "{\"compiler\":{\"version\":\"0.5.2+commit.1df8f40c\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"amount\",\"type\":\"uint256\"},{\"name\":\"conversionRate\",\"type\":\"uint256\"}],\"name\":\"convert\",\"outputs\":[{\"name\":\"convertedAmount\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"pure\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":\"ConvertLib\"},\"evmVersion\":\"byzantium\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol\":{\"keccak256\":\"0xd86a16a9c89d51eb0cb0033ab054f061ee0d174c5637a318c5b4648883ac0919\",\"urls\":[\"bzzr://9e0d3d40778d23ab0462e362620abf28a32f1f25209253b2c9603cd5a1e013a0\"]}},\"version\":1}",
"userdoc": {
"methods": {}
}
}
}
},
"sources": {
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol": {
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"exportedSymbols": {
"ConvertLib": [
16
]
},
"id": 17,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:0"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 16,
"linearizedBaseContracts": [
16
],
"name": "ConvertLib",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 14,
"nodeType": "Block",
"src": "149:38:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 12,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 10,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "160:6:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 11,
"name": "conversionRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "169:14:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "160:23:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 9,
"id": 13,
"nodeType": "Return",
"src": "153:30:0"
}
]
},
"documentation": null,
"id": 15,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "convert",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "72:11:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 2,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "72:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5,
"name": "conversionRate",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "84:19:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "84:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "71:33:0"
},
"returnParameters": {
"id": 9,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8,
"name": "convertedAmount",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "126:20:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "126:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "125:22:0"
},
"scope": 16,
"src": "55:132:0",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
}
],
"scope": 17,
"src": "34:155:0"
}
],
"src": "0:190:0"
},
"id": 0,
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"exportedSymbols": {
"ConvertLib": [
16
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 1,
"name": "PragmaDirective",
"src": "0:32:0"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
16
],
"name": "ConvertLib",
"scope": 17
},
"children": [
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "convert",
"scope": 16,
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "amount",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 2,
"name": "ElementaryTypeName",
"src": "72:4:0"
}
],
"id": 3,
"name": "VariableDeclaration",
"src": "72:11:0"
},
{
"attributes": {
"constant": false,
"name": "conversionRate",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 4,
"name": "ElementaryTypeName",
"src": "84:4:0"
}
],
"id": 5,
"name": "VariableDeclaration",
"src": "84:19:0"
}
],
"id": 6,
"name": "ParameterList",
"src": "71:33:0"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "convertedAmount",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 7,
"name": "ElementaryTypeName",
"src": "126:4:0"
}
],
"id": 8,
"name": "VariableDeclaration",
"src": "126:20:0"
}
],
"id": 9,
"name": "ParameterList",
"src": "125:22:0"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 9
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "*",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 3,
"type": "uint256",
"value": "amount"
},
"id": 10,
"name": "Identifier",
"src": "160:6:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5,
"type": "uint256",
"value": "conversionRate"
},
"id": 11,
"name": "Identifier",
"src": "169:14:0"
}
],
"id": 12,
"name": "BinaryOperation",
"src": "160:23:0"
}
],
"id": 13,
"name": "Return",
"src": "153:30:0"
}
],
"id": 14,
"name": "Block",
"src": "149:38:0"
}
],
"id": 15,
"name": "FunctionDefinition",
"src": "55:132:0"
}
],
"id": 16,
"name": "ContractDefinition",
"src": "34:155:0"
}
],
"id": 17,
"name": "SourceUnit",
"src": "0:190:0"
}
}
},
"compiler": {
"name": "solc",
"version": "0.5.2+commit.1df8f40c.Emscripten.clang"
}
}
{
"sourcePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"source": "pragma solidity >=0.4.22 <0.6.0;\n\nlibrary ConvertLib{\n\tfunction convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount)\n\t{\n\t\treturn amount * conversionRate;\n\t}\n}\n",
"sourceMap": "34:155:0:-;;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": "34:155:0:-;;;;;;;;;;;;;;;;;;;;;;;;;55:132;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;55:132:0;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;126:20;169:14;160:6;:23;153:30;;55:132;;;;:::o",
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"exportedSymbols": {
"ConvertLib": [
16
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 1,
"name": "PragmaDirective",
"src": "0:32:0"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
16
],
"name": "ConvertLib",
"scope": 17
},
"children": [
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "convert",
"scope": 16,
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "amount",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 2,
"name": "ElementaryTypeName",
"src": "72:4:0"
}
],
"id": 3,
"name": "VariableDeclaration",
"src": "72:11:0"
},
{
"attributes": {
"constant": false,
"name": "conversionRate",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 4,
"name": "ElementaryTypeName",
"src": "84:4:0"
}
],
"id": 5,
"name": "VariableDeclaration",
"src": "84:19:0"
}
],
"id": 6,
"name": "ParameterList",
"src": "71:33:0"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "convertedAmount",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 7,
"name": "ElementaryTypeName",
"src": "126:4:0"
}
],
"id": 8,
"name": "VariableDeclaration",
"src": "126:20:0"
}
],
"id": 9,
"name": "ParameterList",
"src": "125:22:0"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 9
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "*",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 3,
"type": "uint256",
"value": "amount"
},
"id": 10,
"name": "Identifier",
"src": "160:6:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5,
"type": "uint256",
"value": "conversionRate"
},
"id": 11,
"name": "Identifier",
"src": "169:14:0"
}
],
"id": 12,
"name": "BinaryOperation",
"src": "160:23:0"
}
],
"id": 13,
"name": "Return",
"src": "153:30:0"
}
],
"id": 14,
"name": "Block",
"src": "149:38:0"
}
],
"id": 15,
"name": "FunctionDefinition",
"src": "55:132:0"
}
],
"id": 16,
"name": "ContractDefinition",
"src": "34:155:0"
}
],
"id": 17,
"name": "SourceUnit",
"src": "0:190:0"
},
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"exportedSymbols": {
"ConvertLib": [
16
]
},
"id": 17,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:0"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 16,
"linearizedBaseContracts": [
16
],
"name": "ConvertLib",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 14,
"nodeType": "Block",
"src": "149:38:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 12,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 10,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "160:6:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 11,
"name": "conversionRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "169:14:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "160:23:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 9,
"id": 13,
"nodeType": "Return",
"src": "153:30:0"
}
]
},
"documentation": null,
"id": 15,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "convert",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "72:11:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 2,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "72:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5,
"name": "conversionRate",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "84:19:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "84:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "71:33:0"
},
"returnParameters": {
"id": 9,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8,
"name": "convertedAmount",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "126:20:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "126:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "125:22:0"
},
"scope": 16,
"src": "55:132:0",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
}
],
"scope": 17,
"src": "34:155:0"
}
],
"src": "0:190:0"
},
"abi": [
{
"constant": true,
"inputs": [
{
"name": "amount",
"type": "uint256"
},
{
"name": "conversionRate",
"type": "uint256"
}
],
"name": "convert",
"outputs": [
{
"name": "convertedAmount",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "pure",
"type": "function"
}
],
"bytecode": "0x60d761002f600b82828239805160001a6073146000811461001f57610021565bfe5b5030600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106050576000357c01000000000000000000000000000000000000000000000000000000009004806396e4ee3d146055575b600080fd5b608860048036036040811015606957600080fd5b810190808035906020019092919080359060200190929190505050609e565b6040518082815260200191505060405180910390f35b600081830290509291505056fea165627a7a7230582094ca199c801839337331343f733fa7283c9d7f430a20e7ec95933a083287a6d80029",
"deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106050576000357c01000000000000000000000000000000000000000000000000000000009004806396e4ee3d146055575b600080fd5b608860048036036040811015606957600080fd5b810190808035906020019092919080359060200190929190505050609e565b6040518082815260200191505060405180910390f35b600081830290509291505056fea165627a7a7230582094ca199c801839337331343f733fa7283c9d7f430a20e7ec95933a083287a6d80029",
"unlinked_binary": "0x60d761002f600b82828239805160001a6073146000811461001f57610021565bfe5b5030600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106050576000357c01000000000000000000000000000000000000000000000000000000009004806396e4ee3d146055575b600080fd5b608860048036036040811015606957600080fd5b810190808035906020019092919080359060200190929190505050609e565b6040518082815260200191505060405180910390f35b600081830290509291505056fea165627a7a7230582094ca199c801839337331343f733fa7283c9d7f430a20e7ec95933a083287a6d80029",
"compiler": {
"name": "solc",
"version": "0.5.2+commit.1df8f40c.Emscripten.clang"
},
"devdoc": {
"methods": {}
},
"userdoc": {
"methods": {}
},
"sourceList": [
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/Migrations.sol"
],
"sources": {
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol": {
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"exportedSymbols": {
"ConvertLib": [
16
]
},
"id": 17,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:0"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 16,
"linearizedBaseContracts": [
16
],
"name": "ConvertLib",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 14,
"nodeType": "Block",
"src": "149:38:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 12,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 10,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "160:6:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 11,
"name": "conversionRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "169:14:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "160:23:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 9,
"id": 13,
"nodeType": "Return",
"src": "153:30:0"
}
]
},
"documentation": null,
"id": 15,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "convert",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "72:11:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 2,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "72:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5,
"name": "conversionRate",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "84:19:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "84:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "71:33:0"
},
"returnParameters": {
"id": 9,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8,
"name": "convertedAmount",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "126:20:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "126:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "125:22:0"
},
"scope": 16,
"src": "55:132:0",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
}
],
"scope": 17,
"src": "34:155:0"
}
],
"src": "0:190:0"
},
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"exportedSymbols": {
"ConvertLib": [
16
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 1,
"name": "PragmaDirective",
"src": "0:32:0"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
16
],
"name": "ConvertLib",
"scope": 17
},
"children": [
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "convert",
"scope": 16,
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "amount",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 2,
"name": "ElementaryTypeName",
"src": "72:4:0"
}
],
"id": 3,
"name": "VariableDeclaration",
"src": "72:11:0"
},
{
"attributes": {
"constant": false,
"name": "conversionRate",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 4,
"name": "ElementaryTypeName",
"src": "84:4:0"
}
],
"id": 5,
"name": "VariableDeclaration",
"src": "84:19:0"
}
],
"id": 6,
"name": "ParameterList",
"src": "71:33:0"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "convertedAmount",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 7,
"name": "ElementaryTypeName",
"src": "126:4:0"
}
],
"id": 8,
"name": "VariableDeclaration",
"src": "126:20:0"
}
],
"id": 9,
"name": "ParameterList",
"src": "125:22:0"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 9
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "*",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 3,
"type": "uint256",
"value": "amount"
},
"id": 10,
"name": "Identifier",
"src": "160:6:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5,
"type": "uint256",
"value": "conversionRate"
},
"id": 11,
"name": "Identifier",
"src": "169:14:0"
}
],
"id": 12,
"name": "BinaryOperation",
"src": "160:23:0"
}
],
"id": 13,
"name": "Return",
"src": "153:30:0"
}
],
"id": 14,
"name": "Block",
"src": "149:38:0"
}
],
"id": 15,
"name": "FunctionDefinition",
"src": "55:132:0"
}
],
"id": 16,
"name": "ContractDefinition",
"src": "34:155:0"
}
],
"id": 17,
"name": "SourceUnit",
"src": "0:190:0"
},
"source": "pragma solidity >=0.4.22 <0.6.0;\n\nlibrary ConvertLib{\n\tfunction convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount)\n\t{\n\t\treturn amount * conversionRate;\n\t}\n}\n"
},
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol": {
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"exportedSymbols": {
"MetaCoin1": [
112
]
},
"id": 113,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 18,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:1"
},
{
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"file": "./ConvertLib.sol",
"id": 19,
"nodeType": "ImportDirective",
"scope": 113,
"sourceUnit": 17,
"src": "34:26:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 112,
"linearizedBaseContracts": [
112
],
"name": "MetaCoin1",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 23,
"name": "balances",
"nodeType": "VariableDeclaration",
"scope": 112,
"src": "346:34:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"typeName": {
"id": 22,
"keyType": {
"id": 20,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "355:7:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "346:25:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueType": {
"id": 21,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "366:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"value": null,
"visibility": "internal"
},
{
"anonymous": false,
"documentation": null,
"id": 31,
"name": "Transfer",
"nodeType": "EventDefinition",
"parameters": {
"id": 30,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25,
"indexed": true,
"name": "_from",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "399:21:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "399:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27,
"indexed": true,
"name": "_to",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "422:19:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 26,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "422:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 29,
"indexed": false,
"name": "_value",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "443:14:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 28,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "443:7:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "398:60:1"
},
"src": "384:75:1"
},
{
"body": {
"id": 41,
"nodeType": "Block",
"src": "483:35:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 39,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 34,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "487:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 37,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 35,
"name": "tx",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 196,
"src": "496:2:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_transaction",
"typeString": "tx"
}
},
"id": 36,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "origin",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "496:9:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "487:19:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "3130303030",
"id": 38,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "509:5:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_10000_by_1",
"typeString": "int_const 10000"
},
"value": "10000"
},
"src": "487:27:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 40,
"nodeType": "ExpressionStatement",
"src": "487:27:1"
}
]
},
"documentation": null,
"id": 42,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 32,
"nodeType": "ParameterList",
"parameters": [],
"src": "473:2:1"
},
"returnParameters": {
"id": 33,
"nodeType": "ParameterList",
"parameters": [],
"src": "483:0:1"
},
"scope": 112,
"src": "462:56:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 82,
"nodeType": "Block",
"src": "602:183:1",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 56,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 51,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "610:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 54,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 52,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "619:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 53,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "619:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "610:20:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 55,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "633:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "610:29:1",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 59,
"nodeType": "IfStatement",
"src": "606:47:1",
"trueBody": {
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 57,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "648:5:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 50,
"id": 58,
"nodeType": "Return",
"src": "641:12:1"
}
},
{
"expression": {
"argumentTypes": null,
"id": 65,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 60,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "657:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 63,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 61,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "666:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 62,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "666:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "657:20:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "-=",
"rightHandSide": {
"argumentTypes": null,
"id": 64,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "681:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "657:30:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 66,
"nodeType": "ExpressionStatement",
"src": "657:30:1"
},
{
"expression": {
"argumentTypes": null,
"id": 71,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 67,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "691:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 69,
"indexExpression": {
"argumentTypes": null,
"id": 68,
"name": "receiver",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44,
"src": "700:8:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "691:18:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "+=",
"rightHandSide": {
"argumentTypes": null,
"id": 70,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "713:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "691:28:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 72,
"nodeType": "ExpressionStatement",
"src": "691:28:1"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 74,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "737:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 75,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "737:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 76,
"name": "receiver",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44,
"src": "749:8:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 77,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "759:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 73,
"name": "Transfer",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 31,
"src": "728:8:1",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (address,address,uint256)"
}
},
"id": 78,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "728:38:1",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 79,
"nodeType": "EmitStatement",
"src": "723:43:1"
},
{
"expression": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 80,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "777:4:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"functionReturnParameters": 50,
"id": 81,
"nodeType": "Return",
"src": "770:11:1"
}
]
},
"documentation": null,
"id": 83,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sendCoin",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 47,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 44,
"name": "receiver",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "539:16:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 43,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "539:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 46,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "557:11:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "557:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "538:31:1"
},
"returnParameters": {
"id": 50,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 49,
"name": "sufficient",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "585:15:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 48,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "585:4:1",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "584:17:1"
},
"scope": 112,
"src": "521:264:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 98,
"nodeType": "Block",
"src": "852:53:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 93,
"name": "addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 85,
"src": "893:4:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 92,
"name": "getBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 111,
"src": "882:10:1",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view returns (uint256)"
}
},
"id": 94,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "882:16:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"hexValue": "32",
"id": 95,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "899:1:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
}
],
"expression": {
"argumentTypes": null,
"id": 90,
"name": "ConvertLib",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16,
"src": "863:10:1",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ConvertLib_$16_$",
"typeString": "type(library ConvertLib)"
}
},
"id": 91,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "convert",
"nodeType": "MemberAccess",
"referencedDeclaration": 15,
"src": "863:18:1",
"typeDescriptions": {
"typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 96,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "863:38:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 89,
"id": 97,
"nodeType": "Return",
"src": "856:45:1"
}
]
},
"documentation": null,
"id": 99,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getBalanceInEth",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 86,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 85,
"name": "addr",
"nodeType": "VariableDeclaration",
"scope": 99,
"src": "813:12:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 84,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "813:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "812:14:1"
},
"returnParameters": {
"id": 89,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 88,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 99,
"src": "847:4:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 87,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "847:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "846:6:1"
},
"scope": 112,
"src": "788:117:1",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 110,
"nodeType": "Block",
"src": "968:29:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 106,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "979:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 108,
"indexExpression": {
"argumentTypes": null,
"id": 107,
"name": "addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 101,
"src": "988:4:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "979:14:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 105,
"id": 109,
"nodeType": "Return",
"src": "972:21:1"
}
]
},
"documentation": null,
"id": 111,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getBalance",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 102,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 101,
"name": "addr",
"nodeType": "VariableDeclaration",
"scope": 111,
"src": "928:12:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 100,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "928:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "927:14:1"
},
"returnParameters": {
"id": 105,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 104,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 111,
"src": "962:4:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 103,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "962:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "961:6:1"
},
"scope": 112,
"src": "908:89:1",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
}
],
"scope": 113,
"src": "324:675:1"
}
],
"src": "0:1000:1"
},
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"exportedSymbols": {
"MetaCoin1": [
112
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 18,
"name": "PragmaDirective",
"src": "0:32:1"
},
{
"attributes": {
"SourceUnit": 17,
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"file": "./ConvertLib.sol",
"scope": 113,
"symbolAliases": [
null
],
"unitAlias": ""
},
"id": 19,
"name": "ImportDirective",
"src": "34:26:1"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
112
],
"name": "MetaCoin1",
"scope": 113
},
"children": [
{
"attributes": {
"constant": false,
"name": "balances",
"scope": 112,
"stateVariable": true,
"storageLocation": "default",
"type": "mapping(address => uint256)",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"type": "mapping(address => uint256)"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 20,
"name": "ElementaryTypeName",
"src": "355:7:1"
},
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 21,
"name": "ElementaryTypeName",
"src": "366:4:1"
}
],
"id": 22,
"name": "Mapping",
"src": "346:25:1"
}
],
"id": 23,
"name": "VariableDeclaration",
"src": "346:34:1"
},
{
"attributes": {
"anonymous": false,
"documentation": null,
"name": "Transfer"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"indexed": true,
"name": "_from",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 24,
"name": "ElementaryTypeName",
"src": "399:7:1"
}
],
"id": 25,
"name": "VariableDeclaration",
"src": "399:21:1"
},
{
"attributes": {
"constant": false,
"indexed": true,
"name": "_to",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 26,
"name": "ElementaryTypeName",
"src": "422:7:1"
}
],
"id": 27,
"name": "VariableDeclaration",
"src": "422:19:1"
},
{
"attributes": {
"constant": false,
"indexed": false,
"name": "_value",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 28,
"name": "ElementaryTypeName",
"src": "443:7:1"
}
],
"id": 29,
"name": "VariableDeclaration",
"src": "443:14:1"
}
],
"id": 30,
"name": "ParameterList",
"src": "398:60:1"
}
],
"id": 31,
"name": "EventDefinition",
"src": "384:75:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": true,
"kind": "constructor",
"modifiers": [
null
],
"name": "",
"scope": 112,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 32,
"name": "ParameterList",
"src": "473:2:1"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 33,
"name": "ParameterList",
"src": "483:0:1"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 34,
"name": "Identifier",
"src": "487:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "origin",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 196,
"type": "tx",
"value": "tx"
},
"id": 35,
"name": "Identifier",
"src": "496:2:1"
}
],
"id": 36,
"name": "MemberAccess",
"src": "496:9:1"
}
],
"id": 37,
"name": "IndexAccess",
"src": "487:19:1"
},
{
"attributes": {
"argumentTypes": null,
"hexvalue": "3130303030",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "number",
"type": "int_const 10000",
"value": "10000"
},
"id": 38,
"name": "Literal",
"src": "509:5:1"
}
],
"id": 39,
"name": "Assignment",
"src": "487:27:1"
}
],
"id": 40,
"name": "ExpressionStatement",
"src": "487:27:1"
}
],
"id": 41,
"name": "Block",
"src": "483:35:1"
}
],
"id": 42,
"name": "FunctionDefinition",
"src": "462:56:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "sendCoin",
"scope": 112,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "receiver",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 43,
"name": "ElementaryTypeName",
"src": "539:7:1"
}
],
"id": 44,
"name": "VariableDeclaration",
"src": "539:16:1"
},
{
"attributes": {
"constant": false,
"name": "amount",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 45,
"name": "ElementaryTypeName",
"src": "557:4:1"
}
],
"id": 46,
"name": "VariableDeclaration",
"src": "557:11:1"
}
],
"id": 47,
"name": "ParameterList",
"src": "538:31:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "sufficient",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "bool",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "bool",
"type": "bool"
},
"id": 48,
"name": "ElementaryTypeName",
"src": "585:4:1"
}
],
"id": 49,
"name": "VariableDeclaration",
"src": "585:15:1"
}
],
"id": 50,
"name": "ParameterList",
"src": "584:17:1"
},
{
"children": [
{
"attributes": {
"falseBody": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "<",
"type": "bool"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 51,
"name": "Identifier",
"src": "610:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 52,
"name": "Identifier",
"src": "619:3:1"
}
],
"id": 53,
"name": "MemberAccess",
"src": "619:10:1"
}
],
"id": 54,
"name": "IndexAccess",
"src": "610:20:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 55,
"name": "Identifier",
"src": "633:6:1"
}
],
"id": 56,
"name": "BinaryOperation",
"src": "610:29:1"
},
{
"attributes": {
"functionReturnParameters": 50
},
"children": [
{
"attributes": {
"argumentTypes": null,
"hexvalue": "66616c7365",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "bool",
"type": "bool",
"value": "false"
},
"id": 57,
"name": "Literal",
"src": "648:5:1"
}
],
"id": 58,
"name": "Return",
"src": "641:12:1"
}
],
"id": 59,
"name": "IfStatement",
"src": "606:47:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "-=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 60,
"name": "Identifier",
"src": "657:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 61,
"name": "Identifier",
"src": "666:3:1"
}
],
"id": 62,
"name": "MemberAccess",
"src": "666:10:1"
}
],
"id": 63,
"name": "IndexAccess",
"src": "657:20:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 64,
"name": "Identifier",
"src": "681:6:1"
}
],
"id": 65,
"name": "Assignment",
"src": "657:30:1"
}
],
"id": 66,
"name": "ExpressionStatement",
"src": "657:30:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "+=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 67,
"name": "Identifier",
"src": "691:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 44,
"type": "address",
"value": "receiver"
},
"id": 68,
"name": "Identifier",
"src": "700:8:1"
}
],
"id": 69,
"name": "IndexAccess",
"src": "691:18:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 70,
"name": "Identifier",
"src": "713:6:1"
}
],
"id": 71,
"name": "Assignment",
"src": "691:28:1"
}
],
"id": 72,
"name": "ExpressionStatement",
"src": "691:28:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 31,
"type": "function (address,address,uint256)",
"value": "Transfer"
},
"id": 73,
"name": "Identifier",
"src": "728:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 74,
"name": "Identifier",
"src": "737:3:1"
}
],
"id": 75,
"name": "MemberAccess",
"src": "737:10:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 44,
"type": "address",
"value": "receiver"
},
"id": 76,
"name": "Identifier",
"src": "749:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 77,
"name": "Identifier",
"src": "759:6:1"
}
],
"id": 78,
"name": "FunctionCall",
"src": "728:38:1"
}
],
"id": 79,
"name": "EmitStatement",
"src": "723:43:1"
},
{
"attributes": {
"functionReturnParameters": 50
},
"children": [
{
"attributes": {
"argumentTypes": null,
"hexvalue": "74727565",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "bool",
"type": "bool",
"value": "true"
},
"id": 80,
"name": "Literal",
"src": "777:4:1"
}
],
"id": 81,
"name": "Return",
"src": "770:11:1"
}
],
"id": 82,
"name": "Block",
"src": "602:183:1"
}
],
"id": 83,
"name": "FunctionDefinition",
"src": "521:264:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "getBalanceInEth",
"scope": 112,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "addr",
"scope": 99,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 84,
"name": "ElementaryTypeName",
"src": "813:7:1"
}
],
"id": 85,
"name": "VariableDeclaration",
"src": "813:12:1"
}
],
"id": 86,
"name": "ParameterList",
"src": "812:14:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 99,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 87,
"name": "ElementaryTypeName",
"src": "847:4:1"
}
],
"id": 88,
"name": "VariableDeclaration",
"src": "847:4:1"
}
],
"id": 89,
"name": "ParameterList",
"src": "846:6:1"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 89
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "uint256",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
}
],
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "convert",
"referencedDeclaration": 15,
"type": "function (uint256,uint256) pure returns (uint256)"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 16,
"type": "type(library ConvertLib)",
"value": "ConvertLib"
},
"id": 90,
"name": "Identifier",
"src": "863:10:1"
}
],
"id": 91,
"name": "MemberAccess",
"src": "863:18:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "uint256",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 111,
"type": "function (address) view returns (uint256)",
"value": "getBalance"
},
"id": 92,
"name": "Identifier",
"src": "882:10:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 85,
"type": "address",
"value": "addr"
},
"id": 93,
"name": "Identifier",
"src": "893:4:1"
}
],
"id": 94,
"name": "FunctionCall",
"src": "882:16:1"
},
{
"attributes": {
"argumentTypes": null,
"hexvalue": "32",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "number",
"type": "int_const 2",
"value": "2"
},
"id": 95,
"name": "Literal",
"src": "899:1:1"
}
],
"id": 96,
"name": "FunctionCall",
"src": "863:38:1"
}
],
"id": 97,
"name": "Return",
"src": "856:45:1"
}
],
"id": 98,
"name": "Block",
"src": "852:53:1"
}
],
"id": 99,
"name": "FunctionDefinition",
"src": "788:117:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "getBalance",
"scope": 112,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "addr",
"scope": 111,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 100,
"name": "ElementaryTypeName",
"src": "928:7:1"
}
],
"id": 101,
"name": "VariableDeclaration",
"src": "928:12:1"
}
],
"id": 102,
"name": "ParameterList",
"src": "927:14:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 111,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 103,
"name": "ElementaryTypeName",
"src": "962:4:1"
}
],
"id": 104,
"name": "VariableDeclaration",
"src": "962:4:1"
}
],
"id": 105,
"name": "ParameterList",
"src": "961:6:1"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 105
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 106,
"name": "Identifier",
"src": "979:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 101,
"type": "address",
"value": "addr"
},
"id": 107,
"name": "Identifier",
"src": "988:4:1"
}
],
"id": 108,
"name": "IndexAccess",
"src": "979:14:1"
}
],
"id": 109,
"name": "Return",
"src": "972:21:1"
}
],
"id": 110,
"name": "Block",
"src": "968:29:1"
}
],
"id": 111,
"name": "FunctionDefinition",
"src": "908:89:1"
}
],
"id": 112,
"name": "ContractDefinition",
"src": "324:675:1"
}
],
"id": 113,
"name": "SourceUnit",
"src": "0:1000:1"
},
"source": "pragma solidity >=0.4.22 <0.6.0;\n\nimport \"./ConvertLib.sol\";\n\n// This is just a simple example of a coin-like contract.\n// It is not standards compatible and cannot be expected to talk to other\n// coin/token contracts. If you want to create a standards-compliant\n// token, see: https://github.com/ConsenSys/Tokens. Cheers!\n\ncontract MetaCoin1 {\n\tmapping (address => uint) balances;\n\n\tevent Transfer(address indexed _from, address indexed _to, uint256 _value);\n\n\tconstructor() public {\n\t\tbalances[tx.origin] = 10000;\n\t}\n\n\tfunction sendCoin(address receiver, uint amount) public returns(bool sufficient) {\n\t\tif (balances[msg.sender] < amount) return false;\n\t\tbalances[msg.sender] -= amount;\n\t\tbalances[receiver] += amount;\n\t\temit Transfer(msg.sender, receiver, amount);\n\t\treturn true;\n\t}\n\n\tfunction getBalanceInEth(address addr) public view returns(uint){\n\t\treturn ConvertLib.convert(getBalance(addr),2);\n\t}\n\n\tfunction getBalance(address addr) public view returns(uint) {\n\t\treturn balances[addr];\n\t}\n}\n"
},
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/Migrations.sol": {
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
169
]
},
"id": 170,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 114,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:2"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 169,
"linearizedBaseContracts": [
169
],
"name": "Migrations",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 116,
"name": "owner",
"nodeType": "VariableDeclaration",
"scope": 169,
"src": "58:20:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 115,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "58:7:2",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 118,
"name": "last_completed_migration",
"nodeType": "VariableDeclaration",
"scope": 169,
"src": "82:39:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 117,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "82:7:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 126,
"nodeType": "Block",
"src": "148:37:2",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 123,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 120,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "158:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 121,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "158:10:2",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 122,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 116,
"src": "172:5:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "158:19:2",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 125,
"nodeType": "IfStatement",
"src": "154:26:2",
"trueBody": {
"id": 124,
"nodeType": "PlaceholderStatement",
"src": "179:1:2"
}
}
]
},
"documentation": null,
"id": 127,
"name": "restricted",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 119,
"nodeType": "ParameterList",
"parameters": [],
"src": "145:2:2"
},
"src": "126:59:2",
"visibility": "internal"
},
{
"body": {
"id": 135,
"nodeType": "Block",
"src": "210:29:2",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 133,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 130,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 116,
"src": "216:5:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 131,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "224:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 132,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "224:10:2",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "216:18:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 134,
"nodeType": "ExpressionStatement",
"src": "216:18:2"
}
]
},
"documentation": null,
"id": 136,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 128,
"nodeType": "ParameterList",
"parameters": [],
"src": "200:2:2"
},
"returnParameters": {
"id": 129,
"nodeType": "ParameterList",
"parameters": [],
"src": "210:0:2"
},
"scope": 169,
"src": "189:50:2",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 147,
"nodeType": "Block",
"src": "299:47:2",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 145,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 143,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 118,
"src": "305:24:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 144,
"name": "completed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 138,
"src": "332:9:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "305:36:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 146,
"nodeType": "ExpressionStatement",
"src": "305:36:2"
}
]
},
"documentation": null,
"id": 148,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 141,
"modifierName": {
"argumentTypes": null,
"id": 140,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 127,
"src": "288:10:2",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "288:10:2"
}
],
"name": "setCompleted",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 139,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 138,
"name": "completed",
"nodeType": "VariableDeclaration",
"scope": 148,
"src": "265:14:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 137,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "265:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "264:16:2"
},
"returnParameters": {
"id": 142,
"nodeType": "ParameterList",
"parameters": [],
"src": "299:0:2"
},
"scope": 169,
"src": "243:103:2",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 167,
"nodeType": "Block",
"src": "406:109:2",
"statements": [
{
"assignments": [
156
],
"declarations": [
{
"constant": false,
"id": 156,
"name": "upgraded",
"nodeType": "VariableDeclaration",
"scope": 167,
"src": "412:19:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$169",
"typeString": "contract Migrations"
},
"typeName": {
"contractScope": null,
"id": 155,
"name": "Migrations",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 169,
"src": "412:10:2",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$169",
"typeString": "contract Migrations"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 160,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 158,
"name": "new_address",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 150,
"src": "445:11:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 157,
"name": "Migrations",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 169,
"src": "434:10:2",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Migrations_$169_$",
"typeString": "type(contract Migrations)"
}
},
"id": 159,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "434:23:2",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$169",
"typeString": "contract Migrations"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "412:45:2"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 164,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 118,
"src": "485:24:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 161,
"name": "upgraded",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 156,
"src": "463:8:2",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$169",
"typeString": "contract Migrations"
}
},
"id": 163,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "setCompleted",
"nodeType": "MemberAccess",
"referencedDeclaration": 148,
"src": "463:21:2",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 165,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "463:47:2",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 166,
"nodeType": "ExpressionStatement",
"src": "463:47:2"
}
]
},
"documentation": null,
"id": 168,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 153,
"modifierName": {
"argumentTypes": null,
"id": 152,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 127,
"src": "395:10:2",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "395:10:2"
}
],
"name": "upgrade",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 151,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 150,
"name": "new_address",
"nodeType": "VariableDeclaration",
"scope": 168,
"src": "367:19:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 149,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "367:7:2",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "366:21:2"
},
"returnParameters": {
"id": 154,
"nodeType": "ParameterList",
"parameters": [],
"src": "406:0:2"
},
"scope": 169,
"src": "350:165:2",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 170,
"src": "34:483:2"
}
],
"src": "0:518:2"
},
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
169
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 114,
"name": "PragmaDirective",
"src": "0:32:2"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
169
],
"name": "Migrations",
"scope": 170
},
"children": [
{
"attributes": {
"constant": false,
"name": "owner",
"scope": 169,
"stateVariable": true,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 115,
"name": "ElementaryTypeName",
"src": "58:7:2"
}
],
"id": 116,
"name": "VariableDeclaration",
"src": "58:20:2"
},
{
"attributes": {
"constant": false,
"name": "last_completed_migration",
"scope": 169,
"stateVariable": true,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 117,
"name": "ElementaryTypeName",
"src": "82:7:2"
}
],
"id": 118,
"name": "VariableDeclaration",
"src": "82:39:2"
},
{
"attributes": {
"documentation": null,
"name": "restricted",
"visibility": "internal"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 119,
"name": "ParameterList",
"src": "145:2:2"
},
{
"children": [
{
"attributes": {
"falseBody": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "==",
"type": "bool"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 120,
"name": "Identifier",
"src": "158:3:2"
}
],
"id": 121,
"name": "MemberAccess",
"src": "158:10:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 116,
"type": "address",
"value": "owner"
},
"id": 122,
"name": "Identifier",
"src": "172:5:2"
}
],
"id": 123,
"name": "BinaryOperation",
"src": "158:19:2"
},
{
"id": 124,
"name": "PlaceholderStatement",
"src": "179:1:2"
}
],
"id": 125,
"name": "IfStatement",
"src": "154:26:2"
}
],
"id": 126,
"name": "Block",
"src": "148:37:2"
}
],
"id": 127,
"name": "ModifierDefinition",
"src": "126:59:2"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": true,
"kind": "constructor",
"modifiers": [
null
],
"name": "",
"scope": 169,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 128,
"name": "ParameterList",
"src": "200:2:2"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 129,
"name": "ParameterList",
"src": "210:0:2"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 116,
"type": "address",
"value": "owner"
},
"id": 130,
"name": "Identifier",
"src": "216:5:2"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 131,
"name": "Identifier",
"src": "224:3:2"
}
],
"id": 132,
"name": "MemberAccess",
"src": "224:10:2"
}
],
"id": 133,
"name": "Assignment",
"src": "216:18:2"
}
],
"id": 134,
"name": "ExpressionStatement",
"src": "216:18:2"
}
],
"id": 135,
"name": "Block",
"src": "210:29:2"
}
],
"id": 136,
"name": "FunctionDefinition",
"src": "189:50:2"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"name": "setCompleted",
"scope": 169,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "completed",
"scope": 148,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 137,
"name": "ElementaryTypeName",
"src": "265:4:2"
}
],
"id": 138,
"name": "VariableDeclaration",
"src": "265:14:2"
}
],
"id": 139,
"name": "ParameterList",
"src": "264:16:2"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 142,
"name": "ParameterList",
"src": "299:0:2"
},
{
"attributes": {
"arguments": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 127,
"type": "modifier ()",
"value": "restricted"
},
"id": 140,
"name": "Identifier",
"src": "288:10:2"
}
],
"id": 141,
"name": "ModifierInvocation",
"src": "288:10:2"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 118,
"type": "uint256",
"value": "last_completed_migration"
},
"id": 143,
"name": "Identifier",
"src": "305:24:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 138,
"type": "uint256",
"value": "completed"
},
"id": 144,
"name": "Identifier",
"src": "332:9:2"
}
],
"id": 145,
"name": "Assignment",
"src": "305:36:2"
}
],
"id": 146,
"name": "ExpressionStatement",
"src": "305:36:2"
}
],
"id": 147,
"name": "Block",
"src": "299:47:2"
}
],
"id": 148,
"name": "FunctionDefinition",
"src": "243:103:2"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"name": "upgrade",
"scope": 169,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "new_address",
"scope": 168,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 149,
"name": "ElementaryTypeName",
"src": "367:7:2"
}
],
"id": 150,
"name": "VariableDeclaration",
"src": "367:19:2"
}
],
"id": 151,
"name": "ParameterList",
"src": "366:21:2"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 154,
"name": "ParameterList",
"src": "406:0:2"
},
{
"attributes": {
"arguments": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 127,
"type": "modifier ()",
"value": "restricted"
},
"id": 152,
"name": "Identifier",
"src": "395:10:2"
}
],
"id": 153,
"name": "ModifierInvocation",
"src": "395:10:2"
},
{
"children": [
{
"attributes": {
"assignments": [
156
]
},
"children": [
{
"attributes": {
"constant": false,
"name": "upgraded",
"scope": 167,
"stateVariable": false,
"storageLocation": "default",
"type": "contract Migrations",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"contractScope": null,
"name": "Migrations",
"referencedDeclaration": 169,
"type": "contract Migrations"
},
"id": 155,
"name": "UserDefinedTypeName",
"src": "412:10:2"
}
],
"id": 156,
"name": "VariableDeclaration",
"src": "412:19:2"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "contract Migrations",
"type_conversion": true
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 169,
"type": "type(contract Migrations)",
"value": "Migrations"
},
"id": 157,
"name": "Identifier",
"src": "434:10:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 150,
"type": "address",
"value": "new_address"
},
"id": 158,
"name": "Identifier",
"src": "445:11:2"
}
],
"id": 159,
"name": "FunctionCall",
"src": "434:23:2"
}
],
"id": 160,
"name": "VariableDeclarationStatement",
"src": "412:45:2"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "setCompleted",
"referencedDeclaration": 148,
"type": "function (uint256) external"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 156,
"type": "contract Migrations",
"value": "upgraded"
},
"id": 161,
"name": "Identifier",
"src": "463:8:2"
}
],
"id": 163,
"name": "MemberAccess",
"src": "463:21:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 118,
"type": "uint256",
"value": "last_completed_migration"
},
"id": 164,
"name": "Identifier",
"src": "485:24:2"
}
],
"id": 165,
"name": "FunctionCall",
"src": "463:47:2"
}
],
"id": 166,
"name": "ExpressionStatement",
"src": "463:47:2"
}
],
"id": 167,
"name": "Block",
"src": "406:109:2"
}
],
"id": 168,
"name": "FunctionDefinition",
"src": "350:165:2"
}
],
"id": 169,
"name": "ContractDefinition",
"src": "34:483:2"
}
],
"id": 170,
"name": "SourceUnit",
"src": "0:518:2"
},
"source": "pragma solidity >=0.4.22 <0.6.0;\n\ncontract Migrations {\n address public owner;\n uint256 public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n"
}
},
"contractName": "ConvertLib",
"updatedAt": "2019-02-24T19:03:04.917Z"
}
pragma solidity >=0.4.22 <0.6.0;
library ConvertLib{
function convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount)
{
return amount * conversionRate;
}
}
pragma solidity >=0.4.22 <0.6.0;
import "./ConvertLib.sol";
// This is just a simple example of a coin-like contract.
// It is not standards compatible and cannot be expected to talk to other
// coin/token contracts. If you want to create a standards-compliant
// token, see: https://github.com/ConsenSys/Tokens. Cheers!
contract MetaCoin1 {
mapping (address => uint) balances;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
constructor() public {
balances[tx.origin] = 10000;
}
function sendCoin(address receiver, uint amount) public returns(bool sufficient) {
if (balances[msg.sender] < amount) return false;
balances[msg.sender] -= amount;
balances[receiver] += amount;
emit Transfer(msg.sender, receiver, amount);
return true;
}
function getBalanceInEth(address addr) public view returns(uint){
return ConvertLib.convert(getBalance(addr),2);
}
function getBalance(address addr) public view returns(uint) {
return balances[addr];
}
}
{
"sourcePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"source": "pragma solidity >=0.4.22 <0.6.0;\n\nimport \"./ConvertLib.sol\";\n\n// This is just a simple example of a coin-like contract.\n// It is not standards compatible and cannot be expected to talk to other\n// coin/token contracts. If you want to create a standards-compliant\n// token, see: https://github.com/ConsenSys/Tokens. Cheers!\n\ncontract MetaCoin1 {\n\tmapping (address => uint) balances;\n\n\tevent Transfer(address indexed _from, address indexed _to, uint256 _value);\n\n\tconstructor() public {\n\t\tbalances[tx.origin] = 10000;\n\t}\n\n\tfunction sendCoin(address receiver, uint amount) public returns(bool sufficient) {\n\t\tif (balances[msg.sender] < amount) return false;\n\t\tbalances[msg.sender] -= amount;\n\t\tbalances[receiver] += amount;\n\t\temit Transfer(msg.sender, receiver, amount);\n\t\treturn true;\n\t}\n\n\tfunction getBalanceInEth(address addr) public view returns(uint){\n\t\treturn ConvertLib.convert(getBalance(addr),2);\n\t}\n\n\tfunction getBalance(address addr) public view returns(uint) {\n\t\treturn balances[addr];\n\t}\n}\n",
"sourceMap": "324:675:1:-;;;462:56;8:9:-1;5:2;;;30:1;27;20:12;5:2;462:56:1;509:5;487:8;:19;496:9;487:19;;;;;;;;;;;;;;;:27;;;;324:675;;;;;;",
"deployedSourceMap": "324:675:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;324:675:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;788:117;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;788:117:1;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;521:264;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;521:264:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;908:89;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;908:89:1;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;788:117;847:4;863:10;:18;882:16;893:4;882:10;:16::i;:::-;899:1;863:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;863:38:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;863:38:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;863:38:1;;;;;;;;;;;;;;;;856:45;;788:117;;;:::o;521:264::-;585:15;633:6;610:8;:20;619:10;610:20;;;;;;;;;;;;;;;;:29;606:47;;;648:5;641:12;;;;606:47;681:6;657:8;:20;666:10;657:20;;;;;;;;;;;;;;;;:30;;;;;;;;;;;713:6;691:8;:18;700:8;691:18;;;;;;;;;;;;;;;;:28;;;;;;;;;;;749:8;728:38;;737:10;728:38;;;759:6;728:38;;;;;;;;;;;;;;;;;;777:4;770:11;;521:264;;;;;:::o;908:89::-;962:4;979:8;:14;988:4;979:14;;;;;;;;;;;;;;;;972:21;;908:89;;;:::o",
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"exportedSymbols": {
"MetaCoin1": [
112
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 18,
"name": "PragmaDirective",
"src": "0:32:1"
},
{
"attributes": {
"SourceUnit": 17,
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"file": "./ConvertLib.sol",
"scope": 113,
"symbolAliases": [
null
],
"unitAlias": ""
},
"id": 19,
"name": "ImportDirective",
"src": "34:26:1"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
112
],
"name": "MetaCoin1",
"scope": 113
},
"children": [
{
"attributes": {
"constant": false,
"name": "balances",
"scope": 112,
"stateVariable": true,
"storageLocation": "default",
"type": "mapping(address => uint256)",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"type": "mapping(address => uint256)"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 20,
"name": "ElementaryTypeName",
"src": "355:7:1"
},
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 21,
"name": "ElementaryTypeName",
"src": "366:4:1"
}
],
"id": 22,
"name": "Mapping",
"src": "346:25:1"
}
],
"id": 23,
"name": "VariableDeclaration",
"src": "346:34:1"
},
{
"attributes": {
"anonymous": false,
"documentation": null,
"name": "Transfer"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"indexed": true,
"name": "_from",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 24,
"name": "ElementaryTypeName",
"src": "399:7:1"
}
],
"id": 25,
"name": "VariableDeclaration",
"src": "399:21:1"
},
{
"attributes": {
"constant": false,
"indexed": true,
"name": "_to",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 26,
"name": "ElementaryTypeName",
"src": "422:7:1"
}
],
"id": 27,
"name": "VariableDeclaration",
"src": "422:19:1"
},
{
"attributes": {
"constant": false,
"indexed": false,
"name": "_value",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 28,
"name": "ElementaryTypeName",
"src": "443:7:1"
}
],
"id": 29,
"name": "VariableDeclaration",
"src": "443:14:1"
}
],
"id": 30,
"name": "ParameterList",
"src": "398:60:1"
}
],
"id": 31,
"name": "EventDefinition",
"src": "384:75:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": true,
"kind": "constructor",
"modifiers": [
null
],
"name": "",
"scope": 112,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 32,
"name": "ParameterList",
"src": "473:2:1"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 33,
"name": "ParameterList",
"src": "483:0:1"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 34,
"name": "Identifier",
"src": "487:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "origin",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 196,
"type": "tx",
"value": "tx"
},
"id": 35,
"name": "Identifier",
"src": "496:2:1"
}
],
"id": 36,
"name": "MemberAccess",
"src": "496:9:1"
}
],
"id": 37,
"name": "IndexAccess",
"src": "487:19:1"
},
{
"attributes": {
"argumentTypes": null,
"hexvalue": "3130303030",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "number",
"type": "int_const 10000",
"value": "10000"
},
"id": 38,
"name": "Literal",
"src": "509:5:1"
}
],
"id": 39,
"name": "Assignment",
"src": "487:27:1"
}
],
"id": 40,
"name": "ExpressionStatement",
"src": "487:27:1"
}
],
"id": 41,
"name": "Block",
"src": "483:35:1"
}
],
"id": 42,
"name": "FunctionDefinition",
"src": "462:56:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "sendCoin",
"scope": 112,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "receiver",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 43,
"name": "ElementaryTypeName",
"src": "539:7:1"
}
],
"id": 44,
"name": "VariableDeclaration",
"src": "539:16:1"
},
{
"attributes": {
"constant": false,
"name": "amount",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 45,
"name": "ElementaryTypeName",
"src": "557:4:1"
}
],
"id": 46,
"name": "VariableDeclaration",
"src": "557:11:1"
}
],
"id": 47,
"name": "ParameterList",
"src": "538:31:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "sufficient",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "bool",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "bool",
"type": "bool"
},
"id": 48,
"name": "ElementaryTypeName",
"src": "585:4:1"
}
],
"id": 49,
"name": "VariableDeclaration",
"src": "585:15:1"
}
],
"id": 50,
"name": "ParameterList",
"src": "584:17:1"
},
{
"children": [
{
"attributes": {
"falseBody": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "<",
"type": "bool"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 51,
"name": "Identifier",
"src": "610:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 52,
"name": "Identifier",
"src": "619:3:1"
}
],
"id": 53,
"name": "MemberAccess",
"src": "619:10:1"
}
],
"id": 54,
"name": "IndexAccess",
"src": "610:20:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 55,
"name": "Identifier",
"src": "633:6:1"
}
],
"id": 56,
"name": "BinaryOperation",
"src": "610:29:1"
},
{
"attributes": {
"functionReturnParameters": 50
},
"children": [
{
"attributes": {
"argumentTypes": null,
"hexvalue": "66616c7365",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "bool",
"type": "bool",
"value": "false"
},
"id": 57,
"name": "Literal",
"src": "648:5:1"
}
],
"id": 58,
"name": "Return",
"src": "641:12:1"
}
],
"id": 59,
"name": "IfStatement",
"src": "606:47:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "-=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 60,
"name": "Identifier",
"src": "657:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 61,
"name": "Identifier",
"src": "666:3:1"
}
],
"id": 62,
"name": "MemberAccess",
"src": "666:10:1"
}
],
"id": 63,
"name": "IndexAccess",
"src": "657:20:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 64,
"name": "Identifier",
"src": "681:6:1"
}
],
"id": 65,
"name": "Assignment",
"src": "657:30:1"
}
],
"id": 66,
"name": "ExpressionStatement",
"src": "657:30:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "+=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 67,
"name": "Identifier",
"src": "691:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 44,
"type": "address",
"value": "receiver"
},
"id": 68,
"name": "Identifier",
"src": "700:8:1"
}
],
"id": 69,
"name": "IndexAccess",
"src": "691:18:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 70,
"name": "Identifier",
"src": "713:6:1"
}
],
"id": 71,
"name": "Assignment",
"src": "691:28:1"
}
],
"id": 72,
"name": "ExpressionStatement",
"src": "691:28:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 31,
"type": "function (address,address,uint256)",
"value": "Transfer"
},
"id": 73,
"name": "Identifier",
"src": "728:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 74,
"name": "Identifier",
"src": "737:3:1"
}
],
"id": 75,
"name": "MemberAccess",
"src": "737:10:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 44,
"type": "address",
"value": "receiver"
},
"id": 76,
"name": "Identifier",
"src": "749:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 77,
"name": "Identifier",
"src": "759:6:1"
}
],
"id": 78,
"name": "FunctionCall",
"src": "728:38:1"
}
],
"id": 79,
"name": "EmitStatement",
"src": "723:43:1"
},
{
"attributes": {
"functionReturnParameters": 50
},
"children": [
{
"attributes": {
"argumentTypes": null,
"hexvalue": "74727565",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "bool",
"type": "bool",
"value": "true"
},
"id": 80,
"name": "Literal",
"src": "777:4:1"
}
],
"id": 81,
"name": "Return",
"src": "770:11:1"
}
],
"id": 82,
"name": "Block",
"src": "602:183:1"
}
],
"id": 83,
"name": "FunctionDefinition",
"src": "521:264:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "getBalanceInEth",
"scope": 112,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "addr",
"scope": 99,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 84,
"name": "ElementaryTypeName",
"src": "813:7:1"
}
],
"id": 85,
"name": "VariableDeclaration",
"src": "813:12:1"
}
],
"id": 86,
"name": "ParameterList",
"src": "812:14:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 99,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 87,
"name": "ElementaryTypeName",
"src": "847:4:1"
}
],
"id": 88,
"name": "VariableDeclaration",
"src": "847:4:1"
}
],
"id": 89,
"name": "ParameterList",
"src": "846:6:1"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 89
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "uint256",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
}
],
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "convert",
"referencedDeclaration": 15,
"type": "function (uint256,uint256) pure returns (uint256)"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 16,
"type": "type(library ConvertLib)",
"value": "ConvertLib"
},
"id": 90,
"name": "Identifier",
"src": "863:10:1"
}
],
"id": 91,
"name": "MemberAccess",
"src": "863:18:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "uint256",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 111,
"type": "function (address) view returns (uint256)",
"value": "getBalance"
},
"id": 92,
"name": "Identifier",
"src": "882:10:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 85,
"type": "address",
"value": "addr"
},
"id": 93,
"name": "Identifier",
"src": "893:4:1"
}
],
"id": 94,
"name": "FunctionCall",
"src": "882:16:1"
},
{
"attributes": {
"argumentTypes": null,
"hexvalue": "32",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "number",
"type": "int_const 2",
"value": "2"
},
"id": 95,
"name": "Literal",
"src": "899:1:1"
}
],
"id": 96,
"name": "FunctionCall",
"src": "863:38:1"
}
],
"id": 97,
"name": "Return",
"src": "856:45:1"
}
],
"id": 98,
"name": "Block",
"src": "852:53:1"
}
],
"id": 99,
"name": "FunctionDefinition",
"src": "788:117:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "getBalance",
"scope": 112,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "addr",
"scope": 111,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 100,
"name": "ElementaryTypeName",
"src": "928:7:1"
}
],
"id": 101,
"name": "VariableDeclaration",
"src": "928:12:1"
}
],
"id": 102,
"name": "ParameterList",
"src": "927:14:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 111,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 103,
"name": "ElementaryTypeName",
"src": "962:4:1"
}
],
"id": 104,
"name": "VariableDeclaration",
"src": "962:4:1"
}
],
"id": 105,
"name": "ParameterList",
"src": "961:6:1"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 105
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 106,
"name": "Identifier",
"src": "979:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 101,
"type": "address",
"value": "addr"
},
"id": 107,
"name": "Identifier",
"src": "988:4:1"
}
],
"id": 108,
"name": "IndexAccess",
"src": "979:14:1"
}
],
"id": 109,
"name": "Return",
"src": "972:21:1"
}
],
"id": 110,
"name": "Block",
"src": "968:29:1"
}
],
"id": 111,
"name": "FunctionDefinition",
"src": "908:89:1"
}
],
"id": 112,
"name": "ContractDefinition",
"src": "324:675:1"
}
],
"id": 113,
"name": "SourceUnit",
"src": "0:1000:1"
},
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"exportedSymbols": {
"MetaCoin1": [
112
]
},
"id": 113,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 18,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:1"
},
{
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"file": "./ConvertLib.sol",
"id": 19,
"nodeType": "ImportDirective",
"scope": 113,
"sourceUnit": 17,
"src": "34:26:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 112,
"linearizedBaseContracts": [
112
],
"name": "MetaCoin1",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 23,
"name": "balances",
"nodeType": "VariableDeclaration",
"scope": 112,
"src": "346:34:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"typeName": {
"id": 22,
"keyType": {
"id": 20,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "355:7:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "346:25:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueType": {
"id": 21,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "366:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"value": null,
"visibility": "internal"
},
{
"anonymous": false,
"documentation": null,
"id": 31,
"name": "Transfer",
"nodeType": "EventDefinition",
"parameters": {
"id": 30,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25,
"indexed": true,
"name": "_from",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "399:21:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "399:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27,
"indexed": true,
"name": "_to",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "422:19:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 26,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "422:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 29,
"indexed": false,
"name": "_value",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "443:14:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 28,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "443:7:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "398:60:1"
},
"src": "384:75:1"
},
{
"body": {
"id": 41,
"nodeType": "Block",
"src": "483:35:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 39,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 34,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "487:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 37,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 35,
"name": "tx",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 196,
"src": "496:2:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_transaction",
"typeString": "tx"
}
},
"id": 36,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "origin",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "496:9:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "487:19:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "3130303030",
"id": 38,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "509:5:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_10000_by_1",
"typeString": "int_const 10000"
},
"value": "10000"
},
"src": "487:27:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 40,
"nodeType": "ExpressionStatement",
"src": "487:27:1"
}
]
},
"documentation": null,
"id": 42,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 32,
"nodeType": "ParameterList",
"parameters": [],
"src": "473:2:1"
},
"returnParameters": {
"id": 33,
"nodeType": "ParameterList",
"parameters": [],
"src": "483:0:1"
},
"scope": 112,
"src": "462:56:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 82,
"nodeType": "Block",
"src": "602:183:1",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 56,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 51,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "610:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 54,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 52,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "619:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 53,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "619:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "610:20:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 55,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "633:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "610:29:1",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 59,
"nodeType": "IfStatement",
"src": "606:47:1",
"trueBody": {
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 57,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "648:5:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 50,
"id": 58,
"nodeType": "Return",
"src": "641:12:1"
}
},
{
"expression": {
"argumentTypes": null,
"id": 65,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 60,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "657:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 63,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 61,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "666:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 62,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "666:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "657:20:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "-=",
"rightHandSide": {
"argumentTypes": null,
"id": 64,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "681:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "657:30:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 66,
"nodeType": "ExpressionStatement",
"src": "657:30:1"
},
{
"expression": {
"argumentTypes": null,
"id": 71,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 67,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "691:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 69,
"indexExpression": {
"argumentTypes": null,
"id": 68,
"name": "receiver",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44,
"src": "700:8:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "691:18:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "+=",
"rightHandSide": {
"argumentTypes": null,
"id": 70,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "713:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "691:28:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 72,
"nodeType": "ExpressionStatement",
"src": "691:28:1"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 74,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "737:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 75,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "737:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 76,
"name": "receiver",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44,
"src": "749:8:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 77,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "759:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 73,
"name": "Transfer",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 31,
"src": "728:8:1",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (address,address,uint256)"
}
},
"id": 78,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "728:38:1",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 79,
"nodeType": "EmitStatement",
"src": "723:43:1"
},
{
"expression": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 80,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "777:4:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"functionReturnParameters": 50,
"id": 81,
"nodeType": "Return",
"src": "770:11:1"
}
]
},
"documentation": null,
"id": 83,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sendCoin",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 47,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 44,
"name": "receiver",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "539:16:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 43,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "539:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 46,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "557:11:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "557:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "538:31:1"
},
"returnParameters": {
"id": 50,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 49,
"name": "sufficient",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "585:15:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 48,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "585:4:1",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "584:17:1"
},
"scope": 112,
"src": "521:264:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 98,
"nodeType": "Block",
"src": "852:53:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 93,
"name": "addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 85,
"src": "893:4:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 92,
"name": "getBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 111,
"src": "882:10:1",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view returns (uint256)"
}
},
"id": 94,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "882:16:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"hexValue": "32",
"id": 95,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "899:1:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
}
],
"expression": {
"argumentTypes": null,
"id": 90,
"name": "ConvertLib",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16,
"src": "863:10:1",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ConvertLib_$16_$",
"typeString": "type(library ConvertLib)"
}
},
"id": 91,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "convert",
"nodeType": "MemberAccess",
"referencedDeclaration": 15,
"src": "863:18:1",
"typeDescriptions": {
"typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 96,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "863:38:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 89,
"id": 97,
"nodeType": "Return",
"src": "856:45:1"
}
]
},
"documentation": null,
"id": 99,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getBalanceInEth",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 86,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 85,
"name": "addr",
"nodeType": "VariableDeclaration",
"scope": 99,
"src": "813:12:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 84,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "813:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "812:14:1"
},
"returnParameters": {
"id": 89,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 88,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 99,
"src": "847:4:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 87,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "847:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "846:6:1"
},
"scope": 112,
"src": "788:117:1",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 110,
"nodeType": "Block",
"src": "968:29:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 106,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "979:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 108,
"indexExpression": {
"argumentTypes": null,
"id": 107,
"name": "addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 101,
"src": "988:4:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "979:14:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 105,
"id": 109,
"nodeType": "Return",
"src": "972:21:1"
}
]
},
"documentation": null,
"id": 111,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getBalance",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 102,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 101,
"name": "addr",
"nodeType": "VariableDeclaration",
"scope": 111,
"src": "928:12:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 100,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "928:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "927:14:1"
},
"returnParameters": {
"id": 105,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 104,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 111,
"src": "962:4:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 103,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "962:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "961:6:1"
},
"scope": 112,
"src": "908:89:1",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
}
],
"scope": 113,
"src": "324:675:1"
}
],
"src": "0:1000:1"
},
"abi": [
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"name": "_from",
"type": "address"
},
{
"indexed": true,
"name": "_to",
"type": "address"
},
{
"indexed": false,
"name": "_value",
"type": "uint256"
}
],
"name": "Transfer",
"type": "event"
},
{
"constant": false,
"inputs": [
{
"name": "receiver",
"type": "address"
},
{
"name": "amount",
"type": "uint256"
}
],
"name": "sendCoin",
"outputs": [
{
"name": "sufficient",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "addr",
"type": "address"
}
],
"name": "getBalanceInEth",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [
{
"name": "addr",
"type": "address"
}
],
"name": "getBalance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b506127106000803273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610406806100656000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c0100000000000000000000000000000000000000000000000000000000900480637bd703e81461006357806390b98a11146100bb578063f8b2cb4f14610121575b600080fd5b6100a56004803603602081101561007957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610179565b6040518082815260200191505060405180910390f35b610107600480360360408110156100d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610239565b604051808215151515815260200191505060405180910390f35b6101636004803603602081101561013757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610392565b6040518082815260200191505060405180910390f35b600073__ConvertLib____________________________6396e4ee3d61019e84610392565b60026040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018281526020019250505060206040518083038186803b1580156101f757600080fd5b505af415801561020b573d6000803e3d6000fd5b505050506040513d602081101561022157600080fd5b81019080805190602001909291905050509050919050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561028a576000905061038c565b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905091905056fea165627a7a723058203e67c35241f75d8a14b0666df253e8e1bce936595adec775887ba45287e0ec450029",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061005e576000357c0100000000000000000000000000000000000000000000000000000000900480637bd703e81461006357806390b98a11146100bb578063f8b2cb4f14610121575b600080fd5b6100a56004803603602081101561007957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610179565b6040518082815260200191505060405180910390f35b610107600480360360408110156100d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610239565b604051808215151515815260200191505060405180910390f35b6101636004803603602081101561013757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610392565b6040518082815260200191505060405180910390f35b600073__ConvertLib____________________________6396e4ee3d61019e84610392565b60026040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018281526020019250505060206040518083038186803b1580156101f757600080fd5b505af415801561020b573d6000803e3d6000fd5b505050506040513d602081101561022157600080fd5b81019080805190602001909291905050509050919050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561028a576000905061038c565b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905091905056fea165627a7a723058203e67c35241f75d8a14b0666df253e8e1bce936595adec775887ba45287e0ec450029",
"unlinked_binary": "0x608060405234801561001057600080fd5b506127106000803273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610406806100656000396000f3fe608060405234801561001057600080fd5b506004361061005e576000357c0100000000000000000000000000000000000000000000000000000000900480637bd703e81461006357806390b98a11146100bb578063f8b2cb4f14610121575b600080fd5b6100a56004803603602081101561007957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610179565b6040518082815260200191505060405180910390f35b610107600480360360408110156100d157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610239565b604051808215151515815260200191505060405180910390f35b6101636004803603602081101561013757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610392565b6040518082815260200191505060405180910390f35b600073__ConvertLib____________________________6396e4ee3d61019e84610392565b60026040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808381526020018281526020019250505060206040518083038186803b1580156101f757600080fd5b505af415801561020b573d6000803e3d6000fd5b505050506040513d602081101561022157600080fd5b81019080805190602001909291905050509050919050565b6000816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561028a576000905061038c565b816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b92915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905091905056fea165627a7a723058203e67c35241f75d8a14b0666df253e8e1bce936595adec775887ba45287e0ec450029",
"compiler": {
"name": "solc",
"version": "0.5.2+commit.1df8f40c.Emscripten.clang"
},
"devdoc": {
"methods": {}
},
"userdoc": {
"methods": {}
},
"sourceList": [
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/Migrations.sol"
],
"sources": {
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol": {
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"exportedSymbols": {
"ConvertLib": [
16
]
},
"id": 17,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:0"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"id": 16,
"linearizedBaseContracts": [
16
],
"name": "ConvertLib",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 14,
"nodeType": "Block",
"src": "149:38:0",
"statements": [
{
"expression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 12,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 10,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3,
"src": "160:6:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 11,
"name": "conversionRate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 5,
"src": "169:14:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "160:23:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 9,
"id": 13,
"nodeType": "Return",
"src": "153:30:0"
}
]
},
"documentation": null,
"id": 15,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "convert",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 6,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "72:11:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 2,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "72:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 5,
"name": "conversionRate",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "84:19:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 4,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "84:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "71:33:0"
},
"returnParameters": {
"id": 9,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 8,
"name": "convertedAmount",
"nodeType": "VariableDeclaration",
"scope": 15,
"src": "126:20:0",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 7,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "126:4:0",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "125:22:0"
},
"scope": 16,
"src": "55:132:0",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
}
],
"scope": 17,
"src": "34:155:0"
}
],
"src": "0:190:0"
},
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"exportedSymbols": {
"ConvertLib": [
16
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 1,
"name": "PragmaDirective",
"src": "0:32:0"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "library",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
16
],
"name": "ConvertLib",
"scope": 17
},
"children": [
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "convert",
"scope": 16,
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "amount",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 2,
"name": "ElementaryTypeName",
"src": "72:4:0"
}
],
"id": 3,
"name": "VariableDeclaration",
"src": "72:11:0"
},
{
"attributes": {
"constant": false,
"name": "conversionRate",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 4,
"name": "ElementaryTypeName",
"src": "84:4:0"
}
],
"id": 5,
"name": "VariableDeclaration",
"src": "84:19:0"
}
],
"id": 6,
"name": "ParameterList",
"src": "71:33:0"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "convertedAmount",
"scope": 15,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 7,
"name": "ElementaryTypeName",
"src": "126:4:0"
}
],
"id": 8,
"name": "VariableDeclaration",
"src": "126:20:0"
}
],
"id": 9,
"name": "ParameterList",
"src": "125:22:0"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 9
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "*",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 3,
"type": "uint256",
"value": "amount"
},
"id": 10,
"name": "Identifier",
"src": "160:6:0"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 5,
"type": "uint256",
"value": "conversionRate"
},
"id": 11,
"name": "Identifier",
"src": "169:14:0"
}
],
"id": 12,
"name": "BinaryOperation",
"src": "160:23:0"
}
],
"id": 13,
"name": "Return",
"src": "153:30:0"
}
],
"id": 14,
"name": "Block",
"src": "149:38:0"
}
],
"id": 15,
"name": "FunctionDefinition",
"src": "55:132:0"
}
],
"id": 16,
"name": "ContractDefinition",
"src": "34:155:0"
}
],
"id": 17,
"name": "SourceUnit",
"src": "0:190:0"
},
"source": "pragma solidity >=0.4.22 <0.6.0;\n\nlibrary ConvertLib{\n\tfunction convert(uint amount,uint conversionRate) public pure returns (uint convertedAmount)\n\t{\n\t\treturn amount * conversionRate;\n\t}\n}\n"
},
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol": {
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"exportedSymbols": {
"MetaCoin1": [
112
]
},
"id": 113,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 18,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:1"
},
{
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"file": "./ConvertLib.sol",
"id": 19,
"nodeType": "ImportDirective",
"scope": 113,
"sourceUnit": 17,
"src": "34:26:1",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 112,
"linearizedBaseContracts": [
112
],
"name": "MetaCoin1",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 23,
"name": "balances",
"nodeType": "VariableDeclaration",
"scope": 112,
"src": "346:34:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"typeName": {
"id": 22,
"keyType": {
"id": 20,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "355:7:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "346:25:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueType": {
"id": 21,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "366:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"value": null,
"visibility": "internal"
},
{
"anonymous": false,
"documentation": null,
"id": 31,
"name": "Transfer",
"nodeType": "EventDefinition",
"parameters": {
"id": 30,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 25,
"indexed": true,
"name": "_from",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "399:21:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 24,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "399:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 27,
"indexed": true,
"name": "_to",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "422:19:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 26,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "422:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 29,
"indexed": false,
"name": "_value",
"nodeType": "VariableDeclaration",
"scope": 31,
"src": "443:14:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 28,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "443:7:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "398:60:1"
},
"src": "384:75:1"
},
{
"body": {
"id": 41,
"nodeType": "Block",
"src": "483:35:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 39,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 34,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "487:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 37,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 35,
"name": "tx",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 196,
"src": "496:2:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_transaction",
"typeString": "tx"
}
},
"id": 36,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "origin",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "496:9:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "487:19:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"hexValue": "3130303030",
"id": 38,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "509:5:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_10000_by_1",
"typeString": "int_const 10000"
},
"value": "10000"
},
"src": "487:27:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 40,
"nodeType": "ExpressionStatement",
"src": "487:27:1"
}
]
},
"documentation": null,
"id": 42,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 32,
"nodeType": "ParameterList",
"parameters": [],
"src": "473:2:1"
},
"returnParameters": {
"id": 33,
"nodeType": "ParameterList",
"parameters": [],
"src": "483:0:1"
},
"scope": 112,
"src": "462:56:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 82,
"nodeType": "Block",
"src": "602:183:1",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 56,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 51,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "610:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 54,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 52,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "619:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 53,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "619:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "610:20:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "<",
"rightExpression": {
"argumentTypes": null,
"id": 55,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "633:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "610:29:1",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 59,
"nodeType": "IfStatement",
"src": "606:47:1",
"trueBody": {
"expression": {
"argumentTypes": null,
"hexValue": "66616c7365",
"id": 57,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "648:5:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "false"
},
"functionReturnParameters": 50,
"id": 58,
"nodeType": "Return",
"src": "641:12:1"
}
},
{
"expression": {
"argumentTypes": null,
"id": 65,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 60,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "657:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 63,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 61,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "666:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 62,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "666:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "657:20:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "-=",
"rightHandSide": {
"argumentTypes": null,
"id": 64,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "681:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "657:30:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 66,
"nodeType": "ExpressionStatement",
"src": "657:30:1"
},
{
"expression": {
"argumentTypes": null,
"id": 71,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 67,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "691:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 69,
"indexExpression": {
"argumentTypes": null,
"id": 68,
"name": "receiver",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44,
"src": "700:8:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"nodeType": "IndexAccess",
"src": "691:18:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "+=",
"rightHandSide": {
"argumentTypes": null,
"id": 70,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "713:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "691:28:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 72,
"nodeType": "ExpressionStatement",
"src": "691:28:1"
},
{
"eventCall": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 74,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "737:3:1",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 75,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "737:10:1",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
{
"argumentTypes": null,
"id": 76,
"name": "receiver",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 44,
"src": "749:8:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 77,
"name": "amount",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 46,
"src": "759:6:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"id": 73,
"name": "Transfer",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 31,
"src": "728:8:1",
"typeDescriptions": {
"typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$__$",
"typeString": "function (address,address,uint256)"
}
},
"id": 78,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "728:38:1",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 79,
"nodeType": "EmitStatement",
"src": "723:43:1"
},
{
"expression": {
"argumentTypes": null,
"hexValue": "74727565",
"id": 80,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "bool",
"lValueRequested": false,
"nodeType": "Literal",
"src": "777:4:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"value": "true"
},
"functionReturnParameters": 50,
"id": 81,
"nodeType": "Return",
"src": "770:11:1"
}
]
},
"documentation": null,
"id": 83,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "sendCoin",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 47,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 44,
"name": "receiver",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "539:16:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 43,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "539:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 46,
"name": "amount",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "557:11:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 45,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "557:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "538:31:1"
},
"returnParameters": {
"id": 50,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 49,
"name": "sufficient",
"nodeType": "VariableDeclaration",
"scope": 83,
"src": "585:15:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 48,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "585:4:1",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "584:17:1"
},
"scope": 112,
"src": "521:264:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 98,
"nodeType": "Block",
"src": "852:53:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 93,
"name": "addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 85,
"src": "893:4:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 92,
"name": "getBalance",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 111,
"src": "882:10:1",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_uint256_$",
"typeString": "function (address) view returns (uint256)"
}
},
"id": 94,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "882:16:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"hexValue": "32",
"id": 95,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "899:1:1",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
}
],
"expression": {
"argumentTypes": null,
"id": 90,
"name": "ConvertLib",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 16,
"src": "863:10:1",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_ConvertLib_$16_$",
"typeString": "type(library ConvertLib)"
}
},
"id": 91,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "convert",
"nodeType": "MemberAccess",
"referencedDeclaration": 15,
"src": "863:18:1",
"typeDescriptions": {
"typeIdentifier": "t_function_delegatecall_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$",
"typeString": "function (uint256,uint256) pure returns (uint256)"
}
},
"id": 96,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "863:38:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 89,
"id": 97,
"nodeType": "Return",
"src": "856:45:1"
}
]
},
"documentation": null,
"id": 99,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getBalanceInEth",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 86,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 85,
"name": "addr",
"nodeType": "VariableDeclaration",
"scope": 99,
"src": "813:12:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 84,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "813:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "812:14:1"
},
"returnParameters": {
"id": 89,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 88,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 99,
"src": "847:4:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 87,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "847:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "846:6:1"
},
"scope": 112,
"src": "788:117:1",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 110,
"nodeType": "Block",
"src": "968:29:1",
"statements": [
{
"expression": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 106,
"name": "balances",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 23,
"src": "979:8:1",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
}
},
"id": 108,
"indexExpression": {
"argumentTypes": null,
"id": 107,
"name": "addr",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 101,
"src": "988:4:1",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "979:14:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"functionReturnParameters": 105,
"id": 109,
"nodeType": "Return",
"src": "972:21:1"
}
]
},
"documentation": null,
"id": 111,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "getBalance",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 102,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 101,
"name": "addr",
"nodeType": "VariableDeclaration",
"scope": 111,
"src": "928:12:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 100,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "928:7:1",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "927:14:1"
},
"returnParameters": {
"id": 105,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 104,
"name": "",
"nodeType": "VariableDeclaration",
"scope": 111,
"src": "962:4:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 103,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "962:4:1",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "961:6:1"
},
"scope": 112,
"src": "908:89:1",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
}
],
"scope": 113,
"src": "324:675:1"
}
],
"src": "0:1000:1"
},
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/MetaCoin.sol",
"exportedSymbols": {
"MetaCoin1": [
112
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 18,
"name": "PragmaDirective",
"src": "0:32:1"
},
{
"attributes": {
"SourceUnit": 17,
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/ConvertLib.sol",
"file": "./ConvertLib.sol",
"scope": 113,
"symbolAliases": [
null
],
"unitAlias": ""
},
"id": 19,
"name": "ImportDirective",
"src": "34:26:1"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
112
],
"name": "MetaCoin1",
"scope": 113
},
"children": [
{
"attributes": {
"constant": false,
"name": "balances",
"scope": 112,
"stateVariable": true,
"storageLocation": "default",
"type": "mapping(address => uint256)",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"type": "mapping(address => uint256)"
},
"children": [
{
"attributes": {
"name": "address",
"type": "address"
},
"id": 20,
"name": "ElementaryTypeName",
"src": "355:7:1"
},
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 21,
"name": "ElementaryTypeName",
"src": "366:4:1"
}
],
"id": 22,
"name": "Mapping",
"src": "346:25:1"
}
],
"id": 23,
"name": "VariableDeclaration",
"src": "346:34:1"
},
{
"attributes": {
"anonymous": false,
"documentation": null,
"name": "Transfer"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"indexed": true,
"name": "_from",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 24,
"name": "ElementaryTypeName",
"src": "399:7:1"
}
],
"id": 25,
"name": "VariableDeclaration",
"src": "399:21:1"
},
{
"attributes": {
"constant": false,
"indexed": true,
"name": "_to",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 26,
"name": "ElementaryTypeName",
"src": "422:7:1"
}
],
"id": 27,
"name": "VariableDeclaration",
"src": "422:19:1"
},
{
"attributes": {
"constant": false,
"indexed": false,
"name": "_value",
"scope": 31,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 28,
"name": "ElementaryTypeName",
"src": "443:7:1"
}
],
"id": 29,
"name": "VariableDeclaration",
"src": "443:14:1"
}
],
"id": 30,
"name": "ParameterList",
"src": "398:60:1"
}
],
"id": 31,
"name": "EventDefinition",
"src": "384:75:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": true,
"kind": "constructor",
"modifiers": [
null
],
"name": "",
"scope": 112,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 32,
"name": "ParameterList",
"src": "473:2:1"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 33,
"name": "ParameterList",
"src": "483:0:1"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 34,
"name": "Identifier",
"src": "487:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "origin",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 196,
"type": "tx",
"value": "tx"
},
"id": 35,
"name": "Identifier",
"src": "496:2:1"
}
],
"id": 36,
"name": "MemberAccess",
"src": "496:9:1"
}
],
"id": 37,
"name": "IndexAccess",
"src": "487:19:1"
},
{
"attributes": {
"argumentTypes": null,
"hexvalue": "3130303030",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "number",
"type": "int_const 10000",
"value": "10000"
},
"id": 38,
"name": "Literal",
"src": "509:5:1"
}
],
"id": 39,
"name": "Assignment",
"src": "487:27:1"
}
],
"id": 40,
"name": "ExpressionStatement",
"src": "487:27:1"
}
],
"id": 41,
"name": "Block",
"src": "483:35:1"
}
],
"id": 42,
"name": "FunctionDefinition",
"src": "462:56:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "sendCoin",
"scope": 112,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "receiver",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 43,
"name": "ElementaryTypeName",
"src": "539:7:1"
}
],
"id": 44,
"name": "VariableDeclaration",
"src": "539:16:1"
},
{
"attributes": {
"constant": false,
"name": "amount",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 45,
"name": "ElementaryTypeName",
"src": "557:4:1"
}
],
"id": 46,
"name": "VariableDeclaration",
"src": "557:11:1"
}
],
"id": 47,
"name": "ParameterList",
"src": "538:31:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "sufficient",
"scope": 83,
"stateVariable": false,
"storageLocation": "default",
"type": "bool",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "bool",
"type": "bool"
},
"id": 48,
"name": "ElementaryTypeName",
"src": "585:4:1"
}
],
"id": 49,
"name": "VariableDeclaration",
"src": "585:15:1"
}
],
"id": 50,
"name": "ParameterList",
"src": "584:17:1"
},
{
"children": [
{
"attributes": {
"falseBody": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "<",
"type": "bool"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 51,
"name": "Identifier",
"src": "610:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 52,
"name": "Identifier",
"src": "619:3:1"
}
],
"id": 53,
"name": "MemberAccess",
"src": "619:10:1"
}
],
"id": 54,
"name": "IndexAccess",
"src": "610:20:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 55,
"name": "Identifier",
"src": "633:6:1"
}
],
"id": 56,
"name": "BinaryOperation",
"src": "610:29:1"
},
{
"attributes": {
"functionReturnParameters": 50
},
"children": [
{
"attributes": {
"argumentTypes": null,
"hexvalue": "66616c7365",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "bool",
"type": "bool",
"value": "false"
},
"id": 57,
"name": "Literal",
"src": "648:5:1"
}
],
"id": 58,
"name": "Return",
"src": "641:12:1"
}
],
"id": 59,
"name": "IfStatement",
"src": "606:47:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "-=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 60,
"name": "Identifier",
"src": "657:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 61,
"name": "Identifier",
"src": "666:3:1"
}
],
"id": 62,
"name": "MemberAccess",
"src": "666:10:1"
}
],
"id": 63,
"name": "IndexAccess",
"src": "657:20:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 64,
"name": "Identifier",
"src": "681:6:1"
}
],
"id": 65,
"name": "Assignment",
"src": "657:30:1"
}
],
"id": 66,
"name": "ExpressionStatement",
"src": "657:30:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "+=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": true,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 67,
"name": "Identifier",
"src": "691:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 44,
"type": "address",
"value": "receiver"
},
"id": 68,
"name": "Identifier",
"src": "700:8:1"
}
],
"id": 69,
"name": "IndexAccess",
"src": "691:18:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 70,
"name": "Identifier",
"src": "713:6:1"
}
],
"id": 71,
"name": "Assignment",
"src": "691:28:1"
}
],
"id": 72,
"name": "ExpressionStatement",
"src": "691:28:1"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
},
{
"typeIdentifier": "t_address",
"typeString": "address"
},
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 31,
"type": "function (address,address,uint256)",
"value": "Transfer"
},
"id": 73,
"name": "Identifier",
"src": "728:8:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 74,
"name": "Identifier",
"src": "737:3:1"
}
],
"id": 75,
"name": "MemberAccess",
"src": "737:10:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 44,
"type": "address",
"value": "receiver"
},
"id": 76,
"name": "Identifier",
"src": "749:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 46,
"type": "uint256",
"value": "amount"
},
"id": 77,
"name": "Identifier",
"src": "759:6:1"
}
],
"id": 78,
"name": "FunctionCall",
"src": "728:38:1"
}
],
"id": 79,
"name": "EmitStatement",
"src": "723:43:1"
},
{
"attributes": {
"functionReturnParameters": 50
},
"children": [
{
"attributes": {
"argumentTypes": null,
"hexvalue": "74727565",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "bool",
"type": "bool",
"value": "true"
},
"id": 80,
"name": "Literal",
"src": "777:4:1"
}
],
"id": 81,
"name": "Return",
"src": "770:11:1"
}
],
"id": 82,
"name": "Block",
"src": "602:183:1"
}
],
"id": 83,
"name": "FunctionDefinition",
"src": "521:264:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "getBalanceInEth",
"scope": 112,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "addr",
"scope": 99,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 84,
"name": "ElementaryTypeName",
"src": "813:7:1"
}
],
"id": 85,
"name": "VariableDeclaration",
"src": "813:12:1"
}
],
"id": 86,
"name": "ParameterList",
"src": "812:14:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 99,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 87,
"name": "ElementaryTypeName",
"src": "847:4:1"
}
],
"id": 88,
"name": "VariableDeclaration",
"src": "847:4:1"
}
],
"id": 89,
"name": "ParameterList",
"src": "846:6:1"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 89
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "uint256",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
{
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
}
],
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "convert",
"referencedDeclaration": 15,
"type": "function (uint256,uint256) pure returns (uint256)"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 16,
"type": "type(library ConvertLib)",
"value": "ConvertLib"
},
"id": 90,
"name": "Identifier",
"src": "863:10:1"
}
],
"id": 91,
"name": "MemberAccess",
"src": "863:18:1"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "uint256",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 111,
"type": "function (address) view returns (uint256)",
"value": "getBalance"
},
"id": 92,
"name": "Identifier",
"src": "882:10:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 85,
"type": "address",
"value": "addr"
},
"id": 93,
"name": "Identifier",
"src": "893:4:1"
}
],
"id": 94,
"name": "FunctionCall",
"src": "882:16:1"
},
{
"attributes": {
"argumentTypes": null,
"hexvalue": "32",
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"subdenomination": null,
"token": "number",
"type": "int_const 2",
"value": "2"
},
"id": 95,
"name": "Literal",
"src": "899:1:1"
}
],
"id": 96,
"name": "FunctionCall",
"src": "863:38:1"
}
],
"id": 97,
"name": "Return",
"src": "856:45:1"
}
],
"id": 98,
"name": "Block",
"src": "852:53:1"
}
],
"id": 99,
"name": "FunctionDefinition",
"src": "788:117:1"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers": [
null
],
"name": "getBalance",
"scope": 112,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "addr",
"scope": 111,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 100,
"name": "ElementaryTypeName",
"src": "928:7:1"
}
],
"id": 101,
"name": "VariableDeclaration",
"src": "928:12:1"
}
],
"id": 102,
"name": "ParameterList",
"src": "927:14:1"
},
{
"children": [
{
"attributes": {
"constant": false,
"name": "",
"scope": 111,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 103,
"name": "ElementaryTypeName",
"src": "962:4:1"
}
],
"id": 104,
"name": "VariableDeclaration",
"src": "962:4:1"
}
],
"id": 105,
"name": "ParameterList",
"src": "961:6:1"
},
{
"children": [
{
"attributes": {
"functionReturnParameters": 105
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 23,
"type": "mapping(address => uint256)",
"value": "balances"
},
"id": 106,
"name": "Identifier",
"src": "979:8:1"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 101,
"type": "address",
"value": "addr"
},
"id": 107,
"name": "Identifier",
"src": "988:4:1"
}
],
"id": 108,
"name": "IndexAccess",
"src": "979:14:1"
}
],
"id": 109,
"name": "Return",
"src": "972:21:1"
}
],
"id": 110,
"name": "Block",
"src": "968:29:1"
}
],
"id": 111,
"name": "FunctionDefinition",
"src": "908:89:1"
}
],
"id": 112,
"name": "ContractDefinition",
"src": "324:675:1"
}
],
"id": 113,
"name": "SourceUnit",
"src": "0:1000:1"
},
"source": "pragma solidity >=0.4.22 <0.6.0;\n\nimport \"./ConvertLib.sol\";\n\n// This is just a simple example of a coin-like contract.\n// It is not standards compatible and cannot be expected to talk to other\n// coin/token contracts. If you want to create a standards-compliant\n// token, see: https://github.com/ConsenSys/Tokens. Cheers!\n\ncontract MetaCoin1 {\n\tmapping (address => uint) balances;\n\n\tevent Transfer(address indexed _from, address indexed _to, uint256 _value);\n\n\tconstructor() public {\n\t\tbalances[tx.origin] = 10000;\n\t}\n\n\tfunction sendCoin(address receiver, uint amount) public returns(bool sufficient) {\n\t\tif (balances[msg.sender] < amount) return false;\n\t\tbalances[msg.sender] -= amount;\n\t\tbalances[receiver] += amount;\n\t\temit Transfer(msg.sender, receiver, amount);\n\t\treturn true;\n\t}\n\n\tfunction getBalanceInEth(address addr) public view returns(uint){\n\t\treturn ConvertLib.convert(getBalance(addr),2);\n\t}\n\n\tfunction getBalance(address addr) public view returns(uint) {\n\t\treturn balances[addr];\n\t}\n}\n"
},
"/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/Migrations.sol": {
"ast": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
169
]
},
"id": 170,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 114,
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:32:2"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 169,
"linearizedBaseContracts": [
169
],
"name": "Migrations",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 116,
"name": "owner",
"nodeType": "VariableDeclaration",
"scope": 169,
"src": "58:20:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 115,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "58:7:2",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 118,
"name": "last_completed_migration",
"nodeType": "VariableDeclaration",
"scope": 169,
"src": "82:39:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 117,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "82:7:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"body": {
"id": 126,
"nodeType": "Block",
"src": "148:37:2",
"statements": [
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 123,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 120,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "158:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 121,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "158:10:2",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"id": 122,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 116,
"src": "172:5:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"src": "158:19:2",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": null,
"id": 125,
"nodeType": "IfStatement",
"src": "154:26:2",
"trueBody": {
"id": 124,
"nodeType": "PlaceholderStatement",
"src": "179:1:2"
}
}
]
},
"documentation": null,
"id": 127,
"name": "restricted",
"nodeType": "ModifierDefinition",
"parameters": {
"id": 119,
"nodeType": "ParameterList",
"parameters": [],
"src": "145:2:2"
},
"src": "126:59:2",
"visibility": "internal"
},
{
"body": {
"id": 135,
"nodeType": "Block",
"src": "210:29:2",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 133,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 130,
"name": "owner",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 116,
"src": "216:5:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 131,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 184,
"src": "224:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 132,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "224:10:2",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
},
"src": "216:18:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"id": 134,
"nodeType": "ExpressionStatement",
"src": "216:18:2"
}
]
},
"documentation": null,
"id": 136,
"implemented": true,
"kind": "constructor",
"modifiers": [],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 128,
"nodeType": "ParameterList",
"parameters": [],
"src": "200:2:2"
},
"returnParameters": {
"id": 129,
"nodeType": "ParameterList",
"parameters": [],
"src": "210:0:2"
},
"scope": 169,
"src": "189:50:2",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 147,
"nodeType": "Block",
"src": "299:47:2",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 145,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 143,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 118,
"src": "305:24:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 144,
"name": "completed",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 138,
"src": "332:9:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "305:36:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 146,
"nodeType": "ExpressionStatement",
"src": "305:36:2"
}
]
},
"documentation": null,
"id": 148,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 141,
"modifierName": {
"argumentTypes": null,
"id": 140,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 127,
"src": "288:10:2",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "288:10:2"
}
],
"name": "setCompleted",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 139,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 138,
"name": "completed",
"nodeType": "VariableDeclaration",
"scope": 148,
"src": "265:14:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 137,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "265:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "264:16:2"
},
"returnParameters": {
"id": 142,
"nodeType": "ParameterList",
"parameters": [],
"src": "299:0:2"
},
"scope": 169,
"src": "243:103:2",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
{
"body": {
"id": 167,
"nodeType": "Block",
"src": "406:109:2",
"statements": [
{
"assignments": [
156
],
"declarations": [
{
"constant": false,
"id": 156,
"name": "upgraded",
"nodeType": "VariableDeclaration",
"scope": 167,
"src": "412:19:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$169",
"typeString": "contract Migrations"
},
"typeName": {
"contractScope": null,
"id": 155,
"name": "Migrations",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 169,
"src": "412:10:2",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$169",
"typeString": "contract Migrations"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 160,
"initialValue": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 158,
"name": "new_address",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 150,
"src": "445:11:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"id": 157,
"name": "Migrations",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 169,
"src": "434:10:2",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_Migrations_$169_$",
"typeString": "type(contract Migrations)"
}
},
"id": 159,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "434:23:2",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$169",
"typeString": "contract Migrations"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "412:45:2"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 164,
"name": "last_completed_migration",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 118,
"src": "485:24:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"expression": {
"argumentTypes": null,
"id": 161,
"name": "upgraded",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 156,
"src": "463:8:2",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Migrations_$169",
"typeString": "contract Migrations"
}
},
"id": 163,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "setCompleted",
"nodeType": "MemberAccess",
"referencedDeclaration": 148,
"src": "463:21:2",
"typeDescriptions": {
"typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$",
"typeString": "function (uint256) external"
}
},
"id": 165,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "463:47:2",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 166,
"nodeType": "ExpressionStatement",
"src": "463:47:2"
}
]
},
"documentation": null,
"id": 168,
"implemented": true,
"kind": "function",
"modifiers": [
{
"arguments": null,
"id": 153,
"modifierName": {
"argumentTypes": null,
"id": 152,
"name": "restricted",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 127,
"src": "395:10:2",
"typeDescriptions": {
"typeIdentifier": "t_modifier$__$",
"typeString": "modifier ()"
}
},
"nodeType": "ModifierInvocation",
"src": "395:10:2"
}
],
"name": "upgrade",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 151,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 150,
"name": "new_address",
"nodeType": "VariableDeclaration",
"scope": 168,
"src": "367:19:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 149,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "367:7:2",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "366:21:2"
},
"returnParameters": {
"id": 154,
"nodeType": "ParameterList",
"parameters": [],
"src": "406:0:2"
},
"scope": 169,
"src": "350:165:2",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 170,
"src": "34:483:2"
}
],
"src": "0:518:2"
},
"legacyAST": {
"attributes": {
"absolutePath": "/home/rocky/truffle/mythjs-should-detect/bernhard_medium_post/contracts/Migrations.sol",
"exportedSymbols": {
"Migrations": [
169
]
}
},
"children": [
{
"attributes": {
"literals": [
"solidity",
">=",
"0.4",
".22",
"<",
"0.6",
".0"
]
},
"id": 114,
"name": "PragmaDirective",
"src": "0:32:2"
},
{
"attributes": {
"baseContracts": [
null
],
"contractDependencies": [
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts": [
169
],
"name": "Migrations",
"scope": 170
},
"children": [
{
"attributes": {
"constant": false,
"name": "owner",
"scope": 169,
"stateVariable": true,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 115,
"name": "ElementaryTypeName",
"src": "58:7:2"
}
],
"id": 116,
"name": "VariableDeclaration",
"src": "58:20:2"
},
{
"attributes": {
"constant": false,
"name": "last_completed_migration",
"scope": 169,
"stateVariable": true,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"name": "uint256",
"type": "uint256"
},
"id": 117,
"name": "ElementaryTypeName",
"src": "82:7:2"
}
],
"id": 118,
"name": "VariableDeclaration",
"src": "82:39:2"
},
{
"attributes": {
"documentation": null,
"name": "restricted",
"visibility": "internal"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 119,
"name": "ParameterList",
"src": "145:2:2"
},
{
"children": [
{
"attributes": {
"falseBody": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "==",
"type": "bool"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 120,
"name": "Identifier",
"src": "158:3:2"
}
],
"id": 121,
"name": "MemberAccess",
"src": "158:10:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 116,
"type": "address",
"value": "owner"
},
"id": 122,
"name": "Identifier",
"src": "172:5:2"
}
],
"id": 123,
"name": "BinaryOperation",
"src": "158:19:2"
},
{
"id": 124,
"name": "PlaceholderStatement",
"src": "179:1:2"
}
],
"id": 125,
"name": "IfStatement",
"src": "154:26:2"
}
],
"id": 126,
"name": "Block",
"src": "148:37:2"
}
],
"id": 127,
"name": "ModifierDefinition",
"src": "126:59:2"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": true,
"kind": "constructor",
"modifiers": [
null
],
"name": "",
"scope": 169,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 128,
"name": "ParameterList",
"src": "200:2:2"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 129,
"name": "ParameterList",
"src": "210:0:2"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "address"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 116,
"type": "address",
"value": "owner"
},
"id": 130,
"name": "Identifier",
"src": "216:5:2"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "sender",
"referencedDeclaration": null,
"type": "address payable"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 184,
"type": "msg",
"value": "msg"
},
"id": 131,
"name": "Identifier",
"src": "224:3:2"
}
],
"id": 132,
"name": "MemberAccess",
"src": "224:10:2"
}
],
"id": 133,
"name": "Assignment",
"src": "216:18:2"
}
],
"id": 134,
"name": "ExpressionStatement",
"src": "216:18:2"
}
],
"id": 135,
"name": "Block",
"src": "210:29:2"
}
],
"id": 136,
"name": "FunctionDefinition",
"src": "189:50:2"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"name": "setCompleted",
"scope": 169,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "completed",
"scope": 148,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "uint",
"type": "uint256"
},
"id": 137,
"name": "ElementaryTypeName",
"src": "265:4:2"
}
],
"id": 138,
"name": "VariableDeclaration",
"src": "265:14:2"
}
],
"id": 139,
"name": "ParameterList",
"src": "264:16:2"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 142,
"name": "ParameterList",
"src": "299:0:2"
},
{
"attributes": {
"arguments": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 127,
"type": "modifier ()",
"value": "restricted"
},
"id": 140,
"name": "Identifier",
"src": "288:10:2"
}
],
"id": 141,
"name": "ModifierInvocation",
"src": "288:10:2"
},
{
"children": [
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"operator": "=",
"type": "uint256"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 118,
"type": "uint256",
"value": "last_completed_migration"
},
"id": 143,
"name": "Identifier",
"src": "305:24:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 138,
"type": "uint256",
"value": "completed"
},
"id": 144,
"name": "Identifier",
"src": "332:9:2"
}
],
"id": 145,
"name": "Assignment",
"src": "305:36:2"
}
],
"id": 146,
"name": "ExpressionStatement",
"src": "305:36:2"
}
],
"id": 147,
"name": "Block",
"src": "299:47:2"
}
],
"id": 148,
"name": "FunctionDefinition",
"src": "243:103:2"
},
{
"attributes": {
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"name": "upgrade",
"scope": 169,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children": [
{
"children": [
{
"attributes": {
"constant": false,
"name": "new_address",
"scope": 168,
"stateVariable": false,
"storageLocation": "default",
"type": "address",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"name": "address",
"stateMutability": "nonpayable",
"type": "address"
},
"id": 149,
"name": "ElementaryTypeName",
"src": "367:7:2"
}
],
"id": 150,
"name": "VariableDeclaration",
"src": "367:19:2"
}
],
"id": 151,
"name": "ParameterList",
"src": "366:21:2"
},
{
"attributes": {
"parameters": [
null
]
},
"children": [],
"id": 154,
"name": "ParameterList",
"src": "406:0:2"
},
{
"attributes": {
"arguments": null
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 127,
"type": "modifier ()",
"value": "restricted"
},
"id": 152,
"name": "Identifier",
"src": "395:10:2"
}
],
"id": 153,
"name": "ModifierInvocation",
"src": "395:10:2"
},
{
"children": [
{
"attributes": {
"assignments": [
156
]
},
"children": [
{
"attributes": {
"constant": false,
"name": "upgraded",
"scope": 167,
"stateVariable": false,
"storageLocation": "default",
"type": "contract Migrations",
"value": null,
"visibility": "internal"
},
"children": [
{
"attributes": {
"contractScope": null,
"name": "Migrations",
"referencedDeclaration": 169,
"type": "contract Migrations"
},
"id": 155,
"name": "UserDefinedTypeName",
"src": "412:10:2"
}
],
"id": 156,
"name": "VariableDeclaration",
"src": "412:19:2"
},
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "contract Migrations",
"type_conversion": true
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_address",
"typeString": "address"
}
],
"overloadedDeclarations": [
null
],
"referencedDeclaration": 169,
"type": "type(contract Migrations)",
"value": "Migrations"
},
"id": 157,
"name": "Identifier",
"src": "434:10:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 150,
"type": "address",
"value": "new_address"
},
"id": 158,
"name": "Identifier",
"src": "445:11:2"
}
],
"id": 159,
"name": "FunctionCall",
"src": "434:23:2"
}
],
"id": 160,
"name": "VariableDeclarationStatement",
"src": "412:45:2"
},
{
"children": [
{
"attributes": {
"argumentTypes": null,
"isConstant": false,
"isLValue": false,
"isPure": false,
"isStructConstructorCall": false,
"lValueRequested": false,
"names": [
null
],
"type": "tuple()",
"type_conversion": false
},
"children": [
{
"attributes": {
"argumentTypes": [
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
],
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"member_name": "setCompleted",
"referencedDeclaration": 148,
"type": "function (uint256) external"
},
"children": [
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 156,
"type": "contract Migrations",
"value": "upgraded"
},
"id": 161,
"name": "Identifier",
"src": "463:8:2"
}
],
"id": 163,
"name": "MemberAccess",
"src": "463:21:2"
},
{
"attributes": {
"argumentTypes": null,
"overloadedDeclarations": [
null
],
"referencedDeclaration": 118,
"type": "uint256",
"value": "last_completed_migration"
},
"id": 164,
"name": "Identifier",
"src": "485:24:2"
}
],
"id": 165,
"name": "FunctionCall",
"src": "463:47:2"
}
],
"id": 166,
"name": "ExpressionStatement",
"src": "463:47:2"
}
],
"id": 167,
"name": "Block",
"src": "406:109:2"
}
],
"id": 168,
"name": "FunctionDefinition",
"src": "350:165:2"
}
],
"id": 169,
"name": "ContractDefinition",
"src": "34:483:2"
}
],
"id": 170,
"name": "SourceUnit",
"src": "0:518:2"
},
"source": "pragma solidity >=0.4.22 <0.6.0;\n\ncontract Migrations {\n address public owner;\n uint256 public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n"
}
},
"contractName": "MetaCoin1",
"updatedAt": "2019-02-24T19:03:04.933Z"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment