UNPKG

@aragon/apps-payroll

Version:

_**Code in Github:**_ [aragon-apps/apps/payroll](https://github.com/aragon/aragon-apps/tree/master/future-apps/payroll)

931 lines (930 loc) 522 kB
{ "contractName": "MaliciousEmployee", "abi": [ { "constant": true, "inputs": [], "name": "action", "outputs": [ { "name": "", "type": "uint8" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "payroll", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "counter", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_payroll", "type": "address" } ], "name": "setPayroll", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_action", "type": "uint8" } ], "name": "setAction", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "payday", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_tokens", "type": "address[]" }, { "name": "_distribution", "type": "uint256[]" } ], "name": "determineAllocation", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [], "name": "reenter", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b506108f6806100206000396000f30060806040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630a7a1c4d811461009257806313cb8a9b146100cb578063562a5d06146100e857806361bc221a146101265780636881385b1461014d5780638139d2ca14610162578063a0fe97e314610190578063fe2fdf0b146101a5575b600080fd5b34801561009e57600080fd5b506100a7610233565b604051808260028111156100b757fe5b60ff16815260200191505060405180910390f35b3480156100d757600080fd5b506100e660ff6004351661023c565b005b3480156100f457600080fd5b506100fd61027b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561013257600080fd5b5061013b61029c565b60408051918252519081900360200190f35b34801561015957600080fd5b506100e66102a2565b34801561016e57600080fd5b506100e673ffffffffffffffffffffffffffffffffffffffff60043516610385565b34801561019c57600080fd5b506100e66103d1565b3480156101b157600080fd5b50604080516020600480358082013583810280860185019096528085526100e695369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506107999650505050505050565b60005460ff1681565b600080548291907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600281111561027357fe5b021790555050565b600054610100900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60008054604080518381526020808201928390527fdcb33f3e000000000000000000000000000000000000000000000000000000008352602482018581526044830186905260606064840190815283516084850181905261010090960473ffffffffffffffffffffffffffffffffffffffff169663dcb33f3e96909586959460a486019202808383895b8381101561034457818101518382015260200161032c565b50505050905001945050505050600060405180830381600087803b15801561036b57600080fd5b505af115801561037f573d6000803e3d6000fd5b50505050565b6000805473ffffffffffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b6060806060600060015411156103e657610794565b60018054810190556000805460ff16600281111561040057fe5b14156104ec5760008054604080518381526020808201928390527fdcb33f3e000000000000000000000000000000000000000000000000000000008352602482018581526044830186905260606064840190815283516084850181905261010090960473ffffffffffffffffffffffffffffffffffffffff169663dcb33f3e96909586959460a486019202808383895b838110156104a8578181015183820152602001610490565b50505050905001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b50505050610794565b600160005460ff1660028111156104ff57fe5b14156105765760008054604080517f1216906b000000000000000000000000000000000000000000000000000000008152336004820152905161010090920473ffffffffffffffffffffffffffffffffffffffff1692631216906b9260248084019382900301818387803b1580156104cf57600080fd5b600260005460ff16600281111561058957fe5b141561079457604080516001808252818301909252906020808301908038833901905050925060008360008151811015156105c057fe5b73ffffffffffffffffffffffffffffffffffffffff92909216602092830291909101820152604080516001808252818301909252918281019080388339019050509150606482600081518110151561061457fe5b6020908102909101015260408051600180825281830190925290816020016020820280388339019050509050670de0b6b3a764000081600081518110151561065857fe5b9060200190602002018181525050600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe2fdf0b84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156107155781810151838201526020016106fd565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561075457818101518382015260200161073c565b50505050905001945050505050600060405180830381600087803b15801561077b57600080fd5b505af115801561078f573d6000803e3d6000fd5b505050505b505050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe2fdf0b83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610848578181015183820152602001610830565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561088757818101518382015260200161086f565b50505050905001945050505050600060405180830381600087803b1580156108ae57600080fd5b505af11580156108c2573d6000803e3d6000fd5b5050505050505600a165627a7a7230582064435b11bf74fd88808051d09dc83ff0cd0246be3297064a9ee393b8841b37870029", "deployedBytecode": "0x60806040526004361061008d5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630a7a1c4d811461009257806313cb8a9b146100cb578063562a5d06146100e857806361bc221a146101265780636881385b1461014d5780638139d2ca14610162578063a0fe97e314610190578063fe2fdf0b146101a5575b600080fd5b34801561009e57600080fd5b506100a7610233565b604051808260028111156100b757fe5b60ff16815260200191505060405180910390f35b3480156100d757600080fd5b506100e660ff6004351661023c565b005b3480156100f457600080fd5b506100fd61027b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561013257600080fd5b5061013b61029c565b60408051918252519081900360200190f35b34801561015957600080fd5b506100e66102a2565b34801561016e57600080fd5b506100e673ffffffffffffffffffffffffffffffffffffffff60043516610385565b34801561019c57600080fd5b506100e66103d1565b3480156101b157600080fd5b50604080516020600480358082013583810280860185019096528085526100e695369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506107999650505050505050565b60005460ff1681565b600080548291907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600281111561027357fe5b021790555050565b600054610100900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60008054604080518381526020808201928390527fdcb33f3e000000000000000000000000000000000000000000000000000000008352602482018581526044830186905260606064840190815283516084850181905261010090960473ffffffffffffffffffffffffffffffffffffffff169663dcb33f3e96909586959460a486019202808383895b8381101561034457818101518382015260200161032c565b50505050905001945050505050600060405180830381600087803b15801561036b57600080fd5b505af115801561037f573d6000803e3d6000fd5b50505050565b6000805473ffffffffffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b6060806060600060015411156103e657610794565b60018054810190556000805460ff16600281111561040057fe5b14156104ec5760008054604080518381526020808201928390527fdcb33f3e000000000000000000000000000000000000000000000000000000008352602482018581526044830186905260606064840190815283516084850181905261010090960473ffffffffffffffffffffffffffffffffffffffff169663dcb33f3e96909586959460a486019202808383895b838110156104a8578181015183820152602001610490565b50505050905001945050505050600060405180830381600087803b1580156104cf57600080fd5b505af11580156104e3573d6000803e3d6000fd5b50505050610794565b600160005460ff1660028111156104ff57fe5b14156105765760008054604080517f1216906b000000000000000000000000000000000000000000000000000000008152336004820152905161010090920473ffffffffffffffffffffffffffffffffffffffff1692631216906b9260248084019382900301818387803b1580156104cf57600080fd5b600260005460ff16600281111561058957fe5b141561079457604080516001808252818301909252906020808301908038833901905050925060008360008151811015156105c057fe5b73ffffffffffffffffffffffffffffffffffffffff92909216602092830291909101820152604080516001808252818301909252918281019080388339019050509150606482600081518110151561061457fe5b6020908102909101015260408051600180825281830190925290816020016020820280388339019050509050670de0b6b3a764000081600081518110151561065857fe5b9060200190602002018181525050600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe2fdf0b84846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156107155781810151838201526020016106fd565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561075457818101518382015260200161073c565b50505050905001945050505050600060405180830381600087803b15801561077b57600080fd5b505af115801561078f573d6000803e3d6000fd5b505050505b505050565b600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663fe2fdf0b83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808060200180602001838103835285818151815260200191508051906020019060200280838360005b83811015610848578181015183820152602001610830565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561088757818101518382015260200161086f565b50505050905001945050505050600060405180830381600087803b1580156108ae57600080fd5b505af11580156108c2573d6000803e3d6000fd5b5050505050505600a165627a7a7230582064435b11bf74fd88808051d09dc83ff0cd0246be3297064a9ee393b8841b37870029", "sourceMap": "159:1352:4:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;159:1352:4;;;;;;;", "deployedSourceMap": "159:1352:4:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;192:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;192:20:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;419:75;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;419:75:4;;;;;;;;;218:22;;8:9:-1;5:2;;;30:1;27;20:12;5:2;218:22:4;;;;;;;;;;;;;;;;;;;;;;;246;;8:9:-1;5:2;;;30:1;27;20:12;5:2;246:22:4;;;;;;;;;;;;;;;;;;;;500:106;;8:9:-1;5:2;;;30:1;27;20:12;5:2;500:106:4;;;;333:80;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;333:80:4;;;;;;;766:743;;8:9:-1;5:2;;;30:1;27;20:12;5:2;766:743:4;;;;612:148;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;612:148:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;612:148:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;612:148:4;;;;-1:-1:-1;612:148:4;-1:-1:-1;612:148:4;;-1:-1:-1;612:148:4;;;;;;;;;-1:-1:-1;612:148:4;;-1:-1:-1;612:148:4;;-1:-1:-1;;;;;;;612:148:4;192:20;;;;;;:::o;419:75::-;471:6;:16;;480:7;;471:6;:16;;;480:7;471:16;;;;;;;;;;;;;419:75;:::o;218:22::-;;;;;;;;;:::o;246:::-;;;;:::o;500:106::-;535:7;;;582:16;;;;;;;;;;;;;;535:64;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:7;;;;;;;:14;;:7;;;;582:16;535:64;;;;;;;582:16;535:7;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;535:64:4;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;535:64:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;535:64:4;;;;500:106::o;333:80::-;388:7;:18;;;;;;;;;;;;;;;;;;333:80::o;766:743::-;1164:23;1256:29;1353:25;816:1;806:7;;:11;802:48;;;833:7;;802:48;860:7;:9;;;;;;:7;884:6;;;;:23;;;;;;;;;880:623;;;923:7;;;970:16;;;;;;;;;;;;;;923:64;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:7;;;;;;;:14;;:7;;;;970:16;923:64;;;;;;;970:16;923:7;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;923:64:4;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;923:64:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;923:64:4;;;;880:623;;;1018:20;1008:6;;;;:30;;;;;;;;;1004:499;;;1054:7;;;:43;;;;;;1086:10;1054:43;;;;;;:7;;;;;;;:31;;:43;;;;;;;;;;:7;;:43;;;5:2:-1;;;;30:1;27;20:12;1004:499:4;1128:20;1118:6;;;;:30;;;;;;;;;1114:389;;;1190:16;;;1204:1;1190:16;;;;;;;;;;;;;;;;105:10:-1;1190:16:4;88:34:-1;136:17;;-1:-1;1190:16:4;1164:42;;1240:1;1220:6;1227:1;1220:9;;;;;;;;;;:22;;;;;:9;;;;;;;;;;:22;1288:16;;;1302:1;1288:16;;;;;;;;;;;;;;1220:9;105:10:-1;1288:16:4;88:34:-1;136:17;;-1:-1;1288:16:4;1256:48;;1336:3;1318:12;1331:1;1318:15;;;;;;;;;;;;;;;;;;:21;1381:16;;;1395:1;1381:16;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;1381:16:4;1353:44;;1425:4;1411:8;1420:1;1411:11;;;;;;;;;;;;;;;;;:18;;;;;1443:7;;;;;;;;;;;:27;;;1471:6;1479:12;1443:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;1443:49:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;1443:49:4;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1443:49:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1443:49:4;;;;1114:389;766:743;;;:::o;612:148::-;702:7;;;;;;;;;;;:27;;;730:7;739:13;702:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;702:51:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;702:51:4;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;702:51:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;702:51:4;;;;612:148;;:::o", "source": "pragma solidity 0.4.24;\n\nimport \"../../Payroll.sol\";\nimport \"@aragon/os/contracts/lib/token/ERC20.sol\";\nimport \"@aragon/os/contracts/lib/math/SafeMath.sol\";\n\n\ncontract MaliciousEmployee {\n Action public action;\n Payroll public payroll;\n uint256 public counter;\n\n enum Action { Payday, ChangeAddress, SetAllocation }\n\n function setPayroll(Payroll _payroll) public {\n payroll = _payroll;\n }\n\n function setAction(Action _action) public {\n action = _action;\n }\n\n function payday() public {\n payroll.payday(Payroll.PaymentType.Payroll, 0, new uint256[](0));\n }\n\n function determineAllocation(address[] _tokens, uint256[] _distribution) public {\n payroll.determineAllocation(_tokens, _distribution);\n }\n\n function reenter() public {\n if (counter > 0) {\n return;\n }\n\n counter++;\n\n if (action == Action.Payday) {\n payroll.payday(Payroll.PaymentType.Payroll, 0, new uint256[](0));\n } else if (action == Action.ChangeAddress) {\n payroll.changeAddressByEmployee(msg.sender);\n } else if (action == Action.SetAllocation) {\n address[] memory tokens = new address[](1);\n tokens[0] = address(0);\n uint256[] memory distribution = new uint256[](1);\n distribution[0] = 100;\n uint256[] memory minRates = new uint256[](1);\n minRates[0] = 1e18;\n payroll.determineAllocation(tokens, distribution);\n }\n }\n}\n\n\ncontract MaliciousERC20 is ERC20 {\n using SafeMath for uint256;\n\n MaliciousEmployee public employee;\n uint256 private totalSupply_;\n mapping (address => uint256) private balances;\n mapping (address => mapping (address => uint256)) private allowed;\n\n event Approval(address indexed owner, address indexed spender, uint256 value);\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n constructor (MaliciousEmployee _employee, uint256 initialBalance) public {\n employee = _employee;\n totalSupply_ = initialBalance;\n balances[msg.sender] = initialBalance;\n }\n\n function totalSupply() public view returns (uint256) { return totalSupply_; }\n\n function balanceOf(address _owner) public view returns (uint256) { return balances[_owner]; }\n\n function allowance(address _owner, address _spender) public view returns (uint256) { return allowed[_owner][_spender]; }\n\n function approve(address _spender, uint256 _value) public returns (bool) {\n require(allowed[msg.sender][_spender] == 0);\n allowed[msg.sender][_spender] = _value;\n emit Approval(msg.sender, _spender, _value);\n return true;\n }\n\n function transfer(address _to, uint256 _value) public returns (bool) {\n require(_value <= balances[msg.sender]);\n require(_to != address(0));\n\n balances[msg.sender] = balances[msg.sender].sub(_value);\n balances[_to] = balances[_to].add(_value);\n emit Transfer(msg.sender, _to, _value);\n\n employee.reenter();\n return true;\n }\n\n function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {\n require(_value <= balances[_from]);\n require(_value <= allowed[_from][msg.sender]);\n require(_to != address(0));\n\n balances[_from] = balances[_from].sub(_value);\n balances[_to] = balances[_to].add(_value);\n allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);\n emit Transfer(_from, _to, _value);\n\n return true;\n }\n}\n", "sourcePath": "/Users/facu/Documents/work/aragon/dev/aragon-apps/future-apps/payroll/contracts/test/mocks/MaliciousEmployee.sol", "ast": { "absolutePath": "/Users/facu/Documents/work/aragon/dev/aragon-apps/future-apps/payroll/contracts/test/mocks/MaliciousEmployee.sol", "exportedSymbols": { "MaliciousERC20": [ 3369 ], "MaliciousEmployee": [ 3084 ] }, "id": 3370, "nodeType": "SourceUnit", "nodes": [ { "id": 2906, "literals": [ "solidity", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:23:4" }, { "absolutePath": "/Users/facu/Documents/work/aragon/dev/aragon-apps/future-apps/payroll/contracts/Payroll.sol", "file": "../../Payroll.sol", "id": 2907, "nodeType": "ImportDirective", "scope": 3370, "sourceUnit": 1985, "src": "25:27:4", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/lib/token/ERC20.sol", "file": "@aragon/os/contracts/lib/token/ERC20.sol", "id": 2908, "nodeType": "ImportDirective", "scope": 3370, "sourceUnit": 14295, "src": "53:50:4", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/lib/math/SafeMath.sol", "file": "@aragon/os/contracts/lib/math/SafeMath.sol", "id": 2909, "nodeType": "ImportDirective", "scope": 3370, "sourceUnit": 14065, "src": "104:52:4", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 3084, "linearizedBaseContracts": [ 3084 ], "name": "MaliciousEmployee", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 2911, "name": "action", "nodeType": "VariableDeclaration", "scope": 3084, "src": "192:20:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_enum$_Action_$2919", "typeString": "enum MaliciousEmployee.Action" }, "typeName": { "contractScope": null, "id": 2910, "name": "Action", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 2919, "src": "192:6:4", "typeDescriptions": { "typeIdentifier": "t_enum$_Action_$2919", "typeString": "enum MaliciousEmployee.Action" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 2913, "name": "payroll", "nodeType": "VariableDeclaration", "scope": 3084, "src": "218:22:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" }, "typeName": { "contractScope": null, "id": 2912, "name": "Payroll", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1984, "src": "218:7:4", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 2915, "name": "counter", "nodeType": "VariableDeclaration", "scope": 3084, "src": "246:22:4", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2914, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "246:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "canonicalName": "MaliciousEmployee.Action", "id": 2919, "members": [ { "id": 2916, "name": "Payday", "nodeType": "EnumValue", "src": "289:6:4" }, { "id": 2917, "name": "ChangeAddress", "nodeType": "EnumValue", "src": "297:13:4" }, { "id": 2918, "name": "SetAllocation", "nodeType": "EnumValue", "src": "312:13:4" } ], "name": "Action", "nodeType": "EnumDefinition", "src": "275:52:4" }, { "body": { "id": 2928, "nodeType": "Block", "src": "378:35:4", "statements": [ { "expression": { "argumentTypes": null, "id": 2926, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2924, "name": "payroll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2913, "src": "388:7:4", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 2925, "name": "_payroll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2921, "src": "398:8:4", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" } }, "src": "388:18:4", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" } }, "id": 2927, "nodeType": "ExpressionStatement", "src": "388:18:4" } ] }, "documentation": null, "id": 2929, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "setPayroll", "nodeType": "FunctionDefinition", "parameters": { "id": 2922, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2921, "name": "_payroll", "nodeType": "VariableDeclaration", "scope": 2929, "src": "353:16:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" }, "typeName": { "contractScope": null, "id": 2920, "name": "Payroll", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 1984, "src": "353:7:4", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" } }, "value": null, "visibility": "internal" } ], "src": "352:18:4" }, "payable": false, "returnParameters": { "id": 2923, "nodeType": "ParameterList", "parameters": [], "src": "378:0:4" }, "scope": 3084, "src": "333:80:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 2938, "nodeType": "Block", "src": "461:33:4", "statements": [ { "expression": { "argumentTypes": null, "id": 2936, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2934, "name": "action", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2911, "src": "471:6:4", "typeDescriptions": { "typeIdentifier": "t_enum$_Action_$2919", "typeString": "enum MaliciousEmployee.Action" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 2935, "name": "_action", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2931, "src": "480:7:4", "typeDescriptions": { "typeIdentifier": "t_enum$_Action_$2919", "typeString": "enum MaliciousEmployee.Action" } }, "src": "471:16:4", "typeDescriptions": { "typeIdentifier": "t_enum$_Action_$2919", "typeString": "enum MaliciousEmployee.Action" } }, "id": 2937, "nodeType": "ExpressionStatement", "src": "471:16:4" } ] }, "documentation": null, "id": 2939, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "setAction", "nodeType": "FunctionDefinition", "parameters": { "id": 2932, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2931, "name": "_action", "nodeType": "VariableDeclaration", "scope": 2939, "src": "438:14:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_enum$_Action_$2919", "typeString": "enum MaliciousEmployee.Action" }, "typeName": { "contractScope": null, "id": 2930, "name": "Action", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 2919, "src": "438:6:4", "typeDescriptions": { "typeIdentifier": "t_enum$_Action_$2919", "typeString": "enum MaliciousEmployee.Action" } }, "value": null, "visibility": "internal" } ], "src": "437:16:4" }, "payable": false, "returnParameters": { "id": 2933, "nodeType": "ParameterList", "parameters": [], "src": "461:0:4" }, "scope": 3084, "src": "419:75:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 2956, "nodeType": "Block", "src": "525:81:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 2945, "name": "Payroll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 1984, "src": "550:7:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Payroll_$1984_$", "typeString": "type(contract Payroll)" } }, "id": 2946, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "PaymentType", "nodeType": "MemberAccess", "referencedDeclaration": 134, "src": "550:19:4", "typeDescriptions": { "typeIdentifier": "t_type$_t_enum$_PaymentType_$134_$", "typeString": "type(enum Payroll.PaymentType)" } }, "id": 2947, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "memberName": "Payroll", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "550:27:4", "typeDescriptions": { "typeIdentifier": "t_enum$_PaymentType_$134", "typeString": "enum Payroll.PaymentType" } }, { "argumentTypes": null, "hexValue": "30", "id": 2948, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "579:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 2952, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "596:1:4", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 2951, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "582:13:4", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_$", "typeString": "function (uint256) pure returns (uint256[] memory)" }, "typeName": { "baseType": { "id": 2949, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "586:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2950, "length": null, "nodeType": "ArrayTypeName", "src": "586:9:4", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } } }, "id": 2953, "isConstant": false, "isLValue": false, "isPure": true, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "582:16:4", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_enum$_PaymentType_$134", "typeString": "enum Payroll.PaymentType" }, { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, { "typeIdentifier": "t_array$_t_uint256_$dyn_memory", "typeString": "uint256[] memory" } ], "expression": { "argumentTypes": null, "id": 2942, "name": "payroll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2913, "src": "535:7:4", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" } }, "id": 2944, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "payday", "nodeType": "MemberAccess", "referencedDeclaration": 884, "src": "535:14:4", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_enum$_PaymentType_$134_$_t_uint256_$_t_array$_t_uint256_$dyn_memory_ptr_$returns$__$", "typeString": "function (enum Payroll.PaymentType,uint256,uint256[] memory) external" } }, "id": 2954, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "535:64:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 2955, "nodeType": "ExpressionStatement", "src": "535:64:4" } ] }, "documentation": null, "id": 2957, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "payday", "nodeType": "FunctionDefinition", "parameters": { "id": 2940, "nodeType": "ParameterList", "parameters": [], "src": "515:2:4" }, "payable": false, "returnParameters": { "id": 2941, "nodeType": "ParameterList", "parameters": [], "src": "525:0:4" }, "scope": 3084, "src": "500:106:4", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 2973, "nodeType": "Block", "src": "692:68:4", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 2969, "name": "_tokens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2960, "src": "730:7:4", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", "typeString": "address[] memory" } }, { "argumentTypes": null, "id": 2970, "name": "_distribution", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2963, "src": "739:13:4", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", "typeString": "address[] memory" }, { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[] memory" } ], "expression": { "argumentTypes": null, "id": 2966, "name": "payroll", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2913, "src": "702:7:4", "typeDescriptions": { "typeIdentifier": "t_contract$_Payroll_$1984", "typeString": "contract Payroll" } }, "id": 2968, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "determineAllocation", "nodeType": "MemberAccess", "referencedDeclaration": 737, "src": "702:27:4", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_array$_t_address_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$returns$__$", "typeString": "function (address[] memory,uint256[] memory) external" } }, "id": 2971, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "702:51:4", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 2972, "nodeType": "ExpressionStatement", "src": "702:51:4" } ] }, "documentation": null, "id": 2974, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "determineAllocation", "nodeType": "FunctionDefinition", "parameters": { "id": 2964, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2960, "name": "_tokens", "nodeType": "VariableDeclaration", "scope": 2974, "src": "641:17:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", "typeString": "address[]" }, "typeName": { "baseType": { "id": 2958, "name": "address", "nodeType": "ElementaryTypeName", "src": "641:7:4", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "id": 2959, "length": null, "nodeType": "ArrayTypeName", "src": "641:9:4", "typeDescriptions": { "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", "typeString": "address[]" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2963, "name": "_distribution", "nodeType": "VariableDeclaration", "scope": 2974, "src": "660:23:4", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 2961, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "660:7:4", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 2962, "length": null, "nodeType": "ArrayTypeName", "src": "660:9:4", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal"