UNPKG

@aragon/apps-payroll

Version:

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

1,016 lines (1,015 loc) 522 kB
{ "contractName": "MaliciousERC20", "abi": [ { "constant": true, "inputs": [], "name": "employee", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_employee", "type": "address" }, { "name": "initialBalance", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "owner", "type": "address" }, { "indexed": true, "name": "spender", "type": "address" }, { "indexed": false, "name": "value", "type": "uint256" } ], "name": "Approval", "type": "event" }, { "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": true, "inputs": [], "name": "totalSupply", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_owner", "type": "address" } ], "name": "balanceOf", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "_owner", "type": "address" }, { "name": "_spender", "type": "address" } ], "name": "allowance", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "name": "_spender", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "approve", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "transfer", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_from", "type": "address" }, { "name": "_to", "type": "address" }, { "name": "_value", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b506040516040806108af833981016040908152815160209283015160008054600160a060020a03909316600160a060020a03199093169290921782556001819055338252600290935220556108458061006a6000396000f3006080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461008757806318160ddd146100cc57806323b872dd146100f357806370a082311461012a578063a0a1a7d714610158578063a9059cbb14610196578063dd62ed3e146101c7575b600080fd5b34801561009357600080fd5b506100b873ffffffffffffffffffffffffffffffffffffffff600435166024356101fb565b604080519115158252519081900360200190f35b3480156100d857600080fd5b506100e16102aa565b60408051918252519081900360200190f35b3480156100ff57600080fd5b506100b873ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356102b0565b34801561013657600080fd5b506100e173ffffffffffffffffffffffffffffffffffffffff60043516610482565b34801561016457600080fd5b5061016d6104aa565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101a257600080fd5b506100b873ffffffffffffffffffffffffffffffffffffffff600435166024356104c6565b3480156101d357600080fd5b506100e173ffffffffffffffffffffffffffffffffffffffff6004358116906024351661064d565b33600090815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091528120541561023657600080fd5b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60015490565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600260205260408120548211156102e257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260036020908152604080832033845290915290205482111561031f57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316151561034157600080fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040902054610377908363ffffffff61068516565b73ffffffffffffffffffffffffffffffffffffffff80861660009081526002602052604080822093909355908516815220546103b9908363ffffffff61076c16565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260026020908152604080832094909455918716815260038252828120338252909152205461040a908363ffffffff61068516565b73ffffffffffffffffffffffffffffffffffffffff808616600081815260036020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b336000908152600260205260408120548211156104e257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316151561050457600080fd5b33600090815260026020526040902054610524908363ffffffff61068516565b336000908152600260205260408082209290925573ffffffffffffffffffffffffffffffffffffffff851681522054610563908363ffffffff61076c16565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600260209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a360008054604080517fa0fe97e3000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9092169263a0fe97e39260048084019382900301818387803b15801561062c57600080fd5b505af1158015610640573d6000803e3d6000fd5b5060019695505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020908152604080832093909416825291909152205490565b60408051808201909152601281527f4d4154485f5355425f554e444552464c4f5700000000000000000000000000006020820152600090819084841115610764576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610729578181015183820152602001610711565b50505050905090810190601f1680156107565780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60408051808201909152601181527f4d4154485f4144445f4f564552464c4f5700000000000000000000000000000060208201526000908383019084821015610811576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252838181518152602001915080519060200190808383600083811015610729578181015183820152602001610711565b5093925050505600a165627a7a723058207c5dda85bfaef36a816a3e6ac1340606a47545fe96a3b3ebe5ebe32a90ee614b0029", "deployedBytecode": "0x6080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663095ea7b3811461008757806318160ddd146100cc57806323b872dd146100f357806370a082311461012a578063a0a1a7d714610158578063a9059cbb14610196578063dd62ed3e146101c7575b600080fd5b34801561009357600080fd5b506100b873ffffffffffffffffffffffffffffffffffffffff600435166024356101fb565b604080519115158252519081900360200190f35b3480156100d857600080fd5b506100e16102aa565b60408051918252519081900360200190f35b3480156100ff57600080fd5b506100b873ffffffffffffffffffffffffffffffffffffffff600435811690602435166044356102b0565b34801561013657600080fd5b506100e173ffffffffffffffffffffffffffffffffffffffff60043516610482565b34801561016457600080fd5b5061016d6104aa565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101a257600080fd5b506100b873ffffffffffffffffffffffffffffffffffffffff600435166024356104c6565b3480156101d357600080fd5b506100e173ffffffffffffffffffffffffffffffffffffffff6004358116906024351661064d565b33600090815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff861684529091528120541561023657600080fd5b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60015490565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600260205260408120548211156102e257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260036020908152604080832033845290915290205482111561031f57600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316151561034157600080fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260026020526040902054610377908363ffffffff61068516565b73ffffffffffffffffffffffffffffffffffffffff80861660009081526002602052604080822093909355908516815220546103b9908363ffffffff61076c16565b73ffffffffffffffffffffffffffffffffffffffff808516600090815260026020908152604080832094909455918716815260038252828120338252909152205461040a908363ffffffff61068516565b73ffffffffffffffffffffffffffffffffffffffff808616600081815260036020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b336000908152600260205260408120548211156104e257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8316151561050457600080fd5b33600090815260026020526040902054610524908363ffffffff61068516565b336000908152600260205260408082209290925573ffffffffffffffffffffffffffffffffffffffff851681522054610563908363ffffffff61076c16565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600260209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a360008054604080517fa0fe97e3000000000000000000000000000000000000000000000000000000008152905173ffffffffffffffffffffffffffffffffffffffff9092169263a0fe97e39260048084019382900301818387803b15801561062c57600080fd5b505af1158015610640573d6000803e3d6000fd5b5060019695505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020908152604080832093909416825291909152205490565b60408051808201909152601281527f4d4154485f5355425f554e444552464c4f5700000000000000000000000000006020820152600090819084841115610764576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610729578181015183820152602001610711565b50505050905090810190601f1680156107565780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60408051808201909152601181527f4d4154485f4144445f4f564552464c4f5700000000000000000000000000000060208201526000908383019084821015610811576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252838181518152602001915080519060200190808383600083811015610729578181015183820152602001610711565b5093925050505600a165627a7a723058207c5dda85bfaef36a816a3e6ac1340606a47545fe96a3b3ebe5ebe32a90ee614b0029", "sourceMap": "1514:2063:4:-;;;1943:196;8:9:-1;5:2;;;30:1;27;20:12;5:2;1943:196:4;;;;;;;;;;;;;;;;;;;;;2026:8;:20;;-1:-1:-1;;;;;2026:20:4;;;-1:-1:-1;;;;;;2026:20:4;;;;;;;;;;2056:29;;;2104:10;2095:20;;:8;:20;;;;:37;1514:2063;;;;;;", "deployedSourceMap": "1514:2063:4:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2453:255;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2453:255:4;;;;;;;;;;;;;;;;;;;;;;;;;;;2145:77;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2145:77:4;;;;;;;;;;;;;;;;;;;;3096:479;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3096:479:4;;;;;;;;;;;;;;2228:93;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2228:93:4;;;;;;;1586:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1586:33:4;;;;;;;;;;;;;;;;;;;;;;;2714:376;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2714:376:4;;;;;;;;;2327:120;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2327:120:4;;;;;;;;;;;;2453:255;2552:10;2520:4;2544:19;;;:7;:19;;;;;;;;;:29;;;;;;;;;;:34;2536:43;;;;;;2597:10;2589:19;;;;:7;:19;;;;;;;;;:29;;;;;;;;;;;;:38;;;2642;;;;;;;2589:29;;2597:10;2642:38;;;;;;;;;;;-1:-1:-1;2697:4:4;2453:255;;;;:::o;2145:77::-;2207:12;;2145:77;:::o;3096:479::-;3212:15;;;3178:4;3212:15;;;:8;:15;;;;;;3202:25;;;3194:34;;;;;;3256:14;;;;;;;:7;:14;;;;;;;;3271:10;3256:26;;;;;;;;3246:36;;;3238:45;;;;;;3301:17;;;;;3293:26;;;;;;3348:15;;;;;;;:8;:15;;;;;;:27;;3368:6;3348:27;:19;:27;:::i;:::-;3330:15;;;;;;;;:8;:15;;;;;;:45;;;;3401:13;;;;;;;:25;;3419:6;3401:25;:17;:25;:::i;:::-;3385:13;;;;;;;;:8;:13;;;;;;;;:41;;;;3465:14;;;;;:7;:14;;;;;3480:10;3465:26;;;;;;;:38;;3496:6;3465:38;:30;:38;:::i;:::-;3436:14;;;;;;;;:7;:14;;;;;;;;3451:10;3436:26;;;;;;;;:67;;;;3518:28;;;;;;;;;;;3436:14;;3518:28;;;;;;;;;;;-1:-1:-1;3564:4:4;3096:479;;;;;:::o;2228:93::-;2302:16;;2284:7;2302:16;;;:8;:16;;;;;;;2228:93::o;1586:33::-;;;;;;:::o;2714:376::-;2820:10;2777:4;2811:20;;;:8;:20;;;;;;2801:30;;;2793:39;;;;;;2850:17;;;;;2842:26;;;;;;2911:10;2902:20;;;;:8;:20;;;;;;:32;;2927:6;2902:32;:24;:32;:::i;:::-;2888:10;2879:20;;;;:8;:20;;;;;;:55;;;;:20;2960:13;;;;;;:25;;2978:6;2960:25;:17;:25;:::i;:::-;2944:13;;;;;;;:8;:13;;;;;;;;;:41;;;;3000:33;;;;;;;2944:13;;3009:10;;3000:33;;;;;;;;;;3044:8;;;:18;;;;;;;;:8;;;;;:16;;:18;;;;;;;;;;:8;;:18;;;5:2:-1;;;;30:1;27;20:12;5:2;3044:18:4;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;3079:4:4;;2714:376;-1:-1:-1;;;;;;2714:376:4:o;2327:120::-;2419:15;;;;2401:7;2419:15;;;:7;:15;;;;;;;;:25;;;;;;;;;;;;;2327:120::o;1685:172:59:-;1782:19;;;;;;;;;;;;;;;;;1745:7;;;;1772:8;;;;1764:38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;1764:38:59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;1824:7:59;;;1685:172::o;1928:170::-;2053:18;;;;;;;;;;;;;;;;;1988:7;;2019;;;;2044;;;;2036:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;2036:36:59;-1:-1:-1;2090:1:59;1928:170;-1:-1:-1;;;1928:170:59: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" } },