diff --git a/Lesson-3/README.md b/Lesson-3/README.md new file mode 100644 index 0000000..ba26ced --- /dev/null +++ b/Lesson-3/README.md @@ -0,0 +1,16 @@ +## 硅谷live以太坊智能合约频道官方地址 + +### 第三课《智能合约后端优化和产品化》 + +目录结构 +
| +
|--orgin 课程初始代码 +
| +
|--assignment 课程作业提交代码 +
+### 本节知识点 +第3课:智能合约后端优化和产品化 +- 如何通过数据结构优化降低合约执行成本 +- 合约的继承 +- 巧用modifier +- 以太坊函数库的使用和基本介绍 diff --git a/Lesson-3/assignment/C3 Linearization.sol b/Lesson-3/assignment/C3 Linearization.sol new file mode 100644 index 0000000..72cfc74 --- /dev/null +++ b/Lesson-3/assignment/C3 Linearization.sol @@ -0,0 +1,25 @@ +contract O +contract A is O +contract B is O +contract C is O +contract K1 is A, B +contract K2 is A, C +contract Z is K1, K2 + +https://en.wikipedia.org/wiki/C3_linearization +https://blog.tedxiong.com/C3_Linearization.html + +solidity的继承链是靠右的更近,这点和python不一样 + +L[O] = [O] +L[A] = [A,O] +L[B] = [B,O] +L[C] = [C,O] +L[k1] = [K1]+merge(L[B],L[A],[B,A]) // merge规则:按照继承顺序加入merge,最后再加一个所有父类顺序添加的序列 + = [K1]+merge([B,O],[A,O],[B,A]) // 规则:取一个元素(它是其他序列中的第一个元素,或不在其他序列出现,如果有多个元素符合,选前面一个)加到最前序列后面 + = [K1,B]+merge([O],[A,O],[A]) + = [K1,B,A,O] +L[K2] = [k2,C,A,O] +L[Z] = [Z] + merge(L[K2],L[K1],[K2,K1]) + = [Z] + merge([K2,C,A,O],[k1,B,A,O],[K2,K1]) + = [Z,K2,C,K1,B,A,O] diff --git a/Lesson-3/assignment/README.md b/Lesson-3/assignment/README.md new file mode 100644 index 0000000..01011eb --- /dev/null +++ b/Lesson-3/assignment/README.md @@ -0,0 +1,14 @@ +## 硅谷live以太坊智能合约 第三课作业 +这里是同学提交作业的目录 + +### 第三课:课后作业 +- 第一题:完成今天所开发的合约产品化内容,使用Remix调用每一个函数,提交函数调用截图 +- 第二题:增加 changePaymentAddress 函数,更改员工的薪水支付地址,思考一下能否使用modifier整合某个功能 +- 第三题(加分题):自学C3 Linearization, 求以下 contract Z 的继承线 +- contract O +- contract A is O +- contract B is O +- contract C is O +- contract K1 is A, B +- contract K2 is A, C +- contract Z is K1, K2 diff --git a/Lesson-3/assignment/WX20180321-162512@2x.png b/Lesson-3/assignment/WX20180321-162512@2x.png new file mode 100644 index 0000000..3ea328d Binary files /dev/null and b/Lesson-3/assignment/WX20180321-162512@2x.png differ diff --git a/Lesson-3/assignment/WX20180321-162543@2x.png b/Lesson-3/assignment/WX20180321-162543@2x.png new file mode 100644 index 0000000..2e71397 Binary files /dev/null and b/Lesson-3/assignment/WX20180321-162543@2x.png differ diff --git a/Lesson-3/assignment/payroll.sol b/Lesson-3/assignment/payroll.sol new file mode 100644 index 0000000..31492b9 --- /dev/null +++ b/Lesson-3/assignment/payroll.sol @@ -0,0 +1,89 @@ +pragma solidity ^0.4.14; +import './SafeMath.sol'; +import './Ownable.sol'; + +contract Payroll is Ownable{ + + using SafeMath for uint; + + struct Employee{ + address employeeAddress; + uint salary; + uint lastPayday; + } + mapping(address => Employee) public employeeMapping; + uint constant payDuration = 30 seconds; + address ownerAddress; + uint totalSalary = 0; + + + modifier employeeExist(address addr){ + var employee = employeeMapping[addr]; + require(employee.employeeAddress != 0x0); + _; + } + + function _partialPay(Employee emp) private{ + uint totalSalary = emp.salary.mul(now.sub(emp.lastPayday)).div(payDuration); + + emp.employeeAddress.transfer(totalSalary); + } + + function addEmployee(address addr,uint sal) onlyOwner { + + uint oneSalary = sal.mul(1 ether); + totalSalary = totalSalary.add(oneSalary); + employeeMapping[addr] = Employee(addr,oneSalary,now); + } + function removeEmployee(address addr) onlyOwner employeeExist(addr){ + var employee = employeeMapping[addr]; + totalSalary = totalSalary.sub(employee.salary); + _partialPay(employee); + delete(employeeMapping[addr]); + + } + function updateEmployee(address oldAddress,address newAddresss,uint sal) onlyOwner employeeExist(oldAddress){ + + var employee = employeeMapping[oldAddress]; + uint oneSalary = sal.mul(1 ether); + totalSalary = totalSalary.sub(employee.salary).add(oneSalary); + employee.employeeAddress = newAddresss; + employee.salary = oneSalary; + + } + function changePaymentAddress(address oldAddress,address newAddresss) onlyOwner employeeExist(oldAddress){ + var employee = employeeMapping[oldAddress]; + employee.employeeAddress = newAddresss; + } + + + function calculateRunway() view returns(uint){ + + uint selfbalance = getAddressBalance(this); + return selfbalance.div(totalSalary); + } + function hasEnoughFund() returns(bool){ + return calculateRunway() > 0; + } + + function addFund() payable returns(uint){ + + return this.balance; + } + + + function getPaid() employeeExist(msg.sender) { + var employee = employeeMapping[msg.sender]; + uint intervalTime = now.sub(employee.lastPayday); + require(intervalTime >= payDuration); + + uint times = intervalTime.div(payDuration); + employee.lastPayday = employee.lastPayday.add(times.mul(payDuration)); + employee.employeeAddress.transfer(employee.salary.mul(times)); + } + + function getAddressBalance(address addr) public view returns(uint){ + return addr.balance; + } + +} diff --git a/Lesson-3/orgin/README.md b/Lesson-3/orgin/README.md new file mode 100644 index 0000000..6106ea1 --- /dev/null +++ b/Lesson-3/orgin/README.md @@ -0,0 +1,3 @@ +## 硅谷live以太坊智能合约 第三课 + +这里是每一课的初始代码,有需要的同学可以参考 diff --git a/Lesson-3/orgin/payroll.sol b/Lesson-3/orgin/payroll.sol new file mode 100644 index 0000000..e69de29 diff --git a/Lesson-4/README.md b/Lesson-4/README.md new file mode 100644 index 0000000..34bf0bb --- /dev/null +++ b/Lesson-4/README.md @@ -0,0 +1,16 @@ +## 硅谷live以太坊智能合约频道官方地址 + +### 第四课《使用Truffle架构进行前后端交互,测试,部署》 + +目录结构 +
| +
|--orgin 课程初始代码 +
| +
|--assignment 课程作业提交代码 +
+### 本节知识点 +第4课:使用Truffle架构进行前后端交互,测试,部署 +- 为什么要用Truffle,Truffle的基本概念 +- Truffle 的command line 功能 +- 初始化项目与Truffle项目目录结构 +- 编译部署合约到testrpc diff --git a/Lesson-4/assignment/Migrations.json b/Lesson-4/assignment/Migrations.json new file mode 100644 index 0000000..6406cc4 --- /dev/null +++ b/Lesson-4/assignment/Migrations.json @@ -0,0 +1,1397 @@ +{ + "contractName": "Migrations", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "last_completed_migration", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": false, + "inputs": [ + { + "name": "completed", + "type": "uint256" + } + ], + "name": "setCompleted", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "new_address", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a7230582003af56c2b5a5f91850c0ee3845b75eb37f599b4d67190adb252ed5b1502191d80029", + "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a7230582003af56c2b5a5f91850c0ee3845b75eb37f599b4d67190adb252ed5b1502191d80029", + "sourceMap": "25:488:0:-;;;177:58;;;;;;;;220:10;212:5;;:18;;;;;;;;;;;;;;;;;;25:488;;;;;;", + "deployedSourceMap": "25:488:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;346:165;;;;;;;;;;;;;;;;;;;;;;;;;;;;73:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;239:103;;;;;;;;;;;;;;;;;;;;;;;;;;346:165;408:19;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;441:11;408:45;;459:8;:21;;;481:24;;459:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;142:26;346:165;;:::o;73:36::-;;;;:::o;49:20::-;;;;;;;;;;;;;:::o;239:103::-;160:5;;;;;;;;;;;146:19;;:10;:19;;;142:26;;;328:9;301:24;:36;;;;142:26;239:103;:::o", + "source": "pragma solidity ^0.4.2;\n\ncontract Migrations {\n address public owner;\n uint public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n function Migrations() 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", + "sourcePath": "/home/juicebox/payroll/contracts/Migrations.sol", + "ast": { + "absolutePath": "/home/juicebox/payroll/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 56 + ] + }, + "id": 57, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.4", + ".2" + ], + "nodeType": "PragmaDirective", + "src": "0:23:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 56, + "linearizedBaseContracts": [ + 56 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 3, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "49:20:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "49:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 5, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "73:36:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "73:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 13, + "nodeType": "Block", + "src": "136:37:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 7, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 91, + "src": "146:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "146:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 9, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "160:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "146:19:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 12, + "nodeType": "IfStatement", + "src": "142:26:0", + "trueBody": { + "id": 11, + "nodeType": "PlaceholderStatement", + "src": "167:1:0" + } + } + ] + }, + "id": 14, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 6, + "nodeType": "ParameterList", + "parameters": [], + "src": "133:2:0" + }, + "src": "114:59:0", + "visibility": "internal" + }, + { + "body": { + "id": 22, + "nodeType": "Block", + "src": "206:29:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 20, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 17, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "212:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 18, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 91, + "src": "220:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "220:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "212:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 21, + "nodeType": "ExpressionStatement", + "src": "212:18:0" + } + ] + }, + "id": 23, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "Migrations", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 15, + "nodeType": "ParameterList", + "parameters": [], + "src": "196:2:0" + }, + "payable": false, + "returnParameters": { + "id": 16, + "nodeType": "ParameterList", + "parameters": [], + "src": "206:0:0" + }, + "scope": 56, + "src": "177:58:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 34, + "nodeType": "Block", + "src": "295:47:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 32, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 30, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "301:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 31, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25, + "src": "328:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "301:36:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 33, + "nodeType": "ExpressionStatement", + "src": "301:36:0" + } + ] + }, + "id": 35, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 28, + "modifierName": { + "argumentTypes": null, + "id": 27, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "284:10:0", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "284:10:0" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 26, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 25, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 35, + "src": "261:14:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 24, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "261:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "260:16:0" + }, + "payable": false, + "returnParameters": { + "id": 29, + "nodeType": "ParameterList", + "parameters": [], + "src": "295:0:0" + }, + "scope": 56, + "src": "239:103:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 54, + "nodeType": "Block", + "src": "402:109:0", + "statements": [ + { + "assignments": [ + 43 + ], + "declarations": [ + { + "constant": false, + "id": 43, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "408:19:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$56", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 42, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 56, + "src": "408:10:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$56", + "typeString": "contract Migrations" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 47, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 45, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 37, + "src": "441:11:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 44, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 56, + "src": "430:10:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$56_$", + "typeString": "type(contract Migrations)" + } + }, + "id": 46, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "430:23:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$56", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "408:45:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 51, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "481:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 48, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 43, + "src": "459:8:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$56", + "typeString": "contract Migrations" + } + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 35, + "src": "459:21:0", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "459:47:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 53, + "nodeType": "ExpressionStatement", + "src": "459:47:0" + } + ] + }, + "id": 55, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 40, + "modifierName": { + "argumentTypes": null, + "id": 39, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "391:10:0", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "391:10:0" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 38, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 37, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "363:19:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 36, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "363:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "362:21:0" + }, + "payable": false, + "returnParameters": { + "id": 41, + "nodeType": "ParameterList", + "parameters": [], + "src": "402:0:0" + }, + "scope": 56, + "src": "346:165:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 57, + "src": "25:488:0" + } + ], + "src": "0:514:0" + }, + "legacyAST": { + "absolutePath": "/home/juicebox/payroll/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 56 + ] + }, + "id": 57, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.4", + ".2" + ], + "nodeType": "PragmaDirective", + "src": "0:23:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 56, + "linearizedBaseContracts": [ + 56 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 3, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "49:20:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "49:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 5, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 56, + "src": "73:36:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 4, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "73:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 13, + "nodeType": "Block", + "src": "136:37:0", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 10, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 7, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 91, + "src": "146:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 8, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "146:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 9, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "160:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "146:19:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 12, + "nodeType": "IfStatement", + "src": "142:26:0", + "trueBody": { + "id": 11, + "nodeType": "PlaceholderStatement", + "src": "167:1:0" + } + } + ] + }, + "id": 14, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 6, + "nodeType": "ParameterList", + "parameters": [], + "src": "133:2:0" + }, + "src": "114:59:0", + "visibility": "internal" + }, + { + "body": { + "id": 22, + "nodeType": "Block", + "src": "206:29:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 20, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 17, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "212:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 18, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 91, + "src": "220:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "220:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "212:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 21, + "nodeType": "ExpressionStatement", + "src": "212:18:0" + } + ] + }, + "id": 23, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "Migrations", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 15, + "nodeType": "ParameterList", + "parameters": [], + "src": "196:2:0" + }, + "payable": false, + "returnParameters": { + "id": 16, + "nodeType": "ParameterList", + "parameters": [], + "src": "206:0:0" + }, + "scope": 56, + "src": "177:58:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 34, + "nodeType": "Block", + "src": "295:47:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 32, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 30, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "301:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 31, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 25, + "src": "328:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "301:36:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 33, + "nodeType": "ExpressionStatement", + "src": "301:36:0" + } + ] + }, + "id": 35, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 28, + "modifierName": { + "argumentTypes": null, + "id": 27, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "284:10:0", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "284:10:0" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 26, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 25, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 35, + "src": "261:14:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 24, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "261:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "260:16:0" + }, + "payable": false, + "returnParameters": { + "id": 29, + "nodeType": "ParameterList", + "parameters": [], + "src": "295:0:0" + }, + "scope": 56, + "src": "239:103:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 54, + "nodeType": "Block", + "src": "402:109:0", + "statements": [ + { + "assignments": [ + 43 + ], + "declarations": [ + { + "constant": false, + "id": 43, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "408:19:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$56", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 42, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 56, + "src": "408:10:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$56", + "typeString": "contract Migrations" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 47, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 45, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 37, + "src": "441:11:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 44, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 56, + "src": "430:10:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$56_$", + "typeString": "type(contract Migrations)" + } + }, + "id": 46, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "430:23:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$56", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "408:45:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 51, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 5, + "src": "481:24:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 48, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 43, + "src": "459:8:0", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$56", + "typeString": "contract Migrations" + } + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 35, + "src": "459:21:0", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "459:47:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 53, + "nodeType": "ExpressionStatement", + "src": "459:47:0" + } + ] + }, + "id": 55, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 40, + "modifierName": { + "argumentTypes": null, + "id": 39, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "391:10:0", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "391:10:0" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 38, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 37, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "363:19:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 36, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "363:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "362:21:0" + }, + "payable": false, + "returnParameters": { + "id": 41, + "nodeType": "ParameterList", + "parameters": [], + "src": "402:0:0" + }, + "scope": 56, + "src": "346:165:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 57, + "src": "25:488:0" + } + ], + "src": "0:514:0" + }, + "compiler": { + "name": "solc", + "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" + }, + "networks": { + "1521905214138": { + "events": {}, + "links": {}, + "address": "0x26c34e33a6deec28c963487dcebee3f8c01cb955", + "transactionHash": "0xac9ab32afd53aa3d7e9c002905eaebcba30dd3b03bf9e3245aad913185b53cab" + }, + "1521957897145": { + "events": {}, + "links": {}, + "address": "0x35e138d24b4eb2f22225af4c4570e30785cfb631", + "transactionHash": "0xac9ab32afd53aa3d7e9c002905eaebcba30dd3b03bf9e3245aad913185b53cab" + }, + "1521979547158": { + "events": {}, + "links": {}, + "address": "0xc47574166cffcf9cf959c80deb2887234eed3f72", + "transactionHash": "0xac9ab32afd53aa3d7e9c002905eaebcba30dd3b03bf9e3245aad913185b53cab" + }, + "1521982301817": { + "events": {}, + "links": {}, + "address": "0x3f8b279d141d9c56da2595dcf55a6af8dd892e9b", + "transactionHash": "0xac9ab32afd53aa3d7e9c002905eaebcba30dd3b03bf9e3245aad913185b53cab" + } + }, + "schemaVersion": "2.0.0", + "updatedAt": "2018-03-25T12:51:53.550Z" +} \ No newline at end of file diff --git a/Lesson-4/assignment/Ownable.json b/Lesson-4/assignment/Ownable.json new file mode 100644 index 0000000..7fe3f1d --- /dev/null +++ b/Lesson-4/assignment/Ownable.json @@ -0,0 +1,1446 @@ +{ + "contractName": "Ownable", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102858061005e6000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610051578063f2fde38b146100a6575b600080fd5b341561005c57600080fd5b6100646100df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b157600080fd5b6100dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610104565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561019b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582088030b62140780df87f4e132541114a799812d73abc9be9bc2ad0fd9ce00fb8d0029", + "deployedBytecode": "0x60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610051578063f2fde38b146100a6575b600080fd5b341561005c57600080fd5b6100646100df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b157600080fd5b6100dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610104565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561019b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a7230582088030b62140780df87f4e132541114a799812d73abc9be9bc2ad0fd9ce00fb8d0029", + "sourceMap": "217:787:0:-;;;469:55;;;;;;;;509:10;501:5;;:18;;;;;;;;;;;;;;;;;;217:787;;;;;;", + "deployedSourceMap": "217:787:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;832:169;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20;;;;;;;;;;;;;:::o;832:169::-;653:5;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;928:1;908:22;;:8;:22;;;;900:31;;;;;;;;965:8;937:37;;958:5;;;;;;;;;;;937:37;;;;;;;;;;;;988:8;980:5;;:16;;;;;;;;;;;;;;;;;;832:169;:::o", + "source": "pragma solidity ^0.4.18;\n\n\n/**\n * @title Ownable\n * @dev The Ownable contract has an owner address, and provides basic authorization control\n * functions, this simplifies the implementation of \"user permissions\".\n */\ncontract Ownable {\n address public owner;\n\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n\n /**\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\n * account.\n */\n function Ownable() public {\n owner = msg.sender;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n /**\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\n * @param newOwner The address to transfer ownership to.\n */\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0));\n OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n}\n", + "sourcePath": "/home/juicebox/payroll/contracts/Ownable.sol", + "ast": { + "absolutePath": "/home/juicebox/payroll/contracts/Ownable.sol", + "exportedSymbols": { + "Ownable": [ + 55 + ] + }, + "id": 56, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.4", + ".18" + ], + "nodeType": "PragmaDirective", + "src": "0:24:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": "@title Ownable\n@dev The Ownable contract has an owner address, and provides basic authorization control\nfunctions, this simplifies the implementation of \"user permissions\".", + "fullyImplemented": true, + "id": 55, + "linearizedBaseContracts": [ + 55 + ], + "name": "Ownable", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 3, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "238:20:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "238:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "anonymous": false, + "id": 9, + "name": "OwnershipTransferred", + "nodeType": "EventDefinition", + "parameters": { + "id": 8, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5, + "indexed": true, + "name": "previousOwner", + "nodeType": "VariableDeclaration", + "scope": 9, + "src": "291:29:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "291:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 7, + "indexed": true, + "name": "newOwner", + "nodeType": "VariableDeclaration", + "scope": 9, + "src": "322:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 6, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "322:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "290:57:0" + }, + "src": "264:84:0" + }, + { + "body": { + "id": 17, + "nodeType": "Block", + "src": "495:29:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 15, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 12, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "501:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 13, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 491, + "src": "509:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "509:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "501:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 16, + "nodeType": "ExpressionStatement", + "src": "501:18:0" + } + ] + }, + "id": 18, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "Ownable", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 10, + "nodeType": "ParameterList", + "parameters": [], + "src": "485:2:0" + }, + "payable": false, + "returnParameters": { + "id": 11, + "nodeType": "ParameterList", + "parameters": [], + "src": "495:0:0" + }, + "scope": 55, + "src": "469:55:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 28, + "nodeType": "Block", + "src": "625:46:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 24, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 21, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 491, + "src": "639:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 22, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "639:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 23, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "653:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "639:19:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 20, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 494, + "src": "631:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 25, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "631:28:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 26, + "nodeType": "ExpressionStatement", + "src": "631:28:0" + }, + { + "id": 27, + "nodeType": "PlaceholderStatement", + "src": "665:1:0" + } + ] + }, + "id": 29, + "name": "onlyOwner", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 19, + "nodeType": "ParameterList", + "parameters": [], + "src": "622:2:0" + }, + "src": "604:67:0", + "visibility": "internal" + }, + { + "body": { + "id": 53, + "nodeType": "Block", + "src": "894:107:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 37, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "908:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "30", + "id": 39, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "928:1:0", + "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": 38, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "920:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": "address" + }, + "id": 40, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "920:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "908:22:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 36, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 494, + "src": "900:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 42, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "900:31:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 43, + "nodeType": "ExpressionStatement", + "src": "900:31:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 45, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "958:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 46, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "965:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 44, + "name": "OwnershipTransferred", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "937:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", + "typeString": "function (address,address)" + } + }, + "id": 47, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "937:37:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 48, + "nodeType": "ExpressionStatement", + "src": "937:37:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 49, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "980:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 50, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "988:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "980:16:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 52, + "nodeType": "ExpressionStatement", + "src": "980:16:0" + } + ] + }, + "id": 54, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 34, + "modifierName": { + "argumentTypes": null, + "id": 33, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "884:9:0", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "884:9:0" + } + ], + "name": "transferOwnership", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 32, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 31, + "name": "newOwner", + "nodeType": "VariableDeclaration", + "scope": 54, + "src": "859:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 30, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "859:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "858:18:0" + }, + "payable": false, + "returnParameters": { + "id": 35, + "nodeType": "ParameterList", + "parameters": [], + "src": "894:0:0" + }, + "scope": 55, + "src": "832:169:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 56, + "src": "217:787:0" + } + ], + "src": "0:1005:0" + }, + "legacyAST": { + "absolutePath": "/home/juicebox/payroll/contracts/Ownable.sol", + "exportedSymbols": { + "Ownable": [ + 55 + ] + }, + "id": 56, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.4", + ".18" + ], + "nodeType": "PragmaDirective", + "src": "0:24:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": "@title Ownable\n@dev The Ownable contract has an owner address, and provides basic authorization control\nfunctions, this simplifies the implementation of \"user permissions\".", + "fullyImplemented": true, + "id": 55, + "linearizedBaseContracts": [ + 55 + ], + "name": "Ownable", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 3, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 55, + "src": "238:20:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "238:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "anonymous": false, + "id": 9, + "name": "OwnershipTransferred", + "nodeType": "EventDefinition", + "parameters": { + "id": 8, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 5, + "indexed": true, + "name": "previousOwner", + "nodeType": "VariableDeclaration", + "scope": 9, + "src": "291:29:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 4, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "291:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 7, + "indexed": true, + "name": "newOwner", + "nodeType": "VariableDeclaration", + "scope": 9, + "src": "322:24:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 6, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "322:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "290:57:0" + }, + "src": "264:84:0" + }, + { + "body": { + "id": 17, + "nodeType": "Block", + "src": "495:29:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 15, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 12, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "501:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 13, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 491, + "src": "509:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 14, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "509:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "501:18:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 16, + "nodeType": "ExpressionStatement", + "src": "501:18:0" + } + ] + }, + "id": 18, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "Ownable", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 10, + "nodeType": "ParameterList", + "parameters": [], + "src": "485:2:0" + }, + "payable": false, + "returnParameters": { + "id": 11, + "nodeType": "ParameterList", + "parameters": [], + "src": "495:0:0" + }, + "scope": 55, + "src": "469:55:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 28, + "nodeType": "Block", + "src": "625:46:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 24, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 21, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 491, + "src": "639:3:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 22, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "639:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 23, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "653:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "639:19:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 20, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 494, + "src": "631:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 25, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "631:28:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 26, + "nodeType": "ExpressionStatement", + "src": "631:28:0" + }, + { + "id": 27, + "nodeType": "PlaceholderStatement", + "src": "665:1:0" + } + ] + }, + "id": 29, + "name": "onlyOwner", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 19, + "nodeType": "ParameterList", + "parameters": [], + "src": "622:2:0" + }, + "src": "604:67:0", + "visibility": "internal" + }, + { + "body": { + "id": 53, + "nodeType": "Block", + "src": "894:107:0", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 41, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 37, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "908:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "30", + "id": 39, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "928:1:0", + "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": 38, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "920:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": "address" + }, + "id": 40, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "920:10:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "908:22:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 36, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 494, + "src": "900:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 42, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "900:31:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 43, + "nodeType": "ExpressionStatement", + "src": "900:31:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 45, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "958:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 46, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "965:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 44, + "name": "OwnershipTransferred", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9, + "src": "937:20:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_address_$returns$__$", + "typeString": "function (address,address)" + } + }, + "id": 47, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "937:37:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 48, + "nodeType": "ExpressionStatement", + "src": "937:37:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 49, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3, + "src": "980:5:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 50, + "name": "newOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 31, + "src": "988:8:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "980:16:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 52, + "nodeType": "ExpressionStatement", + "src": "980:16:0" + } + ] + }, + "id": 54, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 34, + "modifierName": { + "argumentTypes": null, + "id": 33, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "884:9:0", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "884:9:0" + } + ], + "name": "transferOwnership", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 32, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 31, + "name": "newOwner", + "nodeType": "VariableDeclaration", + "scope": 54, + "src": "859:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 30, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "859:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "858:18:0" + }, + "payable": false, + "returnParameters": { + "id": 35, + "nodeType": "ParameterList", + "parameters": [], + "src": "894:0:0" + }, + "scope": 55, + "src": "832:169:0", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 56, + "src": "217:787:0" + } + ], + "src": "0:1005:0" + }, + "compiler": { + "name": "solc", + "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" + }, + "networks": { + "1521982301817": { + "events": {}, + "links": {}, + "address": "0xd02a561e01c7abfe949c6ed56cbb3f50d1042cf5", + "transactionHash": "0xd9110b8c98ebd16286a6630c644828680a1536471eb5fcfc9441aa18481e8366" + } + }, + "schemaVersion": "2.0.0", + "updatedAt": "2018-03-25T12:51:53.545Z" +} \ No newline at end of file diff --git a/Lesson-4/assignment/Payroll.js b/Lesson-4/assignment/Payroll.js new file mode 100644 index 0000000..79567c0 --- /dev/null +++ b/Lesson-4/assignment/Payroll.js @@ -0,0 +1,38 @@ + +var Payroll = artifacts.require("./Payroll.sol"); + +contract('Payroll', function(accounts) { + + var payrollInstance; + + it("test add employee", function() { + return Payroll.deployed().then(function(instance) { + payrollInstance = instance; + + return payrollInstance.addEmployee(accounts[1], 2, {from: accounts[0]}); + }).then(function() { + return payrollInstance.employeeMapping(accounts[1]); + + }).then(function(employee) { + assert.equal(employee[0], accounts[1], "address was not stored."); + assert.equal(employee[1], web3.toWei(2), "salary was not right."); + + }); + }); + + it("remove employee", function() { + return Payroll.deployed().then(function(instance) { + payrollInstance = instance; + + return payrollInstance.removeEmployee(accounts[1], {from: accounts[0]}); + }).then(function() { + return payrollInstance.employeeMapping(accounts[1]); + + }).then(function(employee) { + assert.equal(employee[0], "0x0000000000000000000000000000000000000000", "address was not removed."); + assert.notEqual(employee[1], web3.toWei(2), "salary was not removed."); + + }); + }); + +}); diff --git a/Lesson-4/assignment/Payroll.json b/Lesson-4/assignment/Payroll.json new file mode 100644 index 0000000..89eb931 --- /dev/null +++ b/Lesson-4/assignment/Payroll.json @@ -0,0 +1,8495 @@ +{ + "contractName": "Payroll", + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "employeeMapping", + "outputs": [ + { + "name": "employeeAddress", + "type": "address" + }, + { + "name": "salary", + "type": "uint256" + }, + { + "name": "lastPayday", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "name": "addr", + "type": "address" + }, + { + "name": "sal", + "type": "uint256" + } + ], + "name": "addEmployee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "name": "removeEmployee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "oldAddress", + "type": "address" + }, + { + "name": "newAddresss", + "type": "address" + }, + { + "name": "sal", + "type": "uint256" + } + ], + "name": "updateEmployee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "oldAddress", + "type": "address" + }, + { + "name": "newAddresss", + "type": "address" + } + ], + "name": "changePaymentAddress", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "calculateRunway", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "hasEnoughFund", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "addFund", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "getPaid", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "addr", + "type": "address" + } + ], + "name": "getAddressBalance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x60606040526000600355336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061101f806100586000396000f3006060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806323fed09e146100bf57806335046722146100ec5780633b6d5b48146101395780634ec19512146101c05780638da5cb5b146101e9578063a2f09dfa1461023e578063bc456c421461025c578063c8cc895d146102b4578063cf41d6f814610315578063d108177a1461032a578063e7fd9a1314610363578063f2fde38b146103a5575b600080fd5b34156100ca57600080fd5b6100d26103de565b604051808215151515815260200191505060405180910390f35b34156100f757600080fd5b610123600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506103ef565b6040518082815260200191505060405180910390f35b341561014457600080fd5b610170600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610410565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390f35b34156101cb57600080fd5b6101d361045a565b6040518082815260200191505060405180910390f35b34156101f457600080fd5b6101fc610483565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102466104a8565b6040518082815260200191505060405180910390f35b341561026757600080fd5b6102b2600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506104c7565b005b34156102bf57600080fd5b610313600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061063d565b005b341561032057600080fd5b61032861080d565b005b341561033557600080fd5b610361600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109d3565b005b341561036e57600080fd5b6103a3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c1c565b005b34156103b057600080fd5b6103dc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d85565b005b6000806103e961045a565b11905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b60016020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154905083565b600080610466306103ef565b905061047d60035482610eda90919063ffffffff16565b91505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561052457600080fd5b826000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156105b257600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250838360000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561069b57600080fd5b846000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561072957600080fd5b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209350610785670de0b6b3a764000086610ef590919063ffffffff16565b92506107b2836107a48660010154600354610f3090919063ffffffff16565b610f4990919063ffffffff16565b600381905550858460000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082846001018190555050505050505050565b6000806000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156108a057600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002094506108f8856002015442610f3090919063ffffffff16565b9350601e841015151561090a57600080fd5b61091e601e85610eda90919063ffffffff16565b925061094a610937601e85610ef590919063ffffffff16565b8660020154610f4990919063ffffffff16565b85600201819055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6109a7858860010154610ef590919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015156109cc57600080fd5b5050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a3057600080fd5b816000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610abe57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250610b188360010154600354610f3090919063ffffffff16565b600381905550610b9d83606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050610f67565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160009055505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7957600080fd5b610c94670de0b6b3a764000083610ef590919063ffffffff16565b9050610cab81600354610f4990919063ffffffff16565b6003819055506060604051908101604052808473ffffffffffffffffffffffffffffffffffffffff16815260200182815260200142815250600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155905050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610de057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e1c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808284811515610ee857fe5b0490508091505092915050565b6000806000841415610f0a5760009150610f29565b8284029050828482811515610f1b57fe5b04141515610f2557fe5b8091505b5092915050565b6000828211151515610f3e57fe5b818303905092915050565b6000808284019050838110151515610f5d57fe5b8091505092915050565b6000610fa9601e610f9b610f88856040015142610f3090919063ffffffff16565b8560200151610ef590919063ffffffff16565b610eda90919063ffffffff16565b9050816000015173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610fef57600080fd5b50505600a165627a7a72305820d92ebc9a2b52a8c3cfa92801dd0c2e441329dc2ae3fce8c47ed5a4c41771a9780029", + "deployedBytecode": "0x6060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806323fed09e146100bf57806335046722146100ec5780633b6d5b48146101395780634ec19512146101c05780638da5cb5b146101e9578063a2f09dfa1461023e578063bc456c421461025c578063c8cc895d146102b4578063cf41d6f814610315578063d108177a1461032a578063e7fd9a1314610363578063f2fde38b146103a5575b600080fd5b34156100ca57600080fd5b6100d26103de565b604051808215151515815260200191505060405180910390f35b34156100f757600080fd5b610123600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506103ef565b6040518082815260200191505060405180910390f35b341561014457600080fd5b610170600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610410565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390f35b34156101cb57600080fd5b6101d361045a565b6040518082815260200191505060405180910390f35b34156101f457600080fd5b6101fc610483565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102466104a8565b6040518082815260200191505060405180910390f35b341561026757600080fd5b6102b2600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506104c7565b005b34156102bf57600080fd5b610313600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061063d565b005b341561032057600080fd5b61032861080d565b005b341561033557600080fd5b610361600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506109d3565b005b341561036e57600080fd5b6103a3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c1c565b005b34156103b057600080fd5b6103dc600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610d85565b005b6000806103e961045a565b11905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b60016020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154905083565b600080610466306103ef565b905061047d60035482610eda90919063ffffffff16565b91505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561052457600080fd5b826000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156105b257600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250838360000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561069b57600080fd5b846000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561072957600080fd5b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209350610785670de0b6b3a764000086610ef590919063ffffffff16565b92506107b2836107a48660010154600354610f3090919063ffffffff16565b610f4990919063ffffffff16565b600381905550858460000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082846001018190555050505050505050565b6000806000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156108a057600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002094506108f8856002015442610f3090919063ffffffff16565b9350601e841015151561090a57600080fd5b61091e601e85610eda90919063ffffffff16565b925061094a610937601e85610ef590919063ffffffff16565b8660020154610f4990919063ffffffff16565b85600201819055508460000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6109a7858860010154610ef590919063ffffffff16565b9081150290604051600060405180830381858888f1935050505015156109cc57600080fd5b5050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a3057600080fd5b816000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610abe57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250610b188360010154600354610f3090919063ffffffff16565b600381905550610b9d83606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050610f67565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160009055505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7957600080fd5b610c94670de0b6b3a764000083610ef590919063ffffffff16565b9050610cab81600354610f4990919063ffffffff16565b6003819055506060604051908101604052808473ffffffffffffffffffffffffffffffffffffffff16815260200182815260200142815250600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155905050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610de057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e1c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000808284811515610ee857fe5b0490508091505092915050565b6000806000841415610f0a5760009150610f29565b8284029050828482811515610f1b57fe5b04141515610f2557fe5b8091505b5092915050565b6000828211151515610f3e57fe5b818303905092915050565b6000808284019050838110151515610f5d57fe5b8091505092915050565b6000610fa9601e610f9b610f88856040015142610f3090919063ffffffff16565b8560200151610ef590919063ffffffff16565b610eda90919063ffffffff16565b9050816000015173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610fef57600080fd5b50505600a165627a7a72305820d92ebc9a2b52a8c3cfa92801dd0c2e441329dc2ae3fce8c47ed5a4c41771a9780029", + "sourceMap": "75:2621:1:-;;;395:1;376:20;;509:10:0;501:5;;:18;;;;;;;;;;;;;;;;;;75:2621:1;;;;;;", + "deployedSourceMap": "75:2621:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1989:81;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2591:100;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;252:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1832:152;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2077:83:1;;;;;;;;;;;;;;;;;;;;;;;1614:209;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1235:375;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2172:411;;;;;;;;;;;;;;983:248;;;;;;;;;;;;;;;;;;;;;;;;;;;;760:219;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;832:169:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;1989:81:1;2022:4;2063:1;2043:17;:15;:17::i;:::-;:21;2036:28;;1989:81;:::o;2591:100::-;2652:4;2673;:12;;;2666:19;;2591:100;;;:::o;252:51::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1832:152::-;1872:4;1892:16;1911:23;1929:4;1911:17;:23::i;:::-;1892:42;;1950:28;1966:11;;1950;:15;;:28;;;;:::i;:::-;1943:35;;1832:152;;:::o;238:20:0:-;;;;;;;;;;;;;:::o;2077:83:1:-;2113:4;2142;:12;;;2135:19;;2077:83;:::o;1614:209::-;1728:12;653:5:0;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;1708:10:1;454:12;469:15;:21;485:4;469:21;;;;;;;;;;;;;;;454:36;;535:3;507:8;:24;;;;;;;;;;;;:31;;;;499:40;;;;;;;;1743:15;:27;1759:10;1743:27;;;;;;;;;;;;;;;1728:42;;1806:11;1779:8;:24;;;:38;;;;;;;;;;;;;;;;;;665:1:0;;1614:209:1;;;:::o;1235:375::-;1354:12;1406:14;653:5:0;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;1332:10:1;454:12;469:15;:21;485:4;469:21;;;;;;;;;;;;;;;454:36;;535:3;507:8;:24;;;;;;;;;;;;:31;;;;499:40;;;;;;;;1369:15;:27;1385:10;1369:27;;;;;;;;;;;;;;;1354:42;;1423:16;1431:7;1423:3;:7;;:16;;;;:::i;:::-;1406:33;;1463:47;1500:9;1463:32;1479:8;:15;;;1463:11;;:15;;:32;;;;:::i;:::-;:36;;:47;;;;:::i;:::-;1449:11;:61;;;;1547:11;1520:8;:24;;;:38;;;;;;;;;;;;;;;;;;1586:9;1568:8;:15;;:27;;;;665:1:0;;1235:375:1;;;;;:::o;2172:411::-;2226:12;2277:17;2387:10;2205;454:12;469:15;:21;485:4;469:21;;;;;;;;;;;;;;;454:36;;535:3;507:8;:24;;;;;;;;;;;;:31;;;;499:40;;;;;;;;2241:15;:27;2257:10;2241:27;;;;;;;;;;;;;;;2226:42;;2297:28;2305:8;:19;;;2297:3;:7;;:28;;;;:::i;:::-;2277:48;;336:10;2342:12;:27;;2334:36;;;;;;;;2400:29;336:10;2400:12;:16;;:29;;;;:::i;:::-;2387:42;;2460:47;2484:22;336:10;2484:5;:9;;:22;;;;:::i;:::-;2460:8;:19;;;:23;;:47;;;;:::i;:::-;2438:8;:19;;:69;;;;2516:8;:24;;;;;;;;;;;;:33;;:61;2550:26;2570:5;2550:8;:15;;;:19;;:26;;;;:::i;:::-;2516:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2172:411;;;;;:::o;983:248::-;1059:12;653:5:0;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;1045:4:1;454:12;469:15;:21;485:4;469:21;;;;;;;;;;;;;;;454:36;;535:3;507:8;:24;;;;;;;;;;;;:31;;;;499:40;;;;;;;;1074:15;:21;1090:4;1074:21;;;;;;;;;;;;;;;1059:36;;1118:32;1134:8;:15;;;1118:11;;:15;;:32;;;;:::i;:::-;1104:11;:46;;;;1159:21;1171:8;1159:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:11;:21::i;:::-;1196:15;:21;1212:4;1196:21;;;;;;;;;;;;;;;;1189:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;665:1:0;;983:248:1;;:::o;760:219::-;830:14;653:5:0;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;847:16:1;855:7;847:3;:7;;:16;;;;:::i;:::-;830:33;;886:26;902:9;886:11;;:15;;:26;;;;:::i;:::-;872:11;:40;;;;945:28;;;;;;;;;954:4;945:28;;;;;;959:9;945:28;;;;969:3;945:28;;;921:15;:21;937:4;921:21;;;;;;;;;;;;;;;:52;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;760:219;;;:::o;832:169:0:-;653:5;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;928:1;908:22;;:8;:22;;;;900:31;;;;;;;;965:8;937:37;;958:5;;;;;;;;;;;937:37;;;;;;;;;;;;988:8;980:5;;:16;;;;;;;;;;;;;;;;;;832:169;:::o;458:265:2:-;516:7;605:9;621:1;617;:5;;;;;;;;605:17;;717:1;710:8;;458:265;;;;;:::o;203:173::-;261:7;316:9;285:1;280;:6;276:35;;;303:1;296:8;;;;276:35;332:1;328;:5;316:17;;355:1;350;346;:5;;;;;;;;:10;339:18;;;;;;370:1;363:8;;203:173;;;;;;:::o;835:110::-;893:7;920:1;915;:6;;908:14;;;;;;939:1;935;:5;928:12;;835:110;;;;:::o;1007:129::-;1065:7;1080:9;1096:1;1092;:5;1080:17;;1115:1;1110;:6;;1103:14;;;;;;1130:1;1123:8;;1007:129;;;;;:::o;563:190:1:-;614:16;633:56;336:10;633:39;648:23;656:3;:14;;;648:3;:7;;:23;;;;:::i;:::-;633:3;:10;;;:14;;:39;;;;:::i;:::-;:43;;:56;;;;:::i;:::-;614:75;;706:3;:19;;;:28;;:41;735:11;706:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;563:190;;:::o", + "source": "pragma solidity ^0.4.14;\nimport './SafeMath.sol';\nimport './Ownable.sol';\n\ncontract Payroll is Ownable{\n \n using SafeMath for uint;\n \n struct Employee{\n address employeeAddress;\n uint salary;\n uint lastPayday;\n }\n mapping(address => Employee) public employeeMapping;\n uint constant payDuration = 30 seconds;\n address ownerAddress;\n uint totalSalary = 0;\n \n \n modifier employeeExist(address addr){\n var employee = employeeMapping[addr];\n require(employee.employeeAddress != 0x0);\n _;\n }\n \n function _partialPay(Employee emp) private{\n uint totalSalary = emp.salary.mul(now.sub(emp.lastPayday)).div(payDuration);\n \n emp.employeeAddress.transfer(totalSalary);\n }\n \n function addEmployee(address addr,uint sal) onlyOwner {\n \n uint oneSalary = sal.mul(1 ether);\n totalSalary = totalSalary.add(oneSalary);\n employeeMapping[addr] = Employee(addr,oneSalary,now);\n }\n function removeEmployee(address addr) onlyOwner employeeExist(addr){\n var employee = employeeMapping[addr];\n totalSalary = totalSalary.sub(employee.salary);\n _partialPay(employee);\n delete(employeeMapping[addr]);\n \n }\n function updateEmployee(address oldAddress,address newAddresss,uint sal) onlyOwner employeeExist(oldAddress){\n\n var employee = employeeMapping[oldAddress];\n uint oneSalary = sal.mul(1 ether);\n totalSalary = totalSalary.sub(employee.salary).add(oneSalary);\n employee.employeeAddress = newAddresss;\n employee.salary = oneSalary;\n \n }\n function changePaymentAddress(address oldAddress,address newAddresss) onlyOwner employeeExist(oldAddress){\n var employee = employeeMapping[oldAddress];\n employee.employeeAddress = newAddresss;\n }\n\n \n function calculateRunway() view returns(uint){\n \n uint selfbalance = getAddressBalance(this);\n return selfbalance.div(totalSalary);\n }\n function hasEnoughFund() returns(bool){\n return calculateRunway() > 0;\n }\n \n function addFund() payable returns(uint){\n \n return this.balance;\n }\n \n \n function getPaid() employeeExist(msg.sender) {\n var employee = employeeMapping[msg.sender];\n uint intervalTime = now.sub(employee.lastPayday);\n require(intervalTime >= payDuration);\n \n uint times = intervalTime.div(payDuration);\n employee.lastPayday = employee.lastPayday.add(times.mul(payDuration));\n employee.employeeAddress.transfer(employee.salary.mul(times));\n }\n \n function getAddressBalance(address addr) public view returns(uint){\n return addr.balance;\n }\n \n}", + "sourcePath": "/home/juicebox/payroll/contracts/Payroll.sol", + "ast": { + "absolutePath": "/home/juicebox/payroll/contracts/Payroll.sol", + "exportedSymbols": { + "Payroll": [ + 381 + ] + }, + "id": 382, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 57, + "literals": [ + "solidity", + "^", + "0.4", + ".14" + ], + "nodeType": "PragmaDirective", + "src": "0:24:1" + }, + { + "absolutePath": "/home/juicebox/payroll/contracts/SafeMath.sol", + "file": "./SafeMath.sol", + "id": 58, + "nodeType": "ImportDirective", + "scope": 382, + "sourceUnit": 480, + "src": "25:24:1", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "/home/juicebox/payroll/contracts/Ownable.sol", + "file": "./Ownable.sol", + "id": 59, + "nodeType": "ImportDirective", + "scope": 382, + "sourceUnit": 56, + "src": "50:23:1", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [ + { + "arguments": [], + "baseName": { + "contractScope": null, + "id": 60, + "name": "Ownable", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 55, + "src": "95:7:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Ownable_$55", + "typeString": "contract Ownable" + } + }, + "id": 61, + "nodeType": "InheritanceSpecifier", + "src": "95:7:1" + } + ], + "contractDependencies": [ + 55 + ], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 381, + "linearizedBaseContracts": [ + 381, + 55 + ], + "name": "Payroll", + "nodeType": "ContractDefinition", + "nodes": [ + { + "id": 64, + "libraryName": { + "contractScope": null, + "id": 62, + "name": "SafeMath", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 479, + "src": "119:8:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SafeMath_$479", + "typeString": "library SafeMath" + } + }, + "nodeType": "UsingForDirective", + "src": "113:24:1", + "typeName": { + "id": 63, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "132:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + { + "canonicalName": "Payroll.Employee", + "id": 71, + "members": [ + { + "constant": false, + "id": 66, + "name": "employeeAddress", + "nodeType": "VariableDeclaration", + "scope": 71, + "src": "172:23:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 65, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "172:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 68, + "name": "salary", + "nodeType": "VariableDeclaration", + "scope": 71, + "src": "205:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 67, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "205:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 70, + "name": "lastPayday", + "nodeType": "VariableDeclaration", + "scope": 71, + "src": "226:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 69, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "226:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "Employee", + "nodeType": "StructDefinition", + "scope": 381, + "src": "147:101:1", + "visibility": "public" + }, + { + "constant": false, + "id": 75, + "name": "employeeMapping", + "nodeType": "VariableDeclaration", + "scope": 381, + "src": "252:51:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + }, + "typeName": { + "id": 74, + "keyType": { + "id": 72, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "260:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "252:28:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + }, + "valueType": { + "contractScope": null, + "id": 73, + "name": "Employee", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 71, + "src": "271:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": true, + "id": 78, + "name": "payDuration", + "nodeType": "VariableDeclaration", + "scope": 381, + "src": "308:38:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 76, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "308:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "3330", + "id": 77, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "336:10:1", + "subdenomination": "seconds", + "typeDescriptions": { + "typeIdentifier": "t_rational_30_by_1", + "typeString": "int_const 30" + }, + "value": "30" + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 80, + "name": "ownerAddress", + "nodeType": "VariableDeclaration", + "scope": 381, + "src": "351:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 79, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "351:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 83, + "name": "totalSalary", + "nodeType": "VariableDeclaration", + "scope": 381, + "src": "376:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 81, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "376:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "30", + "id": 82, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "395:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "visibility": "internal" + }, + { + "body": { + "id": 100, + "nodeType": "Block", + "src": "445:110:1", + "statements": [ + { + "assignments": [ + 87 + ], + "declarations": [ + { + "constant": false, + "id": 87, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 101, + "src": "454:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 91, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 88, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "469:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 90, + "indexExpression": { + "argumentTypes": null, + "id": 89, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 85, + "src": "485:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "469:21:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "454:36:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 96, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 93, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "507:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 94, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "507:24:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "307830", + "id": 95, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "535:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0x0" + }, + "src": "507:31:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 92, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 494, + "src": "499:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 97, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "499:40:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 98, + "nodeType": "ExpressionStatement", + "src": "499:40:1" + }, + { + "id": 99, + "nodeType": "PlaceholderStatement", + "src": "548:1:1" + } + ] + }, + "id": 101, + "name": "employeeExist", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 86, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 85, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 101, + "src": "432:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 84, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "432:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "431:14:1" + }, + "src": "409:146:1", + "visibility": "internal" + }, + { + "body": { + "id": 129, + "nodeType": "Block", + "src": "605:148:1", + "statements": [ + { + "assignments": [ + 107 + ], + "declarations": [ + { + "constant": false, + "id": 107, + "name": "totalSalary", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "614:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 106, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "614:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 120, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 118, + "name": "payDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 78, + "src": "677:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 113, + "name": "emp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "656:3:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory_ptr", + "typeString": "struct Payroll.Employee memory" + } + }, + "id": 114, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "lastPayday", + "nodeType": "MemberAccess", + "referencedDeclaration": 70, + "src": "656:14:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 111, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 493, + "src": "648:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sub", + "nodeType": "MemberAccess", + "referencedDeclaration": 454, + "src": "648:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "648:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 108, + "name": "emp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "633:3:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory_ptr", + "typeString": "struct Payroll.Employee memory" + } + }, + "id": 109, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "633:10:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 110, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "633:14:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 116, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "633:39:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 117, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "div", + "nodeType": "MemberAccess", + "referencedDeclaration": 434, + "src": "633:43:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "633:56:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "614:75:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 126, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "735:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 121, + "name": "emp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "706:3:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory_ptr", + "typeString": "struct Payroll.Employee memory" + } + }, + "id": 124, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "706:19:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 125, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "706:28:1", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "706:41:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "706:41:1" + } + ] + }, + "id": 130, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "_partialPay", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 104, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 103, + "name": "emp", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "584:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory_ptr", + "typeString": "struct Payroll.Employee memory" + }, + "typeName": { + "contractScope": null, + "id": 102, + "name": "Employee", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 71, + "src": "584:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "583:14:1" + }, + "payable": false, + "returnParameters": { + "id": 105, + "nodeType": "ParameterList", + "parameters": [], + "src": "605:0:1" + }, + "scope": 381, + "src": "563:190:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "private" + }, + { + "body": { + "id": 163, + "nodeType": "Block", + "src": "814:165:1", + "statements": [ + { + "assignments": [ + 140 + ], + "declarations": [ + { + "constant": false, + "id": 140, + "name": "oneSalary", + "nodeType": "VariableDeclaration", + "scope": 164, + "src": "830:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 139, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "830:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 145, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "31", + "id": 143, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "855:7:1", + "subdenomination": "ether", + "typeDescriptions": { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + } + ], + "expression": { + "argumentTypes": null, + "id": 141, + "name": "sal", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 134, + "src": "847:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "847:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 144, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "847:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "830:33:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 151, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 146, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "872:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 149, + "name": "oneSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 140, + "src": "902:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 147, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "886:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "add", + "nodeType": "MemberAccess", + "referencedDeclaration": 478, + "src": "886:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 150, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "886:26:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "872:40:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 152, + "nodeType": "ExpressionStatement", + "src": "872:40:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 153, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "921:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 155, + "indexExpression": { + "argumentTypes": null, + "id": 154, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 132, + "src": "937:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "921:21:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 157, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 132, + "src": "954:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 158, + "name": "oneSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 140, + "src": "959:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 159, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 493, + "src": "969:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 156, + "name": "Employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 71, + "src": "945:8:1", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_Employee_$71_storage_ptr_$", + "typeString": "type(struct Payroll.Employee storage pointer)" + } + }, + "id": 160, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "945:28:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory", + "typeString": "struct Payroll.Employee memory" + } + }, + "src": "921:52:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "id": 162, + "nodeType": "ExpressionStatement", + "src": "921:52:1" + } + ] + }, + "id": 164, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 137, + "modifierName": { + "argumentTypes": null, + "id": 136, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "804:9:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "804:9:1" + } + ], + "name": "addEmployee", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 135, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 132, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 164, + "src": "781:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 131, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "781:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 134, + "name": "sal", + "nodeType": "VariableDeclaration", + "scope": 164, + "src": "794:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 133, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "794:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "780:23:1" + }, + "payable": false, + "returnParameters": { + "id": 138, + "nodeType": "ParameterList", + "parameters": [], + "src": "814:0:1" + }, + "scope": 381, + "src": "760:219:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 197, + "nodeType": "Block", + "src": "1050:181:1", + "statements": [ + { + "assignments": [ + 174 + ], + "declarations": [ + { + "constant": false, + "id": 174, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 198, + "src": "1059:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 178, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 175, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1074:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 177, + "indexExpression": { + "argumentTypes": null, + "id": 176, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 166, + "src": "1090:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1074:21:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1059:36:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 185, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 179, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1104:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 182, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 174, + "src": "1134:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 183, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "1134:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 180, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1118:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sub", + "nodeType": "MemberAccess", + "referencedDeclaration": 454, + "src": "1118:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 184, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1118:32:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1104:46:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 186, + "nodeType": "ExpressionStatement", + "src": "1104:46:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 188, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 174, + "src": "1171:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + ], + "id": 187, + "name": "_partialPay", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "1159:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_struct$_Employee_$71_memory_ptr_$returns$__$", + "typeString": "function (struct Payroll.Employee memory)" + } + }, + "id": 189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1159:21:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 190, + "nodeType": "ExpressionStatement", + "src": "1159:21:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "delete", + "prefix": true, + "src": "1189:29:1", + "subExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 191, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1196:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 193, + "indexExpression": { + "argumentTypes": null, + "id": 192, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 166, + "src": "1212:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1196:21:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + } + ], + "id": 194, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1195:23:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 196, + "nodeType": "ExpressionStatement", + "src": "1189:29:1" + } + ] + }, + "id": 198, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 169, + "modifierName": { + "argumentTypes": null, + "id": 168, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "1021:9:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "1021:9:1" + }, + { + "arguments": [ + { + "argumentTypes": null, + "id": 171, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 166, + "src": "1045:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 172, + "modifierName": { + "argumentTypes": null, + "id": 170, + "name": "employeeExist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "1031:13:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$_t_address_$", + "typeString": "modifier (address)" + } + }, + "nodeType": "ModifierInvocation", + "src": "1031:19:1" + } + ], + "name": "removeEmployee", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 167, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 166, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 198, + "src": "1007:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 165, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1007:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1006:14:1" + }, + "payable": false, + "returnParameters": { + "id": 173, + "nodeType": "ParameterList", + "parameters": [], + "src": "1050:0:1" + }, + "scope": 381, + "src": "983:248:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 247, + "nodeType": "Block", + "src": "1343:267:1", + "statements": [ + { + "assignments": [ + 212 + ], + "declarations": [ + { + "constant": false, + "id": 212, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1354:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 216, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 213, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1369:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 215, + "indexExpression": { + "argumentTypes": null, + "id": 214, + "name": "oldAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 200, + "src": "1385:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1369:27:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1354:42:1" + }, + { + "assignments": [ + 218 + ], + "declarations": [ + { + "constant": false, + "id": 218, + "name": "oneSalary", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1406:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 217, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1406:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 223, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "31", + "id": 221, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1431:7:1", + "subdenomination": "ether", + "typeDescriptions": { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + } + ], + "expression": { + "argumentTypes": null, + "id": 219, + "name": "sal", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 204, + "src": "1423:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 220, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "1423:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 222, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1423:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1406:33:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 233, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 224, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1449:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 231, + "name": "oneSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 218, + "src": "1500:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 227, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 212, + "src": "1479:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 228, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "1479:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 225, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1463:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sub", + "nodeType": "MemberAccess", + "referencedDeclaration": 454, + "src": "1463:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 229, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1463:32:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 230, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "add", + "nodeType": "MemberAccess", + "referencedDeclaration": 478, + "src": "1463:36:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 232, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1463:47:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1449:61:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 234, + "nodeType": "ExpressionStatement", + "src": "1449:61:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 235, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 212, + "src": "1520:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 237, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "1520:24:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 238, + "name": "newAddresss", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "1547:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1520:38:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 240, + "nodeType": "ExpressionStatement", + "src": "1520:38:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 241, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 212, + "src": "1568:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 243, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "1568:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 244, + "name": "oneSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 218, + "src": "1586:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1568:27:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 246, + "nodeType": "ExpressionStatement", + "src": "1568:27:1" + } + ] + }, + "id": 248, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 207, + "modifierName": { + "argumentTypes": null, + "id": 206, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "1308:9:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "1308:9:1" + }, + { + "arguments": [ + { + "argumentTypes": null, + "id": 209, + "name": "oldAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 200, + "src": "1332:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 210, + "modifierName": { + "argumentTypes": null, + "id": 208, + "name": "employeeExist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "1318:13:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$_t_address_$", + "typeString": "modifier (address)" + } + }, + "nodeType": "ModifierInvocation", + "src": "1318:25:1" + } + ], + "name": "updateEmployee", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 205, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 200, + "name": "oldAddress", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1259:18:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 199, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1259:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 202, + "name": "newAddresss", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1278:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 201, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1278:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 204, + "name": "sal", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1298:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 203, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1298:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1258:49:1" + }, + "payable": false, + "returnParameters": { + "id": 211, + "nodeType": "ParameterList", + "parameters": [], + "src": "1343:0:1" + }, + "scope": 381, + "src": "1235:375:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 271, + "nodeType": "Block", + "src": "1719:104:1", + "statements": [ + { + "assignments": [ + 260 + ], + "declarations": [ + { + "constant": false, + "id": 260, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 272, + "src": "1728:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 264, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 261, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1743:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 263, + "indexExpression": { + "argumentTypes": null, + "id": 262, + "name": "oldAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "1759:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1743:27:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1728:42:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 265, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 260, + "src": "1779:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 267, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "1779:24:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 268, + "name": "newAddresss", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 252, + "src": "1806:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1779:38:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 270, + "nodeType": "ExpressionStatement", + "src": "1779:38:1" + } + ] + }, + "id": 272, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 255, + "modifierName": { + "argumentTypes": null, + "id": 254, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "1684:9:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "1684:9:1" + }, + { + "arguments": [ + { + "argumentTypes": null, + "id": 257, + "name": "oldAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "1708:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 258, + "modifierName": { + "argumentTypes": null, + "id": 256, + "name": "employeeExist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "1694:13:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$_t_address_$", + "typeString": "modifier (address)" + } + }, + "nodeType": "ModifierInvocation", + "src": "1694:25:1" + } + ], + "name": "changePaymentAddress", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 253, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 250, + "name": "oldAddress", + "nodeType": "VariableDeclaration", + "scope": 272, + "src": "1644:18:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 249, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1644:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 252, + "name": "newAddresss", + "nodeType": "VariableDeclaration", + "scope": 272, + "src": "1663:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 251, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1663:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1643:40:1" + }, + "payable": false, + "returnParameters": { + "id": 259, + "nodeType": "ParameterList", + "parameters": [], + "src": "1719:0:1" + }, + "scope": 381, + "src": "1614:209:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 288, + "nodeType": "Block", + "src": "1877:107:1", + "statements": [ + { + "assignments": [ + 278 + ], + "declarations": [ + { + "constant": false, + "id": 278, + "name": "selfbalance", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "1892:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 277, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1892:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 282, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 280, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 506, + "src": "1929:4:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Payroll_$381", + "typeString": "contract Payroll" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_Payroll_$381", + "typeString": "contract Payroll" + } + ], + "id": 279, + "name": "getAddressBalance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 380, + "src": "1911:17:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) view returns (uint256)" + } + }, + "id": 281, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1911:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1892:42:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 285, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1966:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 283, + "name": "selfbalance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 278, + "src": "1950:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "div", + "nodeType": "MemberAccess", + "referencedDeclaration": 434, + "src": "1950:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 286, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1950:28:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 276, + "id": 287, + "nodeType": "Return", + "src": "1943:35:1" + } + ] + }, + "id": 289, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "calculateRunway", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 273, + "nodeType": "ParameterList", + "parameters": [], + "src": "1856:2:1" + }, + "payable": false, + "returnParameters": { + "id": 276, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 275, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "1872:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 274, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1872:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1871:6:1" + }, + "scope": 381, + "src": "1832:152:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 299, + "nodeType": "Block", + "src": "2027:43:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 297, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 294, + "name": "calculateRunway", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 289, + "src": "2043:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", + "typeString": "function () view returns (uint256)" + } + }, + "id": 295, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2043:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 296, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2063:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2043:21:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 293, + "id": 298, + "nodeType": "Return", + "src": "2036:28:1" + } + ] + }, + "id": 300, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "hasEnoughFund", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 290, + "nodeType": "ParameterList", + "parameters": [], + "src": "2011:2:1" + }, + "payable": false, + "returnParameters": { + "id": 293, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 292, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 300, + "src": "2022:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 291, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2022:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2021:6:1" + }, + "scope": 381, + "src": "1989:81:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 308, + "nodeType": "Block", + "src": "2118:42:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 305, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 506, + "src": "2142:4:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Payroll_$381", + "typeString": "contract Payroll" + } + }, + "id": 306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "balance", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2142:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 304, + "id": 307, + "nodeType": "Return", + "src": "2135:19:1" + } + ] + }, + "id": 309, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "addFund", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 301, + "nodeType": "ParameterList", + "parameters": [], + "src": "2093:2:1" + }, + "payable": true, + "returnParameters": { + "id": 304, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 303, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 309, + "src": "2113:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 302, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2113:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2112:6:1" + }, + "scope": 381, + "src": "2077:83:1", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 368, + "nodeType": "Block", + "src": "2217:366:1", + "statements": [ + { + "assignments": [ + 316 + ], + "declarations": [ + { + "constant": false, + "id": 316, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "2226:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 321, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 317, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "2241:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 320, + "indexExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 318, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 491, + "src": "2257:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 319, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2257:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2241:27:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2226:42:1" + }, + { + "assignments": [ + 323 + ], + "declarations": [ + { + "constant": false, + "id": 323, + "name": "intervalTime", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "2277:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 322, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2277:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 329, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 326, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2305:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 327, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "lastPayday", + "nodeType": "MemberAccess", + "referencedDeclaration": 70, + "src": "2305:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 324, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 493, + "src": "2297:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sub", + "nodeType": "MemberAccess", + "referencedDeclaration": 454, + "src": "2297:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2297:28:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2277:48:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 333, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 331, + "name": "intervalTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 323, + "src": "2342:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 332, + "name": "payDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 78, + "src": "2358:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2342:27:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 330, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 494, + "src": "2334:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2334:36:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 335, + "nodeType": "ExpressionStatement", + "src": "2334:36:1" + }, + { + "assignments": [ + 337 + ], + "declarations": [ + { + "constant": false, + "id": 337, + "name": "times", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "2387:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 336, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2387:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 342, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 340, + "name": "payDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 78, + "src": "2417:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 338, + "name": "intervalTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 323, + "src": "2400:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 339, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "div", + "nodeType": "MemberAccess", + "referencedDeclaration": 434, + "src": "2400:16:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2400:29:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2387:42:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 354, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 343, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2438:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 345, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "lastPayday", + "nodeType": "MemberAccess", + "referencedDeclaration": 70, + "src": "2438:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 351, + "name": "payDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 78, + "src": "2494:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 349, + "name": "times", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 337, + "src": "2484:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "2484:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 352, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2484:22:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 346, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2460:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 347, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "lastPayday", + "nodeType": "MemberAccess", + "referencedDeclaration": 70, + "src": "2460:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "add", + "nodeType": "MemberAccess", + "referencedDeclaration": 478, + "src": "2460:23:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2460:47:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2438:69:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 355, + "nodeType": "ExpressionStatement", + "src": "2438:69:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 364, + "name": "times", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 337, + "src": "2570:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 361, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2550:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 362, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "2550:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 363, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "2550:19:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 365, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2550:26:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 356, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2516:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 359, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "2516:24:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 360, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2516:33:1", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2516:61:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 367, + "nodeType": "ExpressionStatement", + "src": "2516:61:1" + } + ] + }, + "id": 369, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 312, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 491, + "src": "2205:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2205:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 314, + "modifierName": { + "argumentTypes": null, + "id": 311, + "name": "employeeExist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "2191:13:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$_t_address_$", + "typeString": "modifier (address)" + } + }, + "nodeType": "ModifierInvocation", + "src": "2191:25:1" + } + ], + "name": "getPaid", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 310, + "nodeType": "ParameterList", + "parameters": [], + "src": "2188:2:1" + }, + "payable": false, + "returnParameters": { + "id": 315, + "nodeType": "ParameterList", + "parameters": [], + "src": "2217:0:1" + }, + "scope": 381, + "src": "2172:411:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 379, + "nodeType": "Block", + "src": "2657:34:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 376, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 371, + "src": "2673:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "balance", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2673:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 375, + "id": 378, + "nodeType": "Return", + "src": "2666:19:1" + } + ] + }, + "id": 380, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "getAddressBalance", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 372, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 371, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 380, + "src": "2618:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 370, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2618:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2617:14:1" + }, + "payable": false, + "returnParameters": { + "id": 375, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 374, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 380, + "src": "2652:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 373, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2652:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2651:6:1" + }, + "scope": 381, + "src": "2591:100:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 382, + "src": "75:2621:1" + } + ], + "src": "0:2696:1" + }, + "legacyAST": { + "absolutePath": "/home/juicebox/payroll/contracts/Payroll.sol", + "exportedSymbols": { + "Payroll": [ + 381 + ] + }, + "id": 382, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 57, + "literals": [ + "solidity", + "^", + "0.4", + ".14" + ], + "nodeType": "PragmaDirective", + "src": "0:24:1" + }, + { + "absolutePath": "/home/juicebox/payroll/contracts/SafeMath.sol", + "file": "./SafeMath.sol", + "id": 58, + "nodeType": "ImportDirective", + "scope": 382, + "sourceUnit": 480, + "src": "25:24:1", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "/home/juicebox/payroll/contracts/Ownable.sol", + "file": "./Ownable.sol", + "id": 59, + "nodeType": "ImportDirective", + "scope": 382, + "sourceUnit": 56, + "src": "50:23:1", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [ + { + "arguments": [], + "baseName": { + "contractScope": null, + "id": 60, + "name": "Ownable", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 55, + "src": "95:7:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Ownable_$55", + "typeString": "contract Ownable" + } + }, + "id": 61, + "nodeType": "InheritanceSpecifier", + "src": "95:7:1" + } + ], + "contractDependencies": [ + 55 + ], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 381, + "linearizedBaseContracts": [ + 381, + 55 + ], + "name": "Payroll", + "nodeType": "ContractDefinition", + "nodes": [ + { + "id": 64, + "libraryName": { + "contractScope": null, + "id": 62, + "name": "SafeMath", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 479, + "src": "119:8:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_SafeMath_$479", + "typeString": "library SafeMath" + } + }, + "nodeType": "UsingForDirective", + "src": "113:24:1", + "typeName": { + "id": 63, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "132:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + { + "canonicalName": "Payroll.Employee", + "id": 71, + "members": [ + { + "constant": false, + "id": 66, + "name": "employeeAddress", + "nodeType": "VariableDeclaration", + "scope": 71, + "src": "172:23:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 65, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "172:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 68, + "name": "salary", + "nodeType": "VariableDeclaration", + "scope": 71, + "src": "205:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 67, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "205:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 70, + "name": "lastPayday", + "nodeType": "VariableDeclaration", + "scope": 71, + "src": "226:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 69, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "226:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "Employee", + "nodeType": "StructDefinition", + "scope": 381, + "src": "147:101:1", + "visibility": "public" + }, + { + "constant": false, + "id": 75, + "name": "employeeMapping", + "nodeType": "VariableDeclaration", + "scope": 381, + "src": "252:51:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + }, + "typeName": { + "id": 74, + "keyType": { + "id": 72, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "260:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "252:28:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + }, + "valueType": { + "contractScope": null, + "id": 73, + "name": "Employee", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 71, + "src": "271:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": true, + "id": 78, + "name": "payDuration", + "nodeType": "VariableDeclaration", + "scope": 381, + "src": "308:38:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 76, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "308:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "3330", + "id": 77, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "336:10:1", + "subdenomination": "seconds", + "typeDescriptions": { + "typeIdentifier": "t_rational_30_by_1", + "typeString": "int_const 30" + }, + "value": "30" + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 80, + "name": "ownerAddress", + "nodeType": "VariableDeclaration", + "scope": 381, + "src": "351:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 79, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "351:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 83, + "name": "totalSalary", + "nodeType": "VariableDeclaration", + "scope": 381, + "src": "376:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 81, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "376:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "argumentTypes": null, + "hexValue": "30", + "id": 82, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "395:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "visibility": "internal" + }, + { + "body": { + "id": 100, + "nodeType": "Block", + "src": "445:110:1", + "statements": [ + { + "assignments": [ + 87 + ], + "declarations": [ + { + "constant": false, + "id": 87, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 101, + "src": "454:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 91, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 88, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "469:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 90, + "indexExpression": { + "argumentTypes": null, + "id": 89, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 85, + "src": "485:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "469:21:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "454:36:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 96, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 93, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "507:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 94, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "507:24:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "argumentTypes": null, + "hexValue": "307830", + "id": 95, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "535:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0x0" + }, + "src": "507:31:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 92, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 494, + "src": "499:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 97, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "499:40:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 98, + "nodeType": "ExpressionStatement", + "src": "499:40:1" + }, + { + "id": 99, + "nodeType": "PlaceholderStatement", + "src": "548:1:1" + } + ] + }, + "id": 101, + "name": "employeeExist", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 86, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 85, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 101, + "src": "432:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 84, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "432:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "431:14:1" + }, + "src": "409:146:1", + "visibility": "internal" + }, + { + "body": { + "id": 129, + "nodeType": "Block", + "src": "605:148:1", + "statements": [ + { + "assignments": [ + 107 + ], + "declarations": [ + { + "constant": false, + "id": 107, + "name": "totalSalary", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "614:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 106, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "614:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 120, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 118, + "name": "payDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 78, + "src": "677:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 113, + "name": "emp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "656:3:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory_ptr", + "typeString": "struct Payroll.Employee memory" + } + }, + "id": 114, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "lastPayday", + "nodeType": "MemberAccess", + "referencedDeclaration": 70, + "src": "656:14:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 111, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 493, + "src": "648:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sub", + "nodeType": "MemberAccess", + "referencedDeclaration": 454, + "src": "648:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "648:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 108, + "name": "emp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "633:3:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory_ptr", + "typeString": "struct Payroll.Employee memory" + } + }, + "id": 109, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "633:10:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 110, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "633:14:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 116, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "633:39:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 117, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "div", + "nodeType": "MemberAccess", + "referencedDeclaration": 434, + "src": "633:43:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 119, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "633:56:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "614:75:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 126, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "735:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 121, + "name": "emp", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 103, + "src": "706:3:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory_ptr", + "typeString": "struct Payroll.Employee memory" + } + }, + "id": 124, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "706:19:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 125, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "706:28:1", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "706:41:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "706:41:1" + } + ] + }, + "id": 130, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "_partialPay", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 104, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 103, + "name": "emp", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "584:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory_ptr", + "typeString": "struct Payroll.Employee memory" + }, + "typeName": { + "contractScope": null, + "id": 102, + "name": "Employee", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 71, + "src": "584:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "583:14:1" + }, + "payable": false, + "returnParameters": { + "id": 105, + "nodeType": "ParameterList", + "parameters": [], + "src": "605:0:1" + }, + "scope": 381, + "src": "563:190:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "private" + }, + { + "body": { + "id": 163, + "nodeType": "Block", + "src": "814:165:1", + "statements": [ + { + "assignments": [ + 140 + ], + "declarations": [ + { + "constant": false, + "id": 140, + "name": "oneSalary", + "nodeType": "VariableDeclaration", + "scope": 164, + "src": "830:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 139, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "830:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 145, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "31", + "id": 143, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "855:7:1", + "subdenomination": "ether", + "typeDescriptions": { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + } + ], + "expression": { + "argumentTypes": null, + "id": 141, + "name": "sal", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 134, + "src": "847:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "847:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 144, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "847:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "830:33:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 151, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 146, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "872:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 149, + "name": "oneSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 140, + "src": "902:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 147, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "886:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "add", + "nodeType": "MemberAccess", + "referencedDeclaration": 478, + "src": "886:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 150, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "886:26:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "872:40:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 152, + "nodeType": "ExpressionStatement", + "src": "872:40:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 153, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "921:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 155, + "indexExpression": { + "argumentTypes": null, + "id": 154, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 132, + "src": "937:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "921:21:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 157, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 132, + "src": "954:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "argumentTypes": null, + "id": 158, + "name": "oneSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 140, + "src": "959:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "id": 159, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 493, + "src": "969:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 156, + "name": "Employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 71, + "src": "945:8:1", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_struct$_Employee_$71_storage_ptr_$", + "typeString": "type(struct Payroll.Employee storage pointer)" + } + }, + "id": 160, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "structConstructorCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "945:28:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_memory", + "typeString": "struct Payroll.Employee memory" + } + }, + "src": "921:52:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "id": 162, + "nodeType": "ExpressionStatement", + "src": "921:52:1" + } + ] + }, + "id": 164, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 137, + "modifierName": { + "argumentTypes": null, + "id": 136, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "804:9:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "804:9:1" + } + ], + "name": "addEmployee", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 135, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 132, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 164, + "src": "781:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 131, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "781:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 134, + "name": "sal", + "nodeType": "VariableDeclaration", + "scope": 164, + "src": "794:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 133, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "794:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "780:23:1" + }, + "payable": false, + "returnParameters": { + "id": 138, + "nodeType": "ParameterList", + "parameters": [], + "src": "814:0:1" + }, + "scope": 381, + "src": "760:219:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 197, + "nodeType": "Block", + "src": "1050:181:1", + "statements": [ + { + "assignments": [ + 174 + ], + "declarations": [ + { + "constant": false, + "id": 174, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 198, + "src": "1059:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 178, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 175, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1074:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 177, + "indexExpression": { + "argumentTypes": null, + "id": 176, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 166, + "src": "1090:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1074:21:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1059:36:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 185, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 179, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1104:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 182, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 174, + "src": "1134:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 183, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "1134:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 180, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1118:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sub", + "nodeType": "MemberAccess", + "referencedDeclaration": 454, + "src": "1118:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 184, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1118:32:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1104:46:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 186, + "nodeType": "ExpressionStatement", + "src": "1104:46:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 188, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 174, + "src": "1171:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + ], + "id": 187, + "name": "_partialPay", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "1159:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_struct$_Employee_$71_memory_ptr_$returns$__$", + "typeString": "function (struct Payroll.Employee memory)" + } + }, + "id": 189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1159:21:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 190, + "nodeType": "ExpressionStatement", + "src": "1159:21:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 195, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "delete", + "prefix": true, + "src": "1189:29:1", + "subExpression": { + "argumentTypes": null, + "components": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 191, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1196:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 193, + "indexExpression": { + "argumentTypes": null, + "id": 192, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 166, + "src": "1212:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "1196:21:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + } + ], + "id": 194, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1195:23:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 196, + "nodeType": "ExpressionStatement", + "src": "1189:29:1" + } + ] + }, + "id": 198, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 169, + "modifierName": { + "argumentTypes": null, + "id": 168, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "1021:9:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "1021:9:1" + }, + { + "arguments": [ + { + "argumentTypes": null, + "id": 171, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 166, + "src": "1045:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 172, + "modifierName": { + "argumentTypes": null, + "id": 170, + "name": "employeeExist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "1031:13:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$_t_address_$", + "typeString": "modifier (address)" + } + }, + "nodeType": "ModifierInvocation", + "src": "1031:19:1" + } + ], + "name": "removeEmployee", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 167, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 166, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 198, + "src": "1007:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 165, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1007:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1006:14:1" + }, + "payable": false, + "returnParameters": { + "id": 173, + "nodeType": "ParameterList", + "parameters": [], + "src": "1050:0:1" + }, + "scope": 381, + "src": "983:248:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 247, + "nodeType": "Block", + "src": "1343:267:1", + "statements": [ + { + "assignments": [ + 212 + ], + "declarations": [ + { + "constant": false, + "id": 212, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1354:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 216, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 213, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1369:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 215, + "indexExpression": { + "argumentTypes": null, + "id": 214, + "name": "oldAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 200, + "src": "1385:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1369:27:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1354:42:1" + }, + { + "assignments": [ + 218 + ], + "declarations": [ + { + "constant": false, + "id": 218, + "name": "oneSalary", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1406:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 217, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1406:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 223, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "31", + "id": 221, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1431:7:1", + "subdenomination": "ether", + "typeDescriptions": { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + }, + "value": "1" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + } + ], + "expression": { + "argumentTypes": null, + "id": 219, + "name": "sal", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 204, + "src": "1423:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 220, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "1423:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 222, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1423:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1406:33:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 233, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 224, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1449:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 231, + "name": "oneSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 218, + "src": "1500:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 227, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 212, + "src": "1479:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 228, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "1479:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 225, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1463:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 226, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sub", + "nodeType": "MemberAccess", + "referencedDeclaration": 454, + "src": "1463:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 229, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1463:32:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 230, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "add", + "nodeType": "MemberAccess", + "referencedDeclaration": 478, + "src": "1463:36:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 232, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1463:47:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1449:61:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 234, + "nodeType": "ExpressionStatement", + "src": "1449:61:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 235, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 212, + "src": "1520:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 237, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "1520:24:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 238, + "name": "newAddresss", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "1547:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1520:38:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 240, + "nodeType": "ExpressionStatement", + "src": "1520:38:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 241, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 212, + "src": "1568:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 243, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "1568:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 244, + "name": "oneSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 218, + "src": "1586:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1568:27:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 246, + "nodeType": "ExpressionStatement", + "src": "1568:27:1" + } + ] + }, + "id": 248, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 207, + "modifierName": { + "argumentTypes": null, + "id": 206, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "1308:9:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "1308:9:1" + }, + { + "arguments": [ + { + "argumentTypes": null, + "id": 209, + "name": "oldAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 200, + "src": "1332:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 210, + "modifierName": { + "argumentTypes": null, + "id": 208, + "name": "employeeExist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "1318:13:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$_t_address_$", + "typeString": "modifier (address)" + } + }, + "nodeType": "ModifierInvocation", + "src": "1318:25:1" + } + ], + "name": "updateEmployee", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 205, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 200, + "name": "oldAddress", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1259:18:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 199, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1259:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 202, + "name": "newAddresss", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1278:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 201, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1278:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 204, + "name": "sal", + "nodeType": "VariableDeclaration", + "scope": 248, + "src": "1298:8:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 203, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1298:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1258:49:1" + }, + "payable": false, + "returnParameters": { + "id": 211, + "nodeType": "ParameterList", + "parameters": [], + "src": "1343:0:1" + }, + "scope": 381, + "src": "1235:375:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 271, + "nodeType": "Block", + "src": "1719:104:1", + "statements": [ + { + "assignments": [ + 260 + ], + "declarations": [ + { + "constant": false, + "id": 260, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 272, + "src": "1728:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 264, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 261, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "1743:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 263, + "indexExpression": { + "argumentTypes": null, + "id": 262, + "name": "oldAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "1759:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1743:27:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1728:42:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 269, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 265, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 260, + "src": "1779:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 267, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "1779:24:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 268, + "name": "newAddresss", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 252, + "src": "1806:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1779:38:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 270, + "nodeType": "ExpressionStatement", + "src": "1779:38:1" + } + ] + }, + "id": 272, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [], + "id": 255, + "modifierName": { + "argumentTypes": null, + "id": 254, + "name": "onlyOwner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 29, + "src": "1684:9:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "1684:9:1" + }, + { + "arguments": [ + { + "argumentTypes": null, + "id": 257, + "name": "oldAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 250, + "src": "1708:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 258, + "modifierName": { + "argumentTypes": null, + "id": 256, + "name": "employeeExist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "1694:13:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$_t_address_$", + "typeString": "modifier (address)" + } + }, + "nodeType": "ModifierInvocation", + "src": "1694:25:1" + } + ], + "name": "changePaymentAddress", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 253, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 250, + "name": "oldAddress", + "nodeType": "VariableDeclaration", + "scope": 272, + "src": "1644:18:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 249, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1644:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 252, + "name": "newAddresss", + "nodeType": "VariableDeclaration", + "scope": 272, + "src": "1663:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 251, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1663:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1643:40:1" + }, + "payable": false, + "returnParameters": { + "id": 259, + "nodeType": "ParameterList", + "parameters": [], + "src": "1719:0:1" + }, + "scope": 381, + "src": "1614:209:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 288, + "nodeType": "Block", + "src": "1877:107:1", + "statements": [ + { + "assignments": [ + 278 + ], + "declarations": [ + { + "constant": false, + "id": 278, + "name": "selfbalance", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "1892:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 277, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1892:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 282, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 280, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 506, + "src": "1929:4:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Payroll_$381", + "typeString": "contract Payroll" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_Payroll_$381", + "typeString": "contract Payroll" + } + ], + "id": 279, + "name": "getAddressBalance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 380, + "src": "1911:17:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) view returns (uint256)" + } + }, + "id": 281, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1911:23:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1892:42:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 285, + "name": "totalSalary", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1966:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 283, + "name": "selfbalance", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 278, + "src": "1950:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "div", + "nodeType": "MemberAccess", + "referencedDeclaration": 434, + "src": "1950:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 286, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1950:28:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 276, + "id": 287, + "nodeType": "Return", + "src": "1943:35:1" + } + ] + }, + "id": 289, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "calculateRunway", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 273, + "nodeType": "ParameterList", + "parameters": [], + "src": "1856:2:1" + }, + "payable": false, + "returnParameters": { + "id": 276, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 275, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 289, + "src": "1872:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 274, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "1872:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1871:6:1" + }, + "scope": 381, + "src": "1832:152:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 299, + "nodeType": "Block", + "src": "2027:43:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 297, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 294, + "name": "calculateRunway", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 289, + "src": "2043:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_uint256_$", + "typeString": "function () view returns (uint256)" + } + }, + "id": 295, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2043:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 296, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2063:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "2043:21:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 293, + "id": 298, + "nodeType": "Return", + "src": "2036:28:1" + } + ] + }, + "id": 300, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "hasEnoughFund", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 290, + "nodeType": "ParameterList", + "parameters": [], + "src": "2011:2:1" + }, + "payable": false, + "returnParameters": { + "id": 293, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 292, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 300, + "src": "2022:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 291, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2022:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2021:6:1" + }, + "scope": 381, + "src": "1989:81:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 308, + "nodeType": "Block", + "src": "2118:42:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 305, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 506, + "src": "2142:4:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Payroll_$381", + "typeString": "contract Payroll" + } + }, + "id": 306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "balance", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2142:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 304, + "id": 307, + "nodeType": "Return", + "src": "2135:19:1" + } + ] + }, + "id": 309, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "addFund", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 301, + "nodeType": "ParameterList", + "parameters": [], + "src": "2093:2:1" + }, + "payable": true, + "returnParameters": { + "id": 304, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 303, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 309, + "src": "2113:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 302, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2113:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2112:6:1" + }, + "scope": 381, + "src": "2077:83:1", + "stateMutability": "payable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 368, + "nodeType": "Block", + "src": "2217:366:1", + "statements": [ + { + "assignments": [ + 316 + ], + "declarations": [ + { + "constant": false, + "id": 316, + "name": "employee", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "2226:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + }, + "typeName": null, + "value": null, + "visibility": "internal" + } + ], + "id": 321, + "initialValue": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 317, + "name": "employeeMapping", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 75, + "src": "2241:15:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_struct$_Employee_$71_storage_$", + "typeString": "mapping(address => struct Payroll.Employee storage ref)" + } + }, + "id": 320, + "indexExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 318, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 491, + "src": "2257:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 319, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2257:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2241:27:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage", + "typeString": "struct Payroll.Employee storage ref" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2226:42:1" + }, + { + "assignments": [ + 323 + ], + "declarations": [ + { + "constant": false, + "id": 323, + "name": "intervalTime", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "2277:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 322, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2277:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 329, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 326, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2305:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 327, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "lastPayday", + "nodeType": "MemberAccess", + "referencedDeclaration": 70, + "src": "2305:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 324, + "name": "now", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 493, + "src": "2297:3:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sub", + "nodeType": "MemberAccess", + "referencedDeclaration": 454, + "src": "2297:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2297:28:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2277:48:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 333, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 331, + "name": "intervalTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 323, + "src": "2342:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 332, + "name": "payDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 78, + "src": "2358:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2342:27:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 330, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 494, + "src": "2334:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2334:36:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 335, + "nodeType": "ExpressionStatement", + "src": "2334:36:1" + }, + { + "assignments": [ + 337 + ], + "declarations": [ + { + "constant": false, + "id": 337, + "name": "times", + "nodeType": "VariableDeclaration", + "scope": 369, + "src": "2387:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 336, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2387:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 342, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 340, + "name": "payDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 78, + "src": "2417:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 338, + "name": "intervalTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 323, + "src": "2400:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 339, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "div", + "nodeType": "MemberAccess", + "referencedDeclaration": 434, + "src": "2400:16:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 341, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2400:29:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2387:42:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 354, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 343, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2438:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 345, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "memberName": "lastPayday", + "nodeType": "MemberAccess", + "referencedDeclaration": 70, + "src": "2438:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 351, + "name": "payDuration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 78, + "src": "2494:11:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 349, + "name": "times", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 337, + "src": "2484:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "2484:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 352, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2484:22:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 346, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2460:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 347, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "lastPayday", + "nodeType": "MemberAccess", + "referencedDeclaration": 70, + "src": "2460:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "add", + "nodeType": "MemberAccess", + "referencedDeclaration": 478, + "src": "2460:23:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 353, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2460:47:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2438:69:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 355, + "nodeType": "ExpressionStatement", + "src": "2438:69:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 364, + "name": "times", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 337, + "src": "2570:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 361, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2550:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 362, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "salary", + "nodeType": "MemberAccess", + "referencedDeclaration": 68, + "src": "2550:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 363, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "mul", + "nodeType": "MemberAccess", + "referencedDeclaration": 416, + "src": "2550:19:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256) pure returns (uint256)" + } + }, + "id": 365, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2550:26:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 356, + "name": "employee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 316, + "src": "2516:8:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_Employee_$71_storage_ptr", + "typeString": "struct Payroll.Employee storage pointer" + } + }, + "id": 359, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "memberName": "employeeAddress", + "nodeType": "MemberAccess", + "referencedDeclaration": 66, + "src": "2516:24:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 360, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2516:33:1", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 366, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2516:61:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 367, + "nodeType": "ExpressionStatement", + "src": "2516:61:1" + } + ] + }, + "id": 369, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": [ + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 312, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 491, + "src": "2205:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 313, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2205:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 314, + "modifierName": { + "argumentTypes": null, + "id": 311, + "name": "employeeExist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 101, + "src": "2191:13:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$_t_address_$", + "typeString": "modifier (address)" + } + }, + "nodeType": "ModifierInvocation", + "src": "2191:25:1" + } + ], + "name": "getPaid", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 310, + "nodeType": "ParameterList", + "parameters": [], + "src": "2188:2:1" + }, + "payable": false, + "returnParameters": { + "id": 315, + "nodeType": "ParameterList", + "parameters": [], + "src": "2217:0:1" + }, + "scope": 381, + "src": "2172:411:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 379, + "nodeType": "Block", + "src": "2657:34:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 376, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 371, + "src": "2673:4:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 377, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "balance", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2673:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 375, + "id": 378, + "nodeType": "Return", + "src": "2666:19:1" + } + ] + }, + "id": 380, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "getAddressBalance", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 372, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 371, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 380, + "src": "2618:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 370, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2618:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2617:14:1" + }, + "payable": false, + "returnParameters": { + "id": 375, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 374, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 380, + "src": "2652:4:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 373, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "2652:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2651:6:1" + }, + "scope": 381, + "src": "2591:100:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 382, + "src": "75:2621:1" + } + ], + "src": "0:2696:1" + }, + "compiler": { + "name": "solc", + "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" + }, + "networks": { + "1521982301817": { + "events": {}, + "links": {}, + "address": "0x91f8698a1674605c57cb49dfce1c45daa9435407", + "transactionHash": "0xcdf6f89d8a437a3fe41c96fa247879fc38e34acf22433b23a40c2f45e81f1740" + } + }, + "schemaVersion": "2.0.0", + "updatedAt": "2018-03-25T12:51:53.430Z" +} \ No newline at end of file diff --git a/Lesson-4/assignment/README.md b/Lesson-4/assignment/README.md new file mode 100644 index 0000000..871e6be --- /dev/null +++ b/Lesson-4/assignment/README.md @@ -0,0 +1,12 @@ +## 硅谷live以太坊智能合约 第四课作业 +这里是同学提交作业的目录 + +### 第四课:课后作业 +- 将第三课完成的payroll.sol程序导入truffle工程 +- 在test文件夹中,写出对如下两个函数的单元测试: +- function addEmployee(address employeeId, uint salary) onlyOwner +- function removeEmployee(address employeeId) onlyOwner employeeExist(employeeId) +- 思考一下我们如何能覆盖所有的测试路径,包括函数异常的捕捉 +- (加分题,选作) +- 写出对以下函数的基于solidity或javascript的单元测试 function getPaid() employeeExist(msg.sender) +- Hint:思考如何对timestamp进行修改,是否需要对所测试的合约进行修改来达到测试的目的? diff --git a/Lesson-4/assignment/SafeMath.json b/Lesson-4/assignment/SafeMath.json new file mode 100644 index 0000000..8052a41 --- /dev/null +++ b/Lesson-4/assignment/SafeMath.json @@ -0,0 +1,2474 @@ +{ + "contractName": "SafeMath", + "abi": [], + "bytecode": "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820f7dcf086226229721658a67613edf76b952ea3f0e45da82675788a17fd8c503d0029", + "deployedBytecode": "0x6060604052600080fd00a165627a7a72305820f7dcf086226229721658a67613edf76b952ea3f0e45da82675788a17fd8c503d0029", + "sourceMap": "117:1021:2:-;;;;;;;;;;;;;;;;;", + "deployedSourceMap": "117:1021:2:-;;;;;", + "source": "pragma solidity ^0.4.18;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMath {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n assert(c / a == b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // assert(b > 0); // Solidity automatically throws when dividing by 0\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n return c;\n }\n\n /**\n * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n assert(b <= a);\n return a - b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n assert(c >= a);\n return c;\n }\n}", + "sourcePath": "/home/juicebox/payroll/contracts/SafeMath.sol", + "ast": { + "absolutePath": "/home/juicebox/payroll/contracts/SafeMath.sol", + "exportedSymbols": { + "SafeMath": [ + 479 + ] + }, + "id": 480, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 383, + "literals": [ + "solidity", + "^", + "0.4", + ".18" + ], + "nodeType": "PragmaDirective", + "src": "0:24:2" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": "@title SafeMath\n@dev Math operations with safety checks that throw on error", + "fullyImplemented": true, + "id": 479, + "linearizedBaseContracts": [ + 479 + ], + "name": "SafeMath", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 415, + "nodeType": "Block", + "src": "270:106:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 392, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 385, + "src": "280:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "285:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "280:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 398, + "nodeType": "IfStatement", + "src": "276:35:2", + "trueBody": { + "id": 397, + "nodeType": "Block", + "src": "288:23:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "hexValue": "30", + "id": 395, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "303:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 391, + "id": 396, + "nodeType": "Return", + "src": "296:8:2" + } + ] + } + }, + { + "assignments": [ + 400 + ], + "declarations": [ + { + "constant": false, + "id": 400, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 416, + "src": "316:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 399, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "316:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 404, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 403, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 401, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 385, + "src": "328:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "id": 402, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 387, + "src": "332:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "328:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "316:17:2" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 410, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 406, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "346:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "id": 407, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 385, + "src": "350:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "346:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 409, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 387, + "src": "355:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "346:10:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 405, + "name": "assert", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 482, + "src": "339:6:2", + "typeDescriptions": { + "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 411, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "339:18:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 412, + "nodeType": "ExpressionStatement", + "src": "339:18:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 413, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "370:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 391, + "id": 414, + "nodeType": "Return", + "src": "363:8:2" + } + ] + }, + "id": 416, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "mul", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 388, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 385, + "name": "a", + "nodeType": "VariableDeclaration", + "scope": 416, + "src": "216:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 384, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "216:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 387, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 416, + "src": "227:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 386, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "227:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "215:22:2" + }, + "payable": false, + "returnParameters": { + "id": 391, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 390, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 416, + "src": "261:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 389, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "261:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "260:9:2" + }, + "scope": 479, + "src": "203:173:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 433, + "nodeType": "Block", + "src": "525:198:2", + "statements": [ + { + "assignments": [ + 426 + ], + "declarations": [ + { + "constant": false, + "id": 426, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 434, + "src": "605:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 425, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "605:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 430, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 429, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 427, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 418, + "src": "617:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "id": 428, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 420, + "src": "621:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "617:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "605:17:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 431, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 426, + "src": "717:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 424, + "id": 432, + "nodeType": "Return", + "src": "710:8:2" + } + ] + }, + "id": 434, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "div", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 421, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 418, + "name": "a", + "nodeType": "VariableDeclaration", + "scope": 434, + "src": "471:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 417, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "471:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 420, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 434, + "src": "482:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 419, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "482:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "470:22:2" + }, + "payable": false, + "returnParameters": { + "id": 424, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 423, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 434, + "src": "516:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 422, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "516:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "515:9:2" + }, + "scope": 479, + "src": "458:265:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 453, + "nodeType": "Block", + "src": "902:43:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 446, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 444, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "915:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "id": 445, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 436, + "src": "920:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "915:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 443, + "name": "assert", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 482, + "src": "908:6:2", + "typeDescriptions": { + "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 447, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "908:14:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 448, + "nodeType": "ExpressionStatement", + "src": "908:14:2" + }, + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 449, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 436, + "src": "935:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 450, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "939:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "935:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 442, + "id": 452, + "nodeType": "Return", + "src": "928:12:2" + } + ] + }, + "id": 454, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "sub", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 439, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 436, + "name": "a", + "nodeType": "VariableDeclaration", + "scope": 454, + "src": "848:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 435, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "848:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 438, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 454, + "src": "859:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 437, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "859:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "847:22:2" + }, + "payable": false, + "returnParameters": { + "id": 442, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 441, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 454, + "src": "893:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "893:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "892:9:2" + }, + "scope": 479, + "src": "835:110:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 477, + "nodeType": "Block", + "src": "1074:62:2", + "statements": [ + { + "assignments": [ + 464 + ], + "declarations": [ + { + "constant": false, + "id": 464, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 478, + "src": "1080:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 463, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1080:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 468, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 465, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 456, + "src": "1092:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 466, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 458, + "src": "1096:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1092:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1080:17:2" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 472, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 470, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 464, + "src": "1110:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 471, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 456, + "src": "1115:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1110:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 469, + "name": "assert", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 482, + "src": "1103:6:2", + "typeDescriptions": { + "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1103:14:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 474, + "nodeType": "ExpressionStatement", + "src": "1103:14:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 475, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 464, + "src": "1130:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 462, + "id": 476, + "nodeType": "Return", + "src": "1123:8:2" + } + ] + }, + "id": 478, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "add", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 459, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 456, + "name": "a", + "nodeType": "VariableDeclaration", + "scope": 478, + "src": "1020:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 455, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1020:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 458, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 478, + "src": "1031:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 457, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1031:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1019:22:2" + }, + "payable": false, + "returnParameters": { + "id": 462, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 461, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 478, + "src": "1065:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 460, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1065:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1064:9:2" + }, + "scope": 479, + "src": "1007:129:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 480, + "src": "117:1021:2" + } + ], + "src": "0:1138:2" + }, + "legacyAST": { + "absolutePath": "/home/juicebox/payroll/contracts/SafeMath.sol", + "exportedSymbols": { + "SafeMath": [ + 479 + ] + }, + "id": 480, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 383, + "literals": [ + "solidity", + "^", + "0.4", + ".18" + ], + "nodeType": "PragmaDirective", + "src": "0:24:2" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": "@title SafeMath\n@dev Math operations with safety checks that throw on error", + "fullyImplemented": true, + "id": 479, + "linearizedBaseContracts": [ + 479 + ], + "name": "SafeMath", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 415, + "nodeType": "Block", + "src": "270:106:2", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 392, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 385, + "src": "280:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "30", + "id": 393, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "285:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "280:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 398, + "nodeType": "IfStatement", + "src": "276:35:2", + "trueBody": { + "id": 397, + "nodeType": "Block", + "src": "288:23:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "hexValue": "30", + "id": 395, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "303:1:2", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "functionReturnParameters": 391, + "id": 396, + "nodeType": "Return", + "src": "296:8:2" + } + ] + } + }, + { + "assignments": [ + 400 + ], + "declarations": [ + { + "constant": false, + "id": 400, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 416, + "src": "316:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 399, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "316:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 404, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 403, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 401, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 385, + "src": "328:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "argumentTypes": null, + "id": 402, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 387, + "src": "332:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "328:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "316:17:2" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 410, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 408, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 406, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "346:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "id": 407, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 385, + "src": "350:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "346:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 409, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 387, + "src": "355:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "346:10:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 405, + "name": "assert", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 482, + "src": "339:6:2", + "typeDescriptions": { + "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 411, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "339:18:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 412, + "nodeType": "ExpressionStatement", + "src": "339:18:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 413, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 400, + "src": "370:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 391, + "id": 414, + "nodeType": "Return", + "src": "363:8:2" + } + ] + }, + "id": 416, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "mul", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 388, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 385, + "name": "a", + "nodeType": "VariableDeclaration", + "scope": 416, + "src": "216:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 384, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "216:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 387, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 416, + "src": "227:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 386, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "227:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "215:22:2" + }, + "payable": false, + "returnParameters": { + "id": 391, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 390, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 416, + "src": "261:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 389, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "261:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "260:9:2" + }, + "scope": 479, + "src": "203:173:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 433, + "nodeType": "Block", + "src": "525:198:2", + "statements": [ + { + "assignments": [ + 426 + ], + "declarations": [ + { + "constant": false, + "id": 426, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 434, + "src": "605:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 425, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "605:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 430, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 429, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 427, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 418, + "src": "617:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "argumentTypes": null, + "id": 428, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 420, + "src": "621:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "617:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "605:17:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 431, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 426, + "src": "717:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 424, + "id": 432, + "nodeType": "Return", + "src": "710:8:2" + } + ] + }, + "id": 434, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "div", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 421, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 418, + "name": "a", + "nodeType": "VariableDeclaration", + "scope": 434, + "src": "471:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 417, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "471:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 420, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 434, + "src": "482:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 419, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "482:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "470:22:2" + }, + "payable": false, + "returnParameters": { + "id": 424, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 423, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 434, + "src": "516:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 422, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "516:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "515:9:2" + }, + "scope": 479, + "src": "458:265:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 453, + "nodeType": "Block", + "src": "902:43:2", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 446, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 444, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "915:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<=", + "rightExpression": { + "argumentTypes": null, + "id": 445, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 436, + "src": "920:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "915:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 443, + "name": "assert", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 482, + "src": "908:6:2", + "typeDescriptions": { + "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 447, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "908:14:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 448, + "nodeType": "ExpressionStatement", + "src": "908:14:2" + }, + { + "expression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 451, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 449, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 436, + "src": "935:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "id": 450, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 438, + "src": "939:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "935:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 442, + "id": 452, + "nodeType": "Return", + "src": "928:12:2" + } + ] + }, + "id": 454, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "sub", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 439, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 436, + "name": "a", + "nodeType": "VariableDeclaration", + "scope": 454, + "src": "848:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 435, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "848:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 438, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 454, + "src": "859:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 437, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "859:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "847:22:2" + }, + "payable": false, + "returnParameters": { + "id": 442, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 441, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 454, + "src": "893:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 440, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "893:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "892:9:2" + }, + "scope": 479, + "src": "835:110:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 477, + "nodeType": "Block", + "src": "1074:62:2", + "statements": [ + { + "assignments": [ + 464 + ], + "declarations": [ + { + "constant": false, + "id": 464, + "name": "c", + "nodeType": "VariableDeclaration", + "scope": 478, + "src": "1080:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 463, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1080:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 468, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 467, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 465, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 456, + "src": "1092:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 466, + "name": "b", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 458, + "src": "1096:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1092:5:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1080:17:2" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 472, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 470, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 464, + "src": "1110:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "argumentTypes": null, + "id": 471, + "name": "a", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 456, + "src": "1115:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1110:6:2", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 469, + "name": "assert", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 482, + "src": "1103:6:2", + "typeDescriptions": { + "typeIdentifier": "t_function_assert_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 473, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1103:14:2", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 474, + "nodeType": "ExpressionStatement", + "src": "1103:14:2" + }, + { + "expression": { + "argumentTypes": null, + "id": 475, + "name": "c", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 464, + "src": "1130:1:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 462, + "id": 476, + "nodeType": "Return", + "src": "1123:8:2" + } + ] + }, + "id": 478, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "add", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 459, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 456, + "name": "a", + "nodeType": "VariableDeclaration", + "scope": 478, + "src": "1020:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 455, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1020:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 458, + "name": "b", + "nodeType": "VariableDeclaration", + "scope": 478, + "src": "1031:9:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 457, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1031:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1019:22:2" + }, + "payable": false, + "returnParameters": { + "id": 462, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 461, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 478, + "src": "1065:7:2", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 460, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1065:7:2", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1064:9:2" + }, + "scope": 479, + "src": "1007:129:2", + "stateMutability": "pure", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 480, + "src": "117:1021:2" + } + ], + "src": "0:1138:2" + }, + "compiler": { + "name": "solc", + "version": "0.4.19+commit.c4cbbb05.Emscripten.clang" + }, + "networks": { + "1521982301817": { + "events": {}, + "links": {}, + "address": "0x635c1a604b1ef95bab198a2c2680b36ab6cbc703", + "transactionHash": "0xbd7538d1c66c8e99791c73a7e372cdafca6d4705daa27cb6b5db96e074d93e08" + } + }, + "schemaVersion": "2.0.0", + "updatedAt": "2018-03-25T12:51:53.547Z" +} \ No newline at end of file diff --git a/Lesson-4/assignment/TestPayroll.sol b/Lesson-4/assignment/TestPayroll.sol new file mode 100644 index 0000000..5904954 --- /dev/null +++ b/Lesson-4/assignment/TestPayroll.sol @@ -0,0 +1,23 @@ +pragma solidity ^0.4.2; + +import "truffle/Assert.sol"; +import "truffle/DeployedAddresses.sol"; +import "../contracts/Payroll.sol"; + + +contract TestPayroll is Payroll{ + + + function testAddEmployee(address addr,uint sal) public { + + addEmployee(addr,sal); + + Assert.equal(employeeMapping[addr].salary, sal, "添加失败"); + } + + function testRemoveEmployee(address addr) public { + removeEmployee(addr); + Assert.equal(employeeMapping[addr].salary, 0, "删除失败"); + } + +} diff --git a/Lesson-4/assignment/TruffleMigration.txt b/Lesson-4/assignment/TruffleMigration.txt new file mode 100644 index 0000000..c8e5247 --- /dev/null +++ b/Lesson-4/assignment/TruffleMigration.txt @@ -0,0 +1,46 @@ +juicebox@juicebox:~/payroll$ truffle migration +Using network 'development'. + +Running migration: 1_initial_migration.js + Deploying Migrations... + ... 0xac9ab32afd53aa3d7e9c002905eaebcba30dd3b03bf9e3245aad913185b53cab + Migrations: 0x3f8b279d141d9c56da2595dcf55a6af8dd892e9b +Saving successful migration to network... + ... 0x97082d9b1e8f284870dd4bd3315890d41105bfeba064387b1de335e0e8f28ba1 +Saving artifacts... +Running migration: 2_deploy_contracts.js + Deploying Ownable... + ... 0xd9110b8c98ebd16286a6630c644828680a1536471eb5fcfc9441aa18481e8366 + Ownable: 0xd02a561e01c7abfe949c6ed56cbb3f50d1042cf5 + Deploying SafeMath... + ... 0xbd7538d1c66c8e99791c73a7e372cdafca6d4705daa27cb6b5db96e074d93e08 + SafeMath: 0x635c1a604b1ef95bab198a2c2680b36ab6cbc703 + Deploying Payroll... + ... 0xcdf6f89d8a437a3fe41c96fa247879fc38e34acf22433b23a40c2f45e81f1740 + Payroll: 0x91f8698a1674605c57cb49dfce1c45daa9435407 +Saving successful migration to network... + ... 0xa611f1b920e909fb8ce0a8d51660ea9ffe885d6922f497da88b6d3c99ca27ad1 +Saving artifacts... + + + + +Transaction: 0xcdf6f89d8a437a3fe41c96fa247879fc38e34acf22433b23a40c2f45e81f1740 + Contract created: 0x91f8698a1674605c57cb49dfce1c45daa9435407 + Gas usage: 1179413 + Block Number: 5 + Block Time: Sun Mar 25 2018 12:51:53 GMT+0000 (UTC) + +eth_newBlockFilter +eth_getFilterChanges +eth_getTransactionReceipt +eth_getCode +eth_uninstallFilter +eth_sendTransaction + + Transaction: 0xa611f1b920e909fb8ce0a8d51660ea9ffe885d6922f497da88b6d3c99ca27ad1 + Gas usage: 26981 + Block Number: 6 + Block Time: Sun Mar 25 2018 12:51:53 GMT+0000 (UTC) + +eth_getTransactionReceipt diff --git a/Lesson-4/orgin/README.md b/Lesson-4/orgin/README.md new file mode 100644 index 0000000..c27ba05 --- /dev/null +++ b/Lesson-4/orgin/README.md @@ -0,0 +1,3 @@ +## 硅谷live以太坊智能合约 第四课 + +这里是每一课的初始代码,有需要的同学可以参考 diff --git a/Lesson-4/orgin/payroll.sol b/Lesson-4/orgin/payroll.sol new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Lesson-4/orgin/payroll.sol @@ -0,0 +1 @@ + diff --git a/Lesson-5/README.md b/Lesson-5/README.md new file mode 100644 index 0000000..0d3ed1d --- /dev/null +++ b/Lesson-5/README.md @@ -0,0 +1,13 @@ +## 硅谷live以太坊智能合约频道官方地址 + +### 第五课 + +目录结构 +
| +
|--orgin 课程初始代码 +
| +
|--assignment 课程作业提交代码 +
+ +### 本节知识点 + diff --git a/Lesson-5/assignment/README.md b/Lesson-5/assignment/README.md new file mode 100644 index 0000000..5661cd3 --- /dev/null +++ b/Lesson-5/assignment/README.md @@ -0,0 +1,2 @@ +## 硅谷live以太坊智能合约 第五课作业 +这里是同学提交作业的目录 diff --git a/Lesson-5/assignment/yours.sol b/Lesson-5/assignment/yours.sol new file mode 100644 index 0000000..dfdb2c4 --- /dev/null +++ b/Lesson-5/assignment/yours.sol @@ -0,0 +1 @@ +/*作业请提交在这个目录下*/ diff --git a/Lesson-5/orgin/LICENSE b/Lesson-5/orgin/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/Lesson-5/orgin/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Lesson-5/orgin/README.md b/Lesson-5/orgin/README.md new file mode 100644 index 0000000..7c98c03 --- /dev/null +++ b/Lesson-5/orgin/README.md @@ -0,0 +1,13 @@ +# payroll + +A payroll system developed with React and Solidty for Ethereum Blockchain platform. + +## Get Started + +1. Install dependencies `npm install -g truffle ethereumjs-testrpc` +1. Install [Metamask](https://metamask.io/) +1. Run `testrpc` +1. Add first account in testrpc to Metamask by importing private key +1. Run `truffle compile` in the project directory +1. `truffle migrate` +1. `npm run start` diff --git a/Lesson-5/orgin/box-img-lg.png b/Lesson-5/orgin/box-img-lg.png new file mode 100644 index 0000000..60c1996 Binary files /dev/null and b/Lesson-5/orgin/box-img-lg.png differ diff --git a/Lesson-5/orgin/box-img-sm.png b/Lesson-5/orgin/box-img-sm.png new file mode 100644 index 0000000..466e709 Binary files /dev/null and b/Lesson-5/orgin/box-img-sm.png differ diff --git a/Lesson-5/orgin/config/env.js b/Lesson-5/orgin/config/env.js new file mode 100644 index 0000000..5d0ab7b --- /dev/null +++ b/Lesson-5/orgin/config/env.js @@ -0,0 +1,28 @@ +// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be +// injected into the application via DefinePlugin in Webpack configuration. + +var REACT_APP = /^REACT_APP_/i; + +function getClientEnvironment(publicUrl) { + var processEnv = Object + .keys(process.env) + .filter(key => REACT_APP.test(key)) + .reduce((env, key) => { + env[key] = JSON.stringify(process.env[key]); + return env; + }, { + // Useful for determining whether we’re running in production mode. + // Most importantly, it switches React into the correct mode. + 'NODE_ENV': JSON.stringify( + process.env.NODE_ENV || 'development' + ), + // Useful for resolving the correct path to static assets in `public`. + // For example, . + // This should only be used as an escape hatch. Normally you would put + // images into the `src` and `import` them in code to get their paths. + 'PUBLIC_URL': JSON.stringify(publicUrl) + }); + return {'process.env': processEnv}; +} + +module.exports = getClientEnvironment; diff --git a/Lesson-5/orgin/config/jest/cssTransform.js b/Lesson-5/orgin/config/jest/cssTransform.js new file mode 100644 index 0000000..aa17d12 --- /dev/null +++ b/Lesson-5/orgin/config/jest/cssTransform.js @@ -0,0 +1,12 @@ +// This is a custom Jest transformer turning style imports into empty objects. +// http://facebook.github.io/jest/docs/tutorial-webpack.html + +module.exports = { + process() { + return 'module.exports = {};'; + }, + getCacheKey(fileData, filename) { + // The output is always the same. + return 'cssTransform'; + }, +}; diff --git a/Lesson-5/orgin/config/jest/fileTransform.js b/Lesson-5/orgin/config/jest/fileTransform.js new file mode 100644 index 0000000..927eb30 --- /dev/null +++ b/Lesson-5/orgin/config/jest/fileTransform.js @@ -0,0 +1,10 @@ +const path = require('path'); + +// This is a custom Jest transformer turning file imports into filenames. +// http://facebook.github.io/jest/docs/tutorial-webpack.html + +module.exports = { + process(src, filename) { + return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';'; + }, +}; diff --git a/Lesson-5/orgin/config/paths.js b/Lesson-5/orgin/config/paths.js new file mode 100644 index 0000000..96c3dfb --- /dev/null +++ b/Lesson-5/orgin/config/paths.js @@ -0,0 +1,46 @@ +var path = require('path'); +var fs = require('fs'); + +// Make sure any symlinks in the project folder are resolved: +// https://github.com/facebookincubator/create-react-app/issues/637 +var appDirectory = fs.realpathSync(process.cwd()); +function resolveApp(relativePath) { + return path.resolve(appDirectory, relativePath); +} + +// We support resolving modules according to `NODE_PATH`. +// This lets you use absolute paths in imports inside large monorepos: +// https://github.com/facebookincubator/create-react-app/issues/253. + +// It works similar to `NODE_PATH` in Node itself: +// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders + +// We will export `nodePaths` as an array of absolute paths. +// It will then be used by Webpack configs. +// Jest doesn’t need this because it already handles `NODE_PATH` out of the box. + +// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. +// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. +// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 + +var nodePaths = (process.env.NODE_PATH || '') + .split(process.platform === 'win32' ? ';' : ':') + .filter(Boolean) + .filter(folder => !path.isAbsolute(folder)) + .map(resolveApp); + +// config after eject: we're in ./config/ +module.exports = { + // Changed from build to build_webpack so smart contract compilations are not overwritten. + appBuild: resolveApp('build_webpack'), + appPublic: resolveApp('public'), + appHtml: resolveApp('public/index.html'), + appIndexJs: resolveApp('src/index.js'), + appPackageJson: resolveApp('package.json'), + appSrc: resolveApp('src'), + yarnLockFile: resolveApp('yarn.lock'), + testsSetup: resolveApp('src/setupTests.js'), + appNodeModules: resolveApp('node_modules'), + ownNodeModules: resolveApp('node_modules'), + nodePaths: nodePaths +}; diff --git a/Lesson-5/orgin/config/polyfills.js b/Lesson-5/orgin/config/polyfills.js new file mode 100644 index 0000000..7e60150 --- /dev/null +++ b/Lesson-5/orgin/config/polyfills.js @@ -0,0 +1,14 @@ +if (typeof Promise === 'undefined') { + // Rejection tracking prevents a common issue where React gets into an + // inconsistent state due to an error, but it gets swallowed by a Promise, + // and the user has no idea what causes React's erratic future behavior. + require('promise/lib/rejection-tracking').enable(); + window.Promise = require('promise/lib/es6-extensions.js'); +} + +// fetch() polyfill for making API calls. +require('whatwg-fetch'); + +// Object.assign() is commonly used with React. +// It will use the native implementation if it's present and isn't buggy. +Object.assign = require('object-assign'); diff --git a/Lesson-5/orgin/config/webpack.config.dev.js b/Lesson-5/orgin/config/webpack.config.dev.js new file mode 100644 index 0000000..821743a --- /dev/null +++ b/Lesson-5/orgin/config/webpack.config.dev.js @@ -0,0 +1,242 @@ +var autoprefixer = require('autoprefixer'); +var webpack = require('webpack'); +var HtmlWebpackPlugin = require('html-webpack-plugin'); +var CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); +var InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); +var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); +var getClientEnvironment = require('./env'); +var paths = require('./paths'); + + + +// Webpack uses `publicPath` to determine where the app is being served from. +// In development, we always serve from the root. This makes config easier. +var publicPath = '/'; +// `publicUrl` is just like `publicPath`, but we will provide it to our app +// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. +// Omit trailing slash as %PUBLIC_PATH%/xyz looks better than %PUBLIC_PATH%xyz. +var publicUrl = ''; +// Get environment variables to inject into our app. +var env = getClientEnvironment(publicUrl); + +// This is the development configuration. +// It is focused on developer experience and fast rebuilds. +// The production configuration is different and lives in a separate file. +module.exports = { + // You may want 'eval' instead if you prefer to see the compiled output in DevTools. + // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343. + devtool: 'cheap-module-source-map', + // These are the "entry points" to our application. + // This means they will be the "root" imports that are included in JS bundle. + // The first two entry points enable "hot" CSS and auto-refreshes for JS. + entry: [ + // Include an alternative client for WebpackDevServer. A client's job is to + // connect to WebpackDevServer by a socket and get notified about changes. + // When you save a file, the client will either apply hot updates (in case + // of CSS changes), or refresh the page (in case of JS changes). When you + // make a syntax error, this client will display a syntax error overlay. + // Note: instead of the default WebpackDevServer client, we use a custom one + // to bring better experience for Create React App users. You can replace + // the line below with these two lines if you prefer the stock client: + // require.resolve('webpack-dev-server/client') + '?/', + // require.resolve('webpack/hot/dev-server'), + require.resolve('react-dev-utils/webpackHotDevClient'), + // We ship a few polyfills by default: + require.resolve('./polyfills'), + // Finally, this is your app's code: + paths.appIndexJs + // We include the app code last so that if there is a runtime error during + // initialization, it doesn't blow up the WebpackDevServer client, and + // changing JS code would still trigger a refresh. + ], + output: { + // Next line is not used in dev but WebpackDevServer crashes without it: + path: paths.appBuild, + // Add /* filename */ comments to generated require()s in the output. + pathinfo: true, + // This does not produce a real file. It's just the virtual path that is + // served by WebpackDevServer in development. This is the JS bundle + // containing code from all our entry points, and the Webpack runtime. + filename: 'static/js/bundle.js', + // This is the URL that app is served from. We use "/" in development. + publicPath: publicPath + }, + resolve: { + // This allows you to set a fallback for where Webpack should look for modules. + // We read `NODE_PATH` environment variable in `paths.js` and pass paths here. + // We use `fallback` instead of `root` because we want `node_modules` to "win" + // if there any conflicts. This matches Node resolution mechanism. + // https://github.com/facebookincubator/create-react-app/issues/253 + fallback: paths.nodePaths, + // These are the reasonable defaults supported by the Node ecosystem. + // We also include JSX as a common component filename extension to support + // some tools, although we do not recommend using it, see: + // https://github.com/facebookincubator/create-react-app/issues/290 + extensions: ['.js', '.json', '.jsx', ''], + alias: { + // Support React Native Web + // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ + 'react-native': 'react-native-web' + } + }, + + module: { + // First, run the linter. + // It's important to do this before Babel processes the JS. + preLoaders: [ + { + test: /\.(js|jsx)$/, + loader: 'eslint', + include: paths.appSrc, + } + ], + loaders: [ + // Default loader: load all assets that are not handled + // by other loaders with the url loader. + // Note: This list needs to be updated with every change of extensions + // the other loaders match. + // E.g., when adding a loader for a new supported file extension, + // we need to add the supported extension to this loader too. + // Add one new line in `exclude` for each loader. + // + // "file" loader makes sure those assets get served by WebpackDevServer. + // When you `import` an asset, you get its (virtual) filename. + // In production, they would get copied to the `build` folder. + // "url" loader works like "file" loader except that it embeds assets + // smaller than specified limit in bytes as data URLs to avoid requests. + // A missing `test` is equivalent to a match. + { + exclude: [ + /\.html$/, + /\.(js|jsx)$/, + /\.css$/, + /\.json$/, + /\.woff$/, + /\.woff2$/, + /\.(ttf|svg|eot)$/ + ], + loader: 'url', + query: { + limit: 10000, + name: 'static/media/[name].[hash:8].[ext]' + } + }, + // Process JS with Babel. + { + test: /\.(js|jsx)$/, + include: paths.appSrc, + loader: 'babel', + query: { + + // This is a feature of `babel-loader` for webpack (not Babel itself). + // It enables caching results in ./node_modules/.cache/babel-loader/ + // directory for faster rebuilds. + cacheDirectory: true + } + }, + // "postcss" loader applies autoprefixer to our CSS. + // "css" loader resolves paths in CSS and adds assets as dependencies. + // "style" loader turns CSS into JS modules that inject