diff --git a/Lesson2/README.md b/Lesson2/README.md
new file mode 100644
index 000000000..1fdc5b30b
--- /dev/null
+++ b/Lesson2/README.md
@@ -0,0 +1,16 @@
+## 硅谷live以太坊智能合约频道官方地址
+
+### 第二课《智能合约设计进阶-多员工薪酬系统》
+
+目录结构
+
|
+
|--orgin 课程初始代码
+
|
+
|--assignment 课程作业提交代码
+
+### 本节知识点
+第2课:智能合约设计进阶-多员工薪酬系统
+- 动态静态数组的不同
+- 函数输入参数检查 revert
+- 循环与遍历的安全性
+- 程序运行错误检查和容错:assert与require
diff --git a/Lesson2/assignment/README.md b/Lesson2/assignment/README.md
new file mode 100644
index 000000000..a1fa2d047
--- /dev/null
+++ b/Lesson2/assignment/README.md
@@ -0,0 +1,10 @@
+## 硅谷live以太坊智能合约 第二课作业
+这里是同学提交作业的目录
+
+### 第二课:课后作业
+完成今天的智能合约添加100ETH到合约中
+- 加入十个员工,每个员工的薪水都是1ETH
+每次加入一个员工后调用calculateRunway这个函数,并且记录消耗的gas是多少?Gas变化么?如果有 为什么?
+- 如何优化calculateRunway这个函数来减少gas的消耗?
+提交:智能合约代码,gas变化的记录,calculateRunway函数的优化
+
diff --git a/Lesson2/assignment/yours.sol b/Lesson2/assignment/yours.sol
new file mode 100644
index 000000000..dfdb2c486
--- /dev/null
+++ b/Lesson2/assignment/yours.sol
@@ -0,0 +1 @@
+/*作业请提交在这个目录下*/
diff --git a/Lesson2/orgin/README.md b/Lesson2/orgin/README.md
new file mode 100644
index 000000000..0309d947c
--- /dev/null
+++ b/Lesson2/orgin/README.md
@@ -0,0 +1,3 @@
+## 硅谷live以太坊智能合约 第二课《智能合约设计进阶-多员工薪酬系统》
+
+这里是每一课的初始代码,有需要的同学可以参考
diff --git a/Lesson2/orgin/payroll.sol b/Lesson2/orgin/payroll.sol
new file mode 100644
index 000000000..62e380e4c
--- /dev/null
+++ b/Lesson2/orgin/payroll.sol
@@ -0,0 +1,50 @@
+pragma solidity ^0.4.14;
+
+contract Payroll {
+ struct Employee {
+ address id;
+ uint salary;
+ uint lastPayday;
+ }
+
+ uint constant payDuration = 10 seconds;
+
+ address owner;
+ Employee[] employees;
+
+ function Payroll() {
+ owner = msg.sender;
+ }
+
+ function _partialPaid(Employee employee) private {
+ }
+
+ function _findEmployee(address employeeId) private returns (Employee, uint) {
+ }
+
+ function addEmployee(address employeeId, uint salary) {
+ }
+
+ function removeEmployee(address employeeId) {
+ }
+
+ function updateEmployee(address employeeId, uint salary) {
+ }
+
+ function addFund() payable returns (uint) {
+ }
+
+ function calculateRunway() returns (uint) {
+ uint totalSalary = 0;
+ for (uint i = 0; i < employees.length; i++) {
+ totalSalary += employees[i].salary;
+ }
+ return this.balance / totalSalary;
+ }
+
+ function hasEnoughFund() returns (bool) {
+ }
+
+ function getPaid() {
+ }
+}
diff --git a/Lesson3/README.md b/Lesson3/README.md
new file mode 100644
index 000000000..ba26ced65
--- /dev/null
+++ b/Lesson3/README.md
@@ -0,0 +1,16 @@
+## 硅谷live以太坊智能合约频道官方地址
+
+### 第三课《智能合约后端优化和产品化》
+
+目录结构
+
|
+
|--orgin 课程初始代码
+
|
+
|--assignment 课程作业提交代码
+
+### 本节知识点
+第3课:智能合约后端优化和产品化
+- 如何通过数据结构优化降低合约执行成本
+- 合约的继承
+- 巧用modifier
+- 以太坊函数库的使用和基本介绍
diff --git a/Lesson3/assignment/README.md b/Lesson3/assignment/README.md
new file mode 100644
index 000000000..01011eb46
--- /dev/null
+++ b/Lesson3/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/Lesson3/assignment/yours.sol b/Lesson3/assignment/yours.sol
new file mode 100644
index 000000000..e85f425f9
--- /dev/null
+++ b/Lesson3/assignment/yours.sol
@@ -0,0 +1,83 @@
+pragma solidity ^ 0.4.14;
+import "./SafeMath.sol";
+contract Payroll {
+ using SafeMath for uint;
+ struct Employee {
+ address id;
+ uint salary;
+ uint lastPayday;
+ }
+ uint constant payDuration = 10 seconds;
+ address owner;
+ mapping (address => Employee) employees;
+
+ uint totalSalary = 0;
+
+ function Payroll() public {
+ owner = msg.sender;
+ }
+
+ function _partialPaid(Employee employee) private {
+ uint payment = employee.salary.mul((now.sub(employee.lastPayday)).div(payDuration)) ;
+ if(payment > 0){
+ employee.lastPayday = now;
+ employee.id.transfer(payment);
+ }
+ }
+
+
+ modifier requireOwner() {
+ require(msg.sender == owner);
+ _;
+ }
+
+ modifier validAddress(address addr) {
+ require(addr != 0x0);
+ _;
+ }
+
+ function addEmployee(address employeeId, uint salary) public requireOwner
+ validAddress(employeeId){
+ var e = employees[employeeId];
+ if (e.id != 0x0) revert();
+ totalSalary = totalSalary.add(salary);
+ employees[employeeId] = Employee(employeeId, salary, now);
+ }
+
+ function removeEmployee(address employeeId) public payable requireOwner validAddress(employeeId){
+ var e = employees[employeeId];
+ if (e.id == 0x0) revert();
+ _partialPaid(e);
+ totalSalary-= e.salary;
+ }
+
+ function updateEmployee(address employeeId, uint salary) public requireOwner payable validAddress(employeeId){
+ var e = employees[employeeId];
+ if (e.id == 0x0) revert();
+ e.salary = salary;
+ }
+
+
+ function addFund() public payable returns(uint)
+ {
+ return this.balance;
+ }
+
+
+
+ function calculateRunway() public view returns(uint) {
+ return totalSalary;
+ }
+
+ function hasEnoughFund() public view returns(bool) {
+ return calculateRunway() > 0;
+ }
+
+ function getPaid(Employee e) internal requireOwner {
+
+ var nextPayday = e.lastPayday.add(payDuration);
+ assert(nextPayday < now);
+ e.lastPayday = nextPayday;
+ e.id.transfer(e.salary);
+ }
+}
\ No newline at end of file
diff --git a/Lesson3/orgin/README.md b/Lesson3/orgin/README.md
new file mode 100644
index 000000000..6106ea195
--- /dev/null
+++ b/Lesson3/orgin/README.md
@@ -0,0 +1,3 @@
+## 硅谷live以太坊智能合约 第三课
+
+这里是每一课的初始代码,有需要的同学可以参考
diff --git a/lesson3/SafeMath.sol b/Lesson3/orgin/payroll.sol
similarity index 100%
rename from lesson3/SafeMath.sol
rename to Lesson3/orgin/payroll.sol
diff --git a/Lesson4/README.md b/Lesson4/README.md
new file mode 100644
index 000000000..34bf0bb82
--- /dev/null
+++ b/Lesson4/README.md
@@ -0,0 +1,16 @@
+## 硅谷live以太坊智能合约频道官方地址
+
+### 第四课《使用Truffle架构进行前后端交互,测试,部署》
+
+目录结构
+
|
+
|--orgin 课程初始代码
+
|
+
|--assignment 课程作业提交代码
+
+### 本节知识点
+第4课:使用Truffle架构进行前后端交互,测试,部署
+- 为什么要用Truffle,Truffle的基本概念
+- Truffle 的command line 功能
+- 初始化项目与Truffle项目目录结构
+- 编译部署合约到testrpc
diff --git a/Lesson4/assignment/README.md b/Lesson4/assignment/README.md
new file mode 100644
index 000000000..871e6be04
--- /dev/null
+++ b/Lesson4/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/Lesson4/assignment/build/contracts/Migrations.json b/Lesson4/assignment/build/contracts/Migrations.json
new file mode 100644
index 000000000..8b66f2025
--- /dev/null
+++ b/Lesson4/assignment/build/contracts/Migrations.json
@@ -0,0 +1,837 @@
+{
+ "contractName": "Migrations",
+ "abi": [
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "new_address",
+ "type": "address"
+ }
+ ],
+ "name": "upgrade",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "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"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "completed",
+ "type": "uint256"
+ }
+ ],
+ "name": "setCompleted",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ],
+ "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a723058202ea818b86103694f34f10854858032f20d4cd1ab010812011ee2cb75b4304d630029",
+ "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a723058202ea818b86103694f34f10854858032f20d4cd1ab010812011ee2cb75b4304d630029",
+ "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": "/Users/bowman_apple/guigulive-operation/Lesson4/assignment/contracts/Migrations.sol",
+ "ast": {
+ "attributes": {
+ "absolutePath": "/Users/bowman_apple/guigulive-operation/Lesson4/assignment/contracts/Migrations.sol",
+ "exportedSymbols": {
+ "Migrations": [
+ 56
+ ]
+ }
+ },
+ "children": [
+ {
+ "attributes": {
+ "literals": [
+ "solidity",
+ "^",
+ "0.4",
+ ".2"
+ ]
+ },
+ "id": 1,
+ "name": "PragmaDirective",
+ "src": "0:23:0"
+ },
+ {
+ "attributes": {
+ "baseContracts": [
+ null
+ ],
+ "contractDependencies": [
+ null
+ ],
+ "contractKind": "contract",
+ "documentation": null,
+ "fullyImplemented": true,
+ "linearizedBaseContracts": [
+ 56
+ ],
+ "name": "Migrations",
+ "scope": 57
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "owner",
+ "scope": 56,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 2,
+ "name": "ElementaryTypeName",
+ "src": "49:7:0"
+ }
+ ],
+ "id": 3,
+ "name": "VariableDeclaration",
+ "src": "49:20:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "last_completed_migration",
+ "scope": 56,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 4,
+ "name": "ElementaryTypeName",
+ "src": "73:4:0"
+ }
+ ],
+ "id": 5,
+ "name": "VariableDeclaration",
+ "src": "73:36:0"
+ },
+ {
+ "attributes": {
+ "name": "restricted",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 6,
+ "name": "ParameterList",
+ "src": "133:2:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "falseBody": null
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "==",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sender",
+ "referencedDeclaration": null,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 478,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 7,
+ "name": "Identifier",
+ "src": "146:3:0"
+ }
+ ],
+ "id": 8,
+ "name": "MemberAccess",
+ "src": "146:10:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 3,
+ "type": "address",
+ "value": "owner"
+ },
+ "id": 9,
+ "name": "Identifier",
+ "src": "160:5:0"
+ }
+ ],
+ "id": 10,
+ "name": "BinaryOperation",
+ "src": "146:19:0"
+ },
+ {
+ "id": 11,
+ "name": "PlaceholderStatement",
+ "src": "167:1:0"
+ }
+ ],
+ "id": 12,
+ "name": "IfStatement",
+ "src": "142:26:0"
+ }
+ ],
+ "id": 13,
+ "name": "Block",
+ "src": "136:37:0"
+ }
+ ],
+ "id": 14,
+ "name": "ModifierDefinition",
+ "src": "114:59:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": true,
+ "modifiers": [
+ null
+ ],
+ "name": "Migrations",
+ "payable": false,
+ "scope": 56,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 15,
+ "name": "ParameterList",
+ "src": "196:2:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 16,
+ "name": "ParameterList",
+ "src": "206:0:0"
+ },
+ {
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 3,
+ "type": "address",
+ "value": "owner"
+ },
+ "id": 17,
+ "name": "Identifier",
+ "src": "212:5:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sender",
+ "referencedDeclaration": null,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 478,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 18,
+ "name": "Identifier",
+ "src": "220:3:0"
+ }
+ ],
+ "id": 19,
+ "name": "MemberAccess",
+ "src": "220:10:0"
+ }
+ ],
+ "id": 20,
+ "name": "Assignment",
+ "src": "212:18:0"
+ }
+ ],
+ "id": 21,
+ "name": "ExpressionStatement",
+ "src": "212:18:0"
+ }
+ ],
+ "id": 22,
+ "name": "Block",
+ "src": "206:29:0"
+ }
+ ],
+ "id": 23,
+ "name": "FunctionDefinition",
+ "src": "177:58:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "setCompleted",
+ "payable": false,
+ "scope": 56,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "completed",
+ "scope": 35,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 24,
+ "name": "ElementaryTypeName",
+ "src": "261:4:0"
+ }
+ ],
+ "id": 25,
+ "name": "VariableDeclaration",
+ "src": "261:14:0"
+ }
+ ],
+ "id": 26,
+ "name": "ParameterList",
+ "src": "260:16:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 29,
+ "name": "ParameterList",
+ "src": "295:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 14,
+ "type": "modifier ()",
+ "value": "restricted"
+ },
+ "id": 27,
+ "name": "Identifier",
+ "src": "284:10:0"
+ }
+ ],
+ "id": 28,
+ "name": "ModifierInvocation",
+ "src": "284:10:0"
+ },
+ {
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 5,
+ "type": "uint256",
+ "value": "last_completed_migration"
+ },
+ "id": 30,
+ "name": "Identifier",
+ "src": "301:24:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 25,
+ "type": "uint256",
+ "value": "completed"
+ },
+ "id": 31,
+ "name": "Identifier",
+ "src": "328:9:0"
+ }
+ ],
+ "id": 32,
+ "name": "Assignment",
+ "src": "301:36:0"
+ }
+ ],
+ "id": 33,
+ "name": "ExpressionStatement",
+ "src": "301:36:0"
+ }
+ ],
+ "id": 34,
+ "name": "Block",
+ "src": "295:47:0"
+ }
+ ],
+ "id": 35,
+ "name": "FunctionDefinition",
+ "src": "239:103:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "upgrade",
+ "payable": false,
+ "scope": 56,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "new_address",
+ "scope": 55,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 36,
+ "name": "ElementaryTypeName",
+ "src": "363:7:0"
+ }
+ ],
+ "id": 37,
+ "name": "VariableDeclaration",
+ "src": "363:19:0"
+ }
+ ],
+ "id": 38,
+ "name": "ParameterList",
+ "src": "362:21:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 41,
+ "name": "ParameterList",
+ "src": "402:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 14,
+ "type": "modifier ()",
+ "value": "restricted"
+ },
+ "id": 39,
+ "name": "Identifier",
+ "src": "391:10:0"
+ }
+ ],
+ "id": 40,
+ "name": "ModifierInvocation",
+ "src": "391:10:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 43
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "upgraded",
+ "scope": 55,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "contract Migrations",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "Migrations",
+ "referencedDeclaration": 56,
+ "type": "contract Migrations"
+ },
+ "id": 42,
+ "name": "UserDefinedTypeName",
+ "src": "408:10:0"
+ }
+ ],
+ "id": 43,
+ "name": "VariableDeclaration",
+ "src": "408:19:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "contract Migrations",
+ "type_conversion": true
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 56,
+ "type": "type(contract Migrations)",
+ "value": "Migrations"
+ },
+ "id": 44,
+ "name": "Identifier",
+ "src": "430:10:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 37,
+ "type": "address",
+ "value": "new_address"
+ },
+ "id": 45,
+ "name": "Identifier",
+ "src": "441:11:0"
+ }
+ ],
+ "id": 46,
+ "name": "FunctionCall",
+ "src": "430:23:0"
+ }
+ ],
+ "id": 47,
+ "name": "VariableDeclarationStatement",
+ "src": "408:45:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "setCompleted",
+ "referencedDeclaration": 35,
+ "type": "function (uint256) external"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 43,
+ "type": "contract Migrations",
+ "value": "upgraded"
+ },
+ "id": 48,
+ "name": "Identifier",
+ "src": "459:8:0"
+ }
+ ],
+ "id": 50,
+ "name": "MemberAccess",
+ "src": "459:21:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 5,
+ "type": "uint256",
+ "value": "last_completed_migration"
+ },
+ "id": 51,
+ "name": "Identifier",
+ "src": "481:24:0"
+ }
+ ],
+ "id": 52,
+ "name": "FunctionCall",
+ "src": "459:47:0"
+ }
+ ],
+ "id": 53,
+ "name": "ExpressionStatement",
+ "src": "459:47:0"
+ }
+ ],
+ "id": 54,
+ "name": "Block",
+ "src": "402:109:0"
+ }
+ ],
+ "id": 55,
+ "name": "FunctionDefinition",
+ "src": "346:165:0"
+ }
+ ],
+ "id": 56,
+ "name": "ContractDefinition",
+ "src": "25:488:0"
+ }
+ ],
+ "id": 57,
+ "name": "SourceUnit",
+ "src": "0:514:0"
+ },
+ "compiler": {
+ "name": "solc",
+ "version": "0.4.18+commit.9cf6e910.Emscripten.clang"
+ },
+ "networks": {
+ "4447": {
+ "events": {},
+ "links": {},
+ "address": "0x8cdaf0cd259887258bc13a92c0a6da92698644c0"
+ },
+ "5777": {
+ "events": {},
+ "links": {},
+ "address": "0x345ca3e014aaf5dca488057592ee47305d9b3e10"
+ },
+ "1516494346939": {
+ "events": {},
+ "links": {},
+ "address": "0x0dc9474ffd55ebfcb47239e73a57591a9701c897"
+ }
+ },
+ "schemaVersion": "1.0.1",
+ "updatedAt": "2018-01-31T20:36:45.858Z"
+}
\ No newline at end of file
diff --git a/Lesson4/assignment/build/contracts/Payroll.json b/Lesson4/assignment/build/contracts/Payroll.json
new file mode 100644
index 000000000..9b28f31a3
--- /dev/null
+++ b/Lesson4/assignment/build/contracts/Payroll.json
@@ -0,0 +1,4826 @@
+{
+ "contractName": "Payroll",
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getBalance",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "hasEnoughFund",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "getAddress",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "calculateRunway",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "employeeId",
+ "type": "address"
+ },
+ {
+ "name": "salary",
+ "type": "uint256"
+ }
+ ],
+ "name": "updateEmployee",
+ "outputs": [],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "e",
+ "type": "address"
+ }
+ ],
+ "name": "getPaid",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "addr",
+ "type": "address"
+ }
+ ],
+ "name": "getEmployeeSalary",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [],
+ "name": "addFund",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "employeeId",
+ "type": "address"
+ }
+ ],
+ "name": "removeEmployee",
+ "outputs": [],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "employeeId",
+ "type": "address"
+ },
+ {
+ "name": "salary",
+ "type": "uint256"
+ }
+ ],
+ "name": "addEmployee",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ }
+ ],
+ "bytecode": "0x60606040526000600255341561001457600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ce8806100636000396000f3006060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806312065fe0146100a957806323fed09e146100d257806338cc4831146100ff5780634ec19512146101545780635e91d8ec1461017d57806363b8817c146101b45780636f5be0d6146101ed578063a2f09dfa1461023a578063d108177a14610258578063e7fd9a1314610286575b600080fd5b34156100b457600080fd5b6100bc6102c8565b6040518082815260200191505060405180910390f35b34156100dd57600080fd5b6100e56102e7565b604051808215151515815260200191505060405180910390f35b341561010a57600080fd5b610112610311565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015f57600080fd5b610167610319565b6040518082815260200191505060405180910390f35b6101b2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610323565b005b34156101bf57600080fd5b6101eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061043f565b005b34156101f857600080fd5b610224600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506105e2565b6040518082815260200191505060405180910390f35b61024261062e565b6040518082815260200191505060405180910390f35b610284600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061064d565b005b341561029157600080fd5b6102c6600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108b9565b005b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000806102f2610319565b3073ffffffffffffffffffffffffffffffffffffffff16310311905090565b600030905090565b6000600254905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561038057600080fd5b8260008173ffffffffffffffffffffffffffffffffffffffff16141515156103a757600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561043057600080fd5b82826001018190555050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561049a57600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561052257600080fd5b6105df600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050610ab7565b50565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106aa57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff16141515156106d157600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561075a57600080fd5b6107d982606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050610b8f565b816001015460026000828254039250508190555060008260000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008260010181905550600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600090555050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091657600080fd5b8260008173ffffffffffffffffffffffffffffffffffffffff161415151561093d57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156109c757600080fd5b6109dc83600254610c2f90919063ffffffff16565b6002819055506060604051908101604052808573ffffffffffffffffffffffffffffffffffffffff16815260200184815260200142815250600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002015590505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1457600080fd5b610b2c600a8360400151610c2f90919063ffffffff16565b90504281101515610b3957fe5b80826040018181525050816000015173ffffffffffffffffffffffffffffffffffffffff166108fc83602001519081150290604051600060405180830381858888f193505050501515610b8b57600080fd5b5050565b6000610bd1610bbe600a610bb0856040015142610c4d90919063ffffffff16565b610c6690919063ffffffff16565b8360200151610c8190919063ffffffff16565b90506000811115610c2b5742826040018181525050816000015173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c2a57600080fd5b5b5050565b6000808284019050838110151515610c4357fe5b8091505092915050565b6000828211151515610c5b57fe5b818303905092915050565b6000808284811515610c7457fe5b0490508091505092915050565b6000806000841415610c965760009150610cb5565b8284029050828482811515610ca757fe5b04141515610cb157fe5b8091505b50929150505600a165627a7a72305820e703c1dc39b3f3877303a19ab987eda239da5e2558d2e866f96c67b2640db5810029",
+ "deployedBytecode": "0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806312065fe0146100a957806323fed09e146100d257806338cc4831146100ff5780634ec19512146101545780635e91d8ec1461017d57806363b8817c146101b45780636f5be0d6146101ed578063a2f09dfa1461023a578063d108177a14610258578063e7fd9a1314610286575b600080fd5b34156100b457600080fd5b6100bc6102c8565b6040518082815260200191505060405180910390f35b34156100dd57600080fd5b6100e56102e7565b604051808215151515815260200191505060405180910390f35b341561010a57600080fd5b610112610311565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561015f57600080fd5b610167610319565b6040518082815260200191505060405180910390f35b6101b2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610323565b005b34156101bf57600080fd5b6101eb600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061043f565b005b34156101f857600080fd5b610224600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506105e2565b6040518082815260200191505060405180910390f35b61024261062e565b6040518082815260200191505060405180910390f35b610284600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061064d565b005b341561029157600080fd5b6102c6600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506108b9565b005b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000806102f2610319565b3073ffffffffffffffffffffffffffffffffffffffff16310311905090565b600030905090565b6000600254905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561038057600080fd5b8260008173ffffffffffffffffffffffffffffffffffffffff16141515156103a757600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561043057600080fd5b82826001018190555050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561049a57600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561052257600080fd5b6105df600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050610ab7565b50565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106aa57600080fd5b8160008173ffffffffffffffffffffffffffffffffffffffff16141515156106d157600080fd5b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561075a57600080fd5b6107d982606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050610b8f565b816001015460026000828254039250508190555060008260000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008260010181905550600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000905560028201600090555050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091657600080fd5b8260008173ffffffffffffffffffffffffffffffffffffffff161415151561093d57600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156109c757600080fd5b6109dc83600254610c2f90919063ffffffff16565b6002819055506060604051908101604052808573ffffffffffffffffffffffffffffffffffffffff16815260200184815260200142815250600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550602082015181600101556040820151816002015590505050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b1457600080fd5b610b2c600a8360400151610c2f90919063ffffffff16565b90504281101515610b3957fe5b80826040018181525050816000015173ffffffffffffffffffffffffffffffffffffffff166108fc83602001519081150290604051600060405180830381858888f193505050501515610b8b57600080fd5b5050565b6000610bd1610bbe600a610bb0856040015142610c4d90919063ffffffff16565b610c6690919063ffffffff16565b8360200151610c8190919063ffffffff16565b90506000811115610c2b5742826040018181525050816000015173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c2a57600080fd5b5b5050565b6000808284019050838110151515610c4357fe5b8091505092915050565b6000828211151515610c5b57fe5b818303905092915050565b6000808284811515610c7457fe5b0490508091505092915050565b6000806000841415610c965760009150610cb5565b8284029050828482811515610ca757fe5b04141515610cb157fe5b8091505b50929150505600a165627a7a72305820e703c1dc39b3f3877303a19ab987eda239da5e2558d2e866f96c67b2640db5810029",
+ "sourceMap": "50:2666:0:-;;;324:1;305:20;;336:62;;;;;;;;381:10;373:5;;:18;;;;;;;;;;;;;;;;;;50:2666;;;;;;",
+ "deployedSourceMap": "50:2666:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2416:84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2298:112;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2625:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2201:87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1510:217;;;;;;;;;;;;;;;;;;;;;;;;;;;;1829:127;;;;;;;;;;;;;;;;;;;;;;;;;;;;2506:113;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1734:89;;;;;;;;;;;;;;;;;;;;;;;1190:310;;;;;;;;;;;;;;;;;;;;870;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2416:84;2458:4;2481;:12;;;2474:19;;2416:84;:::o;2298:112::-;2344:4;2402:1;2382:17;:15;:17::i;:::-;2367:4;:12;;;:32;:36;2360:43;;2298:112;:::o;2625:79::-;2667:7;2693:4;2686:11;;2625:79;:::o;2201:87::-;2248:4;2270:11;;2263:18;;2201:87;:::o;1510:217::-;1629:5;742;;;;;;;;;;;728:19;;:10;:19;;;720:28;;;;;;;;1608:10;838:3;830:4;:11;;;;822:20;;;;;;;;1637:9;:21;1647:10;1637:21;;;;;;;;;;;;;;;1629:29;;1680:3;1672:1;:4;;;;;;;;;;;;:11;;;1668:25;;;1685:8;;;1668:25;1714:6;1703:1;:8;;:17;;;;758:1;1510:217;;;:::o;1829:127::-;742:5;;;;;;;;;;;728:19;;:10;:19;;;720:28;;;;;;;;1914:3;1895:9;:12;1905:1;1895:12;;;;;;;;;;;;;;;:15;;;;;;;;;;;;:22;;;;1887:31;;;;;;;;1928:21;1936:9;:12;1946:1;1936:12;;;;;;;;;;;;;;;1928:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:7;:21::i;:::-;1829:127;:::o;2506:113::-;2567:4;2590:9;:15;2600:4;2590:15;;;;;;;;;;;;;;;:22;;;2583:29;;2506:113;;;:::o;1734:89::-;1776:4;1804;:12;;;1797:19;;1734:89;:::o;1190:310::-;1296:5;742;;;;;;;;;;;728:19;;:10;:19;;;720:28;;;;;;;;1275:10;838:3;830:4;:11;;;;822:20;;;;;;;;1304:9;:21;1314:10;1304:21;;;;;;;;;;;;;;;1296:29;;1347:3;1339:1;:4;;;;;;;;;;;;:11;;;1335:25;;;1352:8;;;1335:25;1370:15;1383:1;1370:15;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:12;:15::i;:::-;1409:1;:8;;;1395:11;;:22;;;;;;;;;;;1432:1;1427;:4;;;:6;;;;;;;;;;;;;;;;;;1452:1;1443;:8;;:10;;;;1471:9;:21;1481:10;1471:21;;;;;;;;;;;;;;;;1464:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;758:1;1190:310;;:::o;870:::-;995:5;742;;;;;;;;;;;728:19;;:10;:19;;;720:28;;;;;;;;974:10;838:3;830:4;:11;;;;822:20;;;;;;;;1003:9;:21;1013:10;1003:21;;;;;;;;;;;;;;;995:29;;1046:3;1038:1;:4;;;;;;;;;;;;:11;;;;1034:25;;;1051:8;;;1034:25;1083:23;1099:6;1083:11;;:15;;:23;;;;:::i;:::-;1069:11;:37;;;;1140:33;;;;;;;;;1149:10;1140:33;;;;;;1161:6;1140:33;;;;1169:3;1140:33;;;1116:9;:21;1126:10;1116:21;;;;;;;;;;;;;;;:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;758:1;870:310;;;:::o;1966:225::-;2036:14;742:5;;;;;;;;;;;728:19;;:10;:19;;;720:28;;;;;;;;2053:29;224:10;2053:1;:12;;;:16;;:29;;;;:::i;:::-;2036:46;;2112:3;2099:10;:16;2092:24;;;;;;2141:10;2126:1;:12;;:25;;;;;2161:1;:4;;;:13;;:23;2175:1;:8;;;2161:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1966:225;;:::o;408:267::-;467:12;482:68;502:47;224:10;503:28;511:8;:19;;;503:3;:7;;:28;;;;:::i;:::-;502:34;;:47;;;;:::i;:::-;482:8;:15;;;:19;;:68;;;;:::i;:::-;467:83;;574:1;564:7;:11;561:108;;;612:3;590:8;:19;;:25;;;;;629:8;:11;;;:20;;:29;650:7;629:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;561:108;408:267;;:::o;1007:129:1:-;1065:7;1080:9;1096:1;1092;:5;1080:17;;1115:1;1110;:6;;1103:14;;;;;;1130:1;1123:8;;1007:129;;;;;:::o;835:110::-;893:7;920:1;915;:6;;908:14;;;;;;939:1;935;:5;928:12;;835:110;;;;:::o;457:265::-;515:7;604:9;620:1;616;:5;;;;;;;;604:17;;716:1;709:8;;457:265;;;;;:::o;202:173::-;260:7;315:9;284:1;279;:6;275:35;;;302:1;295:8;;;;275:35;331:1;327;:5;315:17;;354:1;349;345;:5;;;;;;;;:10;338:18;;;;;;369:1;362:8;;202:173;;;;;;:::o",
+ "source": "pragma solidity ^0.4.2;\n\nimport \"./SafeMath.sol\";\ncontract Payroll {\n using SafeMath for uint;\n struct Employee {\n address id;\n uint salary;\n uint lastPayday;\n }\n uint constant payDuration = 10 seconds;\n address owner;\n mapping (address => Employee) employees;\n\n uint totalSalary = 0;\n \n function Payroll() public {\n owner = msg.sender;\n }\n \n function _partialPaid(Employee employee) private {\n uint payment = employee.salary.mul((now.sub(employee.lastPayday)).div(payDuration)) ;\n if(payment > 0){\n employee.lastPayday = now;\n employee.id.transfer(payment);\n }\n }\n \n\n modifier requireOwner() {\n require(msg.sender == owner);\n _;\n }\n \n modifier validAddress(address addr) {\n require(addr != 0x0);\n _;\n }\n \n function addEmployee(address employeeId, uint salary) public requireOwner\n validAddress(employeeId){\n var e = employees[employeeId];\n if (e.id != 0x0) revert();\n totalSalary = totalSalary.add(salary);\n employees[employeeId] = Employee(employeeId, salary, now);\n }\n \n function removeEmployee(address employeeId) public payable requireOwner validAddress(employeeId){\n var e = employees[employeeId];\n if (e.id == 0x0) revert();\n _partialPaid(e);\n totalSalary-= e.salary;\n e.id=0;\n e.salary=0;\n\n delete employees[employeeId];\n\n }\n \n function updateEmployee(address employeeId, uint salary) public requireOwner payable validAddress(employeeId){\n var e = employees[employeeId];\n if (e.id == 0x0) revert();\n e.salary = salary;\n }\n\n\n function addFund() public payable returns(uint) \n {\n return this.balance;\n }\n\n function getPaid(address e) public requireOwner {\n require(employees[e].id != 0x0);\n getPaid(employees[e]);\n }\n \n function getPaid(Employee e) internal requireOwner {\n \n var nextPayday = e.lastPayday.add(payDuration);\n assert(nextPayday < now);\n e.lastPayday = nextPayday;\n e.id.transfer(e.salary);\n }\n \n function calculateRunway() public view returns(uint) {\n return totalSalary;\n }\n \n function hasEnoughFund() public view returns(bool) {\n return this.balance - calculateRunway() > 0;\n }\n\n function getBalance() public view returns(uint) {\n return this.balance;\n }\n\n function getEmployeeSalary(address addr) public view returns(uint) {\n return employees[addr].salary;\n }\n\n function getAddress() public view returns(address) {\n return this;\n }\n \n \n}",
+ "sourcePath": "/Users/bowman_apple/guigulive-operation/Lesson4/assignment/contracts/Payroll.sol",
+ "ast": {
+ "attributes": {
+ "absolutePath": "/Users/bowman_apple/guigulive-operation/Lesson4/assignment/contracts/Payroll.sol",
+ "exportedSymbols": {
+ "Payroll": [
+ 343
+ ]
+ }
+ },
+ "children": [
+ {
+ "attributes": {
+ "literals": [
+ "solidity",
+ "^",
+ "0.4",
+ ".2"
+ ]
+ },
+ "id": 1,
+ "name": "PragmaDirective",
+ "src": "0:23:0"
+ },
+ {
+ "attributes": {
+ "SourceUnit": 442,
+ "absolutePath": "/Users/bowman_apple/guigulive-operation/Lesson4/assignment/contracts/SafeMath.sol",
+ "file": "./SafeMath.sol",
+ "scope": 344,
+ "symbolAliases": [
+ null
+ ],
+ "unitAlias": ""
+ },
+ "id": 2,
+ "name": "ImportDirective",
+ "src": "25:24:0"
+ },
+ {
+ "attributes": {
+ "baseContracts": [
+ null
+ ],
+ "contractDependencies": [
+ null
+ ],
+ "contractKind": "contract",
+ "documentation": null,
+ "fullyImplemented": true,
+ "linearizedBaseContracts": [
+ 343
+ ],
+ "name": "Payroll",
+ "scope": 344
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "SafeMath",
+ "referencedDeclaration": 441,
+ "type": "library SafeMath"
+ },
+ "id": 3,
+ "name": "UserDefinedTypeName",
+ "src": "79:8:0"
+ },
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 4,
+ "name": "ElementaryTypeName",
+ "src": "92:4:0"
+ }
+ ],
+ "id": 5,
+ "name": "UsingForDirective",
+ "src": "73:24:0"
+ },
+ {
+ "attributes": {
+ "canonicalName": "Payroll.Employee",
+ "name": "Employee",
+ "scope": 343,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "id",
+ "scope": 12,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 6,
+ "name": "ElementaryTypeName",
+ "src": "128:7:0"
+ }
+ ],
+ "id": 7,
+ "name": "VariableDeclaration",
+ "src": "128:10:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "salary",
+ "scope": 12,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 8,
+ "name": "ElementaryTypeName",
+ "src": "148:4:0"
+ }
+ ],
+ "id": 9,
+ "name": "VariableDeclaration",
+ "src": "148:11:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "lastPayday",
+ "scope": 12,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 10,
+ "name": "ElementaryTypeName",
+ "src": "169:4:0"
+ }
+ ],
+ "id": 11,
+ "name": "VariableDeclaration",
+ "src": "169:15:0"
+ }
+ ],
+ "id": 12,
+ "name": "StructDefinition",
+ "src": "102:89:0"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "name": "payDuration",
+ "scope": 343,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "uint256",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 13,
+ "name": "ElementaryTypeName",
+ "src": "196:4:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "3130",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": "seconds",
+ "token": "number",
+ "type": "int_const 10",
+ "value": "10"
+ },
+ "id": 14,
+ "name": "Literal",
+ "src": "224:10:0"
+ }
+ ],
+ "id": 15,
+ "name": "VariableDeclaration",
+ "src": "196:38:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "owner",
+ "scope": 343,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 16,
+ "name": "ElementaryTypeName",
+ "src": "240:7:0"
+ }
+ ],
+ "id": 17,
+ "name": "VariableDeclaration",
+ "src": "240:13:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employees",
+ "scope": 343,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "type": "mapping(address => struct Payroll.Employee storage ref)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 18,
+ "name": "ElementaryTypeName",
+ "src": "268:7:0"
+ },
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "Employee",
+ "referencedDeclaration": 12,
+ "type": "struct Payroll.Employee storage pointer"
+ },
+ "id": 19,
+ "name": "UserDefinedTypeName",
+ "src": "279:8:0"
+ }
+ ],
+ "id": 20,
+ "name": "Mapping",
+ "src": "259:29:0"
+ }
+ ],
+ "id": 21,
+ "name": "VariableDeclaration",
+ "src": "259:39:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "totalSalary",
+ "scope": 343,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "uint256",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 22,
+ "name": "ElementaryTypeName",
+ "src": "305:4:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 23,
+ "name": "Literal",
+ "src": "324:1:0"
+ }
+ ],
+ "id": 24,
+ "name": "VariableDeclaration",
+ "src": "305:20:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": true,
+ "modifiers": [
+ null
+ ],
+ "name": "Payroll",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 25,
+ "name": "ParameterList",
+ "src": "352:2:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 26,
+ "name": "ParameterList",
+ "src": "363:0:0"
+ },
+ {
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 17,
+ "type": "address",
+ "value": "owner"
+ },
+ "id": 27,
+ "name": "Identifier",
+ "src": "373:5:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sender",
+ "referencedDeclaration": null,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 453,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 28,
+ "name": "Identifier",
+ "src": "381:3:0"
+ }
+ ],
+ "id": 29,
+ "name": "MemberAccess",
+ "src": "381:10:0"
+ }
+ ],
+ "id": 30,
+ "name": "Assignment",
+ "src": "373:18:0"
+ }
+ ],
+ "id": 31,
+ "name": "ExpressionStatement",
+ "src": "373:18:0"
+ }
+ ],
+ "id": 32,
+ "name": "Block",
+ "src": "363:35:0"
+ }
+ ],
+ "id": 33,
+ "name": "FunctionDefinition",
+ "src": "336:62:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "_partialPaid",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "private"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 74,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee memory",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "Employee",
+ "referencedDeclaration": 12,
+ "type": "struct Payroll.Employee storage pointer"
+ },
+ "id": 34,
+ "name": "UserDefinedTypeName",
+ "src": "430:8:0"
+ }
+ ],
+ "id": 35,
+ "name": "VariableDeclaration",
+ "src": "430:17:0"
+ }
+ ],
+ "id": 36,
+ "name": "ParameterList",
+ "src": "429:19:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 37,
+ "name": "ParameterList",
+ "src": "457:0:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 39
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "payment",
+ "scope": 74,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 38,
+ "name": "ElementaryTypeName",
+ "src": "467:4:0"
+ }
+ ],
+ "id": 39,
+ "name": "VariableDeclaration",
+ "src": "467:12:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "mul",
+ "referencedDeclaration": 378,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 9,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 35,
+ "type": "struct Payroll.Employee memory",
+ "value": "employee"
+ },
+ "id": 40,
+ "name": "Identifier",
+ "src": "482:8:0"
+ }
+ ],
+ "id": 41,
+ "name": "MemberAccess",
+ "src": "482:15:0"
+ }
+ ],
+ "id": 42,
+ "name": "MemberAccess",
+ "src": "482:19:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "div",
+ "referencedDeclaration": 396,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isInlineArray": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sub",
+ "referencedDeclaration": 416,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 455,
+ "type": "uint256",
+ "value": "now"
+ },
+ "id": 43,
+ "name": "Identifier",
+ "src": "503:3:0"
+ }
+ ],
+ "id": 44,
+ "name": "MemberAccess",
+ "src": "503:7:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "lastPayday",
+ "referencedDeclaration": 11,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 35,
+ "type": "struct Payroll.Employee memory",
+ "value": "employee"
+ },
+ "id": 45,
+ "name": "Identifier",
+ "src": "511:8:0"
+ }
+ ],
+ "id": 46,
+ "name": "MemberAccess",
+ "src": "511:19:0"
+ }
+ ],
+ "id": 47,
+ "name": "FunctionCall",
+ "src": "503:28:0"
+ }
+ ],
+ "id": 48,
+ "name": "TupleExpression",
+ "src": "502:30:0"
+ }
+ ],
+ "id": 49,
+ "name": "MemberAccess",
+ "src": "502:34:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 15,
+ "type": "uint256",
+ "value": "payDuration"
+ },
+ "id": 50,
+ "name": "Identifier",
+ "src": "537:11:0"
+ }
+ ],
+ "id": 51,
+ "name": "FunctionCall",
+ "src": "502:47:0"
+ }
+ ],
+ "id": 52,
+ "name": "FunctionCall",
+ "src": "482:68:0"
+ }
+ ],
+ "id": 53,
+ "name": "VariableDeclarationStatement",
+ "src": "467:83:0"
+ },
+ {
+ "attributes": {
+ "falseBody": null
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": ">",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 39,
+ "type": "uint256",
+ "value": "payment"
+ },
+ "id": 54,
+ "name": "Identifier",
+ "src": "564:7:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 55,
+ "name": "Literal",
+ "src": "574:1:0"
+ }
+ ],
+ "id": 56,
+ "name": "BinaryOperation",
+ "src": "564:11:0"
+ },
+ {
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "member_name": "lastPayday",
+ "referencedDeclaration": 11,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 35,
+ "type": "struct Payroll.Employee memory",
+ "value": "employee"
+ },
+ "id": 57,
+ "name": "Identifier",
+ "src": "590:8:0"
+ }
+ ],
+ "id": 59,
+ "name": "MemberAccess",
+ "src": "590:19:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 455,
+ "type": "uint256",
+ "value": "now"
+ },
+ "id": 60,
+ "name": "Identifier",
+ "src": "612:3:0"
+ }
+ ],
+ "id": 61,
+ "name": "Assignment",
+ "src": "590:25:0"
+ }
+ ],
+ "id": 62,
+ "name": "ExpressionStatement",
+ "src": "590:25:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "transfer",
+ "referencedDeclaration": null,
+ "type": "function (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "id",
+ "referencedDeclaration": 7,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 35,
+ "type": "struct Payroll.Employee memory",
+ "value": "employee"
+ },
+ "id": 63,
+ "name": "Identifier",
+ "src": "629:8:0"
+ }
+ ],
+ "id": 66,
+ "name": "MemberAccess",
+ "src": "629:11:0"
+ }
+ ],
+ "id": 67,
+ "name": "MemberAccess",
+ "src": "629:20:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 39,
+ "type": "uint256",
+ "value": "payment"
+ },
+ "id": 68,
+ "name": "Identifier",
+ "src": "650:7:0"
+ }
+ ],
+ "id": 69,
+ "name": "FunctionCall",
+ "src": "629:29:0"
+ }
+ ],
+ "id": 70,
+ "name": "ExpressionStatement",
+ "src": "629:29:0"
+ }
+ ],
+ "id": 71,
+ "name": "Block",
+ "src": "576:93:0"
+ }
+ ],
+ "id": 72,
+ "name": "IfStatement",
+ "src": "561:108:0"
+ }
+ ],
+ "id": 73,
+ "name": "Block",
+ "src": "457:218:0"
+ }
+ ],
+ "id": 74,
+ "name": "FunctionDefinition",
+ "src": "408:267:0"
+ },
+ {
+ "attributes": {
+ "name": "requireOwner",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 75,
+ "name": "ParameterList",
+ "src": "707:2:0"
+ },
+ {
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 456,
+ "type": "function (bool) pure",
+ "value": "require"
+ },
+ "id": 76,
+ "name": "Identifier",
+ "src": "720:7:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "==",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sender",
+ "referencedDeclaration": null,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 453,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 77,
+ "name": "Identifier",
+ "src": "728:3:0"
+ }
+ ],
+ "id": 78,
+ "name": "MemberAccess",
+ "src": "728:10:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 17,
+ "type": "address",
+ "value": "owner"
+ },
+ "id": 79,
+ "name": "Identifier",
+ "src": "742:5:0"
+ }
+ ],
+ "id": 80,
+ "name": "BinaryOperation",
+ "src": "728:19:0"
+ }
+ ],
+ "id": 81,
+ "name": "FunctionCall",
+ "src": "720:28:0"
+ }
+ ],
+ "id": 82,
+ "name": "ExpressionStatement",
+ "src": "720:28:0"
+ },
+ {
+ "id": 83,
+ "name": "PlaceholderStatement",
+ "src": "758:1:0"
+ }
+ ],
+ "id": 84,
+ "name": "Block",
+ "src": "710:56:0"
+ }
+ ],
+ "id": 85,
+ "name": "ModifierDefinition",
+ "src": "686:80:0"
+ },
+ {
+ "attributes": {
+ "name": "validAddress",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "addr",
+ "scope": 97,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 86,
+ "name": "ElementaryTypeName",
+ "src": "798:7:0"
+ }
+ ],
+ "id": 87,
+ "name": "VariableDeclaration",
+ "src": "798:12:0"
+ }
+ ],
+ "id": 88,
+ "name": "ParameterList",
+ "src": "797:14:0"
+ },
+ {
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 456,
+ "type": "function (bool) pure",
+ "value": "require"
+ },
+ "id": 89,
+ "name": "Identifier",
+ "src": "822:7:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "!=",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 87,
+ "type": "address",
+ "value": "addr"
+ },
+ "id": 90,
+ "name": "Identifier",
+ "src": "830:4:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "307830",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0x0"
+ },
+ "id": 91,
+ "name": "Literal",
+ "src": "838:3:0"
+ }
+ ],
+ "id": 92,
+ "name": "BinaryOperation",
+ "src": "830:11:0"
+ }
+ ],
+ "id": 93,
+ "name": "FunctionCall",
+ "src": "822:20:0"
+ }
+ ],
+ "id": 94,
+ "name": "ExpressionStatement",
+ "src": "822:20:0"
+ },
+ {
+ "id": 95,
+ "name": "PlaceholderStatement",
+ "src": "852:1:0"
+ }
+ ],
+ "id": 96,
+ "name": "Block",
+ "src": "812:48:0"
+ }
+ ],
+ "id": 97,
+ "name": "ModifierDefinition",
+ "src": "776:84:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "addEmployee",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employeeId",
+ "scope": 140,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 98,
+ "name": "ElementaryTypeName",
+ "src": "891:7:0"
+ }
+ ],
+ "id": 99,
+ "name": "VariableDeclaration",
+ "src": "891:18:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "salary",
+ "scope": 140,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 100,
+ "name": "ElementaryTypeName",
+ "src": "911:4:0"
+ }
+ ],
+ "id": 101,
+ "name": "VariableDeclaration",
+ "src": "911:11:0"
+ }
+ ],
+ "id": 102,
+ "name": "ParameterList",
+ "src": "890:33:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 108,
+ "name": "ParameterList",
+ "src": "985:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 85,
+ "type": "modifier ()",
+ "value": "requireOwner"
+ },
+ "id": 103,
+ "name": "Identifier",
+ "src": "932:12:0"
+ }
+ ],
+ "id": 104,
+ "name": "ModifierInvocation",
+ "src": "932:12:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 97,
+ "type": "modifier (address)",
+ "value": "validAddress"
+ },
+ "id": 105,
+ "name": "Identifier",
+ "src": "961:12:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 99,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 106,
+ "name": "Identifier",
+ "src": "974:10:0"
+ }
+ ],
+ "id": 107,
+ "name": "ModifierInvocation",
+ "src": "961:24:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 109
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "e",
+ "scope": 140,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 109,
+ "name": "VariableDeclaration",
+ "src": "995:5:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 21,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 110,
+ "name": "Identifier",
+ "src": "1003:9:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 99,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 111,
+ "name": "Identifier",
+ "src": "1013:10:0"
+ }
+ ],
+ "id": 112,
+ "name": "IndexAccess",
+ "src": "1003:21:0"
+ }
+ ],
+ "id": 113,
+ "name": "VariableDeclarationStatement",
+ "src": "995:29:0"
+ },
+ {
+ "attributes": {
+ "falseBody": null
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "!=",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "id",
+ "referencedDeclaration": 7,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 109,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "e"
+ },
+ "id": 114,
+ "name": "Identifier",
+ "src": "1038:1:0"
+ }
+ ],
+ "id": 115,
+ "name": "MemberAccess",
+ "src": "1038:4:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "307830",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0x0"
+ },
+ "id": 116,
+ "name": "Literal",
+ "src": "1046:3:0"
+ }
+ ],
+ "id": 117,
+ "name": "BinaryOperation",
+ "src": "1038:11:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "arguments": [
+ null
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ null
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 457,
+ "type": "function () pure",
+ "value": "revert"
+ },
+ "id": 118,
+ "name": "Identifier",
+ "src": "1051:6:0"
+ }
+ ],
+ "id": 119,
+ "name": "FunctionCall",
+ "src": "1051:8:0"
+ }
+ ],
+ "id": 120,
+ "name": "ExpressionStatement",
+ "src": "1051:8:0"
+ }
+ ],
+ "id": 121,
+ "name": "IfStatement",
+ "src": "1034:25:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 24,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 122,
+ "name": "Identifier",
+ "src": "1069:11:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "add",
+ "referencedDeclaration": 440,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 24,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 123,
+ "name": "Identifier",
+ "src": "1083:11:0"
+ }
+ ],
+ "id": 124,
+ "name": "MemberAccess",
+ "src": "1083:15:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 101,
+ "type": "uint256",
+ "value": "salary"
+ },
+ "id": 125,
+ "name": "Identifier",
+ "src": "1099:6:0"
+ }
+ ],
+ "id": 126,
+ "name": "FunctionCall",
+ "src": "1083:23:0"
+ }
+ ],
+ "id": 127,
+ "name": "Assignment",
+ "src": "1069:37:0"
+ }
+ ],
+ "id": 128,
+ "name": "ExpressionStatement",
+ "src": "1069:37:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 21,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 129,
+ "name": "Identifier",
+ "src": "1116:9:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 99,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 130,
+ "name": "Identifier",
+ "src": "1126:10:0"
+ }
+ ],
+ "id": 131,
+ "name": "IndexAccess",
+ "src": "1116:21:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": true,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "struct Payroll.Employee memory",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ },
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 12,
+ "type": "type(struct Payroll.Employee storage pointer)",
+ "value": "Employee"
+ },
+ "id": 132,
+ "name": "Identifier",
+ "src": "1140:8:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 99,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 133,
+ "name": "Identifier",
+ "src": "1149:10:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 101,
+ "type": "uint256",
+ "value": "salary"
+ },
+ "id": 134,
+ "name": "Identifier",
+ "src": "1161:6:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 455,
+ "type": "uint256",
+ "value": "now"
+ },
+ "id": 135,
+ "name": "Identifier",
+ "src": "1169:3:0"
+ }
+ ],
+ "id": 136,
+ "name": "FunctionCall",
+ "src": "1140:33:0"
+ }
+ ],
+ "id": 137,
+ "name": "Assignment",
+ "src": "1116:57:0"
+ }
+ ],
+ "id": 138,
+ "name": "ExpressionStatement",
+ "src": "1116:57:0"
+ }
+ ],
+ "id": 139,
+ "name": "Block",
+ "src": "985:195:0"
+ }
+ ],
+ "id": 140,
+ "name": "FunctionDefinition",
+ "src": "870:310:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "removeEmployee",
+ "payable": true,
+ "scope": 343,
+ "stateMutability": "payable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employeeId",
+ "scope": 190,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 141,
+ "name": "ElementaryTypeName",
+ "src": "1214:7:0"
+ }
+ ],
+ "id": 142,
+ "name": "VariableDeclaration",
+ "src": "1214:18:0"
+ }
+ ],
+ "id": 143,
+ "name": "ParameterList",
+ "src": "1213:20:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 149,
+ "name": "ParameterList",
+ "src": "1286:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 85,
+ "type": "modifier ()",
+ "value": "requireOwner"
+ },
+ "id": 144,
+ "name": "Identifier",
+ "src": "1249:12:0"
+ }
+ ],
+ "id": 145,
+ "name": "ModifierInvocation",
+ "src": "1249:12:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 97,
+ "type": "modifier (address)",
+ "value": "validAddress"
+ },
+ "id": 146,
+ "name": "Identifier",
+ "src": "1262:12:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 142,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 147,
+ "name": "Identifier",
+ "src": "1275:10:0"
+ }
+ ],
+ "id": 148,
+ "name": "ModifierInvocation",
+ "src": "1262:24:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 150
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "e",
+ "scope": 190,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 150,
+ "name": "VariableDeclaration",
+ "src": "1296:5:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 21,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 151,
+ "name": "Identifier",
+ "src": "1304:9:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 142,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 152,
+ "name": "Identifier",
+ "src": "1314:10:0"
+ }
+ ],
+ "id": 153,
+ "name": "IndexAccess",
+ "src": "1304:21:0"
+ }
+ ],
+ "id": 154,
+ "name": "VariableDeclarationStatement",
+ "src": "1296:29:0"
+ },
+ {
+ "attributes": {
+ "falseBody": null
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "==",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "id",
+ "referencedDeclaration": 7,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 150,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "e"
+ },
+ "id": 155,
+ "name": "Identifier",
+ "src": "1339:1:0"
+ }
+ ],
+ "id": 156,
+ "name": "MemberAccess",
+ "src": "1339:4:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "307830",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0x0"
+ },
+ "id": 157,
+ "name": "Literal",
+ "src": "1347:3:0"
+ }
+ ],
+ "id": 158,
+ "name": "BinaryOperation",
+ "src": "1339:11:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "arguments": [
+ null
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ null
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 457,
+ "type": "function () pure",
+ "value": "revert"
+ },
+ "id": 159,
+ "name": "Identifier",
+ "src": "1352:6:0"
+ }
+ ],
+ "id": 160,
+ "name": "FunctionCall",
+ "src": "1352:8:0"
+ }
+ ],
+ "id": 161,
+ "name": "ExpressionStatement",
+ "src": "1352:8:0"
+ }
+ ],
+ "id": 162,
+ "name": "IfStatement",
+ "src": "1335:25:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_struct$_Employee_$12_storage_ptr",
+ "typeString": "struct Payroll.Employee storage pointer"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 74,
+ "type": "function (struct Payroll.Employee memory)",
+ "value": "_partialPaid"
+ },
+ "id": 163,
+ "name": "Identifier",
+ "src": "1370:12:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 150,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "e"
+ },
+ "id": 164,
+ "name": "Identifier",
+ "src": "1383:1:0"
+ }
+ ],
+ "id": 165,
+ "name": "FunctionCall",
+ "src": "1370:15:0"
+ }
+ ],
+ "id": 166,
+ "name": "ExpressionStatement",
+ "src": "1370:15:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "-=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 24,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 167,
+ "name": "Identifier",
+ "src": "1395:11:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 9,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 150,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "e"
+ },
+ "id": 168,
+ "name": "Identifier",
+ "src": "1409:1:0"
+ }
+ ],
+ "id": 169,
+ "name": "MemberAccess",
+ "src": "1409:8:0"
+ }
+ ],
+ "id": 170,
+ "name": "Assignment",
+ "src": "1395:22:0"
+ }
+ ],
+ "id": 171,
+ "name": "ExpressionStatement",
+ "src": "1395:22:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "member_name": "id",
+ "referencedDeclaration": 7,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 150,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "e"
+ },
+ "id": 172,
+ "name": "Identifier",
+ "src": "1427:1:0"
+ }
+ ],
+ "id": 174,
+ "name": "MemberAccess",
+ "src": "1427:4:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 175,
+ "name": "Literal",
+ "src": "1432:1:0"
+ }
+ ],
+ "id": 176,
+ "name": "Assignment",
+ "src": "1427:6:0"
+ }
+ ],
+ "id": 177,
+ "name": "ExpressionStatement",
+ "src": "1427:6:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "member_name": "salary",
+ "referencedDeclaration": 9,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 150,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "e"
+ },
+ "id": 178,
+ "name": "Identifier",
+ "src": "1443:1:0"
+ }
+ ],
+ "id": 180,
+ "name": "MemberAccess",
+ "src": "1443:8:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 181,
+ "name": "Literal",
+ "src": "1452:1:0"
+ }
+ ],
+ "id": 182,
+ "name": "Assignment",
+ "src": "1443:10:0"
+ }
+ ],
+ "id": 183,
+ "name": "ExpressionStatement",
+ "src": "1443:10:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "delete",
+ "prefix": true,
+ "type": "tuple()"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 21,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 184,
+ "name": "Identifier",
+ "src": "1471:9:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 142,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 185,
+ "name": "Identifier",
+ "src": "1481:10:0"
+ }
+ ],
+ "id": 186,
+ "name": "IndexAccess",
+ "src": "1471:21:0"
+ }
+ ],
+ "id": 187,
+ "name": "UnaryOperation",
+ "src": "1464:28:0"
+ }
+ ],
+ "id": 188,
+ "name": "ExpressionStatement",
+ "src": "1464:28:0"
+ }
+ ],
+ "id": 189,
+ "name": "Block",
+ "src": "1286:214:0"
+ }
+ ],
+ "id": 190,
+ "name": "FunctionDefinition",
+ "src": "1190:310:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "updateEmployee",
+ "payable": true,
+ "scope": 343,
+ "stateMutability": "payable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employeeId",
+ "scope": 222,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 191,
+ "name": "ElementaryTypeName",
+ "src": "1534:7:0"
+ }
+ ],
+ "id": 192,
+ "name": "VariableDeclaration",
+ "src": "1534:18:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "salary",
+ "scope": 222,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 193,
+ "name": "ElementaryTypeName",
+ "src": "1554:4:0"
+ }
+ ],
+ "id": 194,
+ "name": "VariableDeclaration",
+ "src": "1554:11:0"
+ }
+ ],
+ "id": 195,
+ "name": "ParameterList",
+ "src": "1533:33:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 201,
+ "name": "ParameterList",
+ "src": "1619:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 85,
+ "type": "modifier ()",
+ "value": "requireOwner"
+ },
+ "id": 196,
+ "name": "Identifier",
+ "src": "1574:12:0"
+ }
+ ],
+ "id": 197,
+ "name": "ModifierInvocation",
+ "src": "1574:12:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 97,
+ "type": "modifier (address)",
+ "value": "validAddress"
+ },
+ "id": 198,
+ "name": "Identifier",
+ "src": "1595:12:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 192,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 199,
+ "name": "Identifier",
+ "src": "1608:10:0"
+ }
+ ],
+ "id": 200,
+ "name": "ModifierInvocation",
+ "src": "1595:24:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 202
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "e",
+ "scope": 222,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 202,
+ "name": "VariableDeclaration",
+ "src": "1629:5:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 21,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 203,
+ "name": "Identifier",
+ "src": "1637:9:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 192,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 204,
+ "name": "Identifier",
+ "src": "1647:10:0"
+ }
+ ],
+ "id": 205,
+ "name": "IndexAccess",
+ "src": "1637:21:0"
+ }
+ ],
+ "id": 206,
+ "name": "VariableDeclarationStatement",
+ "src": "1629:29:0"
+ },
+ {
+ "attributes": {
+ "falseBody": null
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "==",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "id",
+ "referencedDeclaration": 7,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 202,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "e"
+ },
+ "id": 207,
+ "name": "Identifier",
+ "src": "1672:1:0"
+ }
+ ],
+ "id": 208,
+ "name": "MemberAccess",
+ "src": "1672:4:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "307830",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0x0"
+ },
+ "id": 209,
+ "name": "Literal",
+ "src": "1680:3:0"
+ }
+ ],
+ "id": 210,
+ "name": "BinaryOperation",
+ "src": "1672:11:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "arguments": [
+ null
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ null
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 457,
+ "type": "function () pure",
+ "value": "revert"
+ },
+ "id": 211,
+ "name": "Identifier",
+ "src": "1685:6:0"
+ }
+ ],
+ "id": 212,
+ "name": "FunctionCall",
+ "src": "1685:8:0"
+ }
+ ],
+ "id": 213,
+ "name": "ExpressionStatement",
+ "src": "1685:8:0"
+ }
+ ],
+ "id": 214,
+ "name": "IfStatement",
+ "src": "1668:25:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "member_name": "salary",
+ "referencedDeclaration": 9,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 202,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "e"
+ },
+ "id": 215,
+ "name": "Identifier",
+ "src": "1703:1:0"
+ }
+ ],
+ "id": 217,
+ "name": "MemberAccess",
+ "src": "1703:8:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 194,
+ "type": "uint256",
+ "value": "salary"
+ },
+ "id": 218,
+ "name": "Identifier",
+ "src": "1714:6:0"
+ }
+ ],
+ "id": 219,
+ "name": "Assignment",
+ "src": "1703:17:0"
+ }
+ ],
+ "id": 220,
+ "name": "ExpressionStatement",
+ "src": "1703:17:0"
+ }
+ ],
+ "id": 221,
+ "name": "Block",
+ "src": "1619:108:0"
+ }
+ ],
+ "id": 222,
+ "name": "FunctionDefinition",
+ "src": "1510:217:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "addFund",
+ "payable": true,
+ "scope": 343,
+ "stateMutability": "payable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 223,
+ "name": "ParameterList",
+ "src": "1750:2:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 231,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 224,
+ "name": "ElementaryTypeName",
+ "src": "1776:4:0"
+ }
+ ],
+ "id": 225,
+ "name": "VariableDeclaration",
+ "src": "1776:4:0"
+ }
+ ],
+ "id": 226,
+ "name": "ParameterList",
+ "src": "1775:6:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 226
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "balance",
+ "referencedDeclaration": null,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 466,
+ "type": "contract Payroll",
+ "value": "this"
+ },
+ "id": 227,
+ "name": "Identifier",
+ "src": "1804:4:0"
+ }
+ ],
+ "id": 228,
+ "name": "MemberAccess",
+ "src": "1804:12:0"
+ }
+ ],
+ "id": 229,
+ "name": "Return",
+ "src": "1797:19:0"
+ }
+ ],
+ "id": 230,
+ "name": "Block",
+ "src": "1787:36:0"
+ }
+ ],
+ "id": 231,
+ "name": "FunctionDefinition",
+ "src": "1734:89:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "getPaid",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "e",
+ "scope": 254,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 232,
+ "name": "ElementaryTypeName",
+ "src": "1846:7:0"
+ }
+ ],
+ "id": 233,
+ "name": "VariableDeclaration",
+ "src": "1846:9:0"
+ }
+ ],
+ "id": 234,
+ "name": "ParameterList",
+ "src": "1845:11:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 237,
+ "name": "ParameterList",
+ "src": "1877:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 85,
+ "type": "modifier ()",
+ "value": "requireOwner"
+ },
+ "id": 235,
+ "name": "Identifier",
+ "src": "1864:12:0"
+ }
+ ],
+ "id": 236,
+ "name": "ModifierInvocation",
+ "src": "1864:12:0"
+ },
+ {
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 456,
+ "type": "function (bool) pure",
+ "value": "require"
+ },
+ "id": 238,
+ "name": "Identifier",
+ "src": "1887:7:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "!=",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "id",
+ "referencedDeclaration": 7,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 21,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 239,
+ "name": "Identifier",
+ "src": "1895:9:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 233,
+ "type": "address",
+ "value": "e"
+ },
+ "id": 240,
+ "name": "Identifier",
+ "src": "1905:1:0"
+ }
+ ],
+ "id": 241,
+ "name": "IndexAccess",
+ "src": "1895:12:0"
+ }
+ ],
+ "id": 242,
+ "name": "MemberAccess",
+ "src": "1895:15:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "307830",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0x0"
+ },
+ "id": 243,
+ "name": "Literal",
+ "src": "1914:3:0"
+ }
+ ],
+ "id": 244,
+ "name": "BinaryOperation",
+ "src": "1895:22:0"
+ }
+ ],
+ "id": 245,
+ "name": "FunctionCall",
+ "src": "1887:31:0"
+ }
+ ],
+ "id": 246,
+ "name": "ExpressionStatement",
+ "src": "1887:31:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_struct$_Employee_$12_storage",
+ "typeString": "struct Payroll.Employee storage ref"
+ }
+ ],
+ "overloadedDeclarations": [
+ 254,
+ 290
+ ],
+ "referencedDeclaration": 290,
+ "type": "function (struct Payroll.Employee memory)",
+ "value": "getPaid"
+ },
+ "id": 247,
+ "name": "Identifier",
+ "src": "1928:7:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 21,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 248,
+ "name": "Identifier",
+ "src": "1936:9:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 233,
+ "type": "address",
+ "value": "e"
+ },
+ "id": 249,
+ "name": "Identifier",
+ "src": "1946:1:0"
+ }
+ ],
+ "id": 250,
+ "name": "IndexAccess",
+ "src": "1936:12:0"
+ }
+ ],
+ "id": 251,
+ "name": "FunctionCall",
+ "src": "1928:21:0"
+ }
+ ],
+ "id": 252,
+ "name": "ExpressionStatement",
+ "src": "1928:21:0"
+ }
+ ],
+ "id": 253,
+ "name": "Block",
+ "src": "1877:79:0"
+ }
+ ],
+ "id": 254,
+ "name": "FunctionDefinition",
+ "src": "1829:127:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "getPaid",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "e",
+ "scope": 290,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee memory",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "Employee",
+ "referencedDeclaration": 12,
+ "type": "struct Payroll.Employee storage pointer"
+ },
+ "id": 255,
+ "name": "UserDefinedTypeName",
+ "src": "1983:8:0"
+ }
+ ],
+ "id": 256,
+ "name": "VariableDeclaration",
+ "src": "1983:10:0"
+ }
+ ],
+ "id": 257,
+ "name": "ParameterList",
+ "src": "1982:12:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 260,
+ "name": "ParameterList",
+ "src": "2017:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 85,
+ "type": "modifier ()",
+ "value": "requireOwner"
+ },
+ "id": 258,
+ "name": "Identifier",
+ "src": "2004:12:0"
+ }
+ ],
+ "id": 259,
+ "name": "ModifierInvocation",
+ "src": "2004:12:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 261
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "nextPayday",
+ "scope": 290,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 261,
+ "name": "VariableDeclaration",
+ "src": "2036:14:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "add",
+ "referencedDeclaration": 440,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "lastPayday",
+ "referencedDeclaration": 11,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 256,
+ "type": "struct Payroll.Employee memory",
+ "value": "e"
+ },
+ "id": 262,
+ "name": "Identifier",
+ "src": "2053:1:0"
+ }
+ ],
+ "id": 263,
+ "name": "MemberAccess",
+ "src": "2053:12:0"
+ }
+ ],
+ "id": 264,
+ "name": "MemberAccess",
+ "src": "2053:16:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 15,
+ "type": "uint256",
+ "value": "payDuration"
+ },
+ "id": 265,
+ "name": "Identifier",
+ "src": "2070:11:0"
+ }
+ ],
+ "id": 266,
+ "name": "FunctionCall",
+ "src": "2053:29:0"
+ }
+ ],
+ "id": 267,
+ "name": "VariableDeclarationStatement",
+ "src": "2036:46:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 444,
+ "type": "function (bool) pure",
+ "value": "assert"
+ },
+ "id": 268,
+ "name": "Identifier",
+ "src": "2092:6:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "<",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 261,
+ "type": "uint256",
+ "value": "nextPayday"
+ },
+ "id": 269,
+ "name": "Identifier",
+ "src": "2099:10:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 455,
+ "type": "uint256",
+ "value": "now"
+ },
+ "id": 270,
+ "name": "Identifier",
+ "src": "2112:3:0"
+ }
+ ],
+ "id": 271,
+ "name": "BinaryOperation",
+ "src": "2099:16:0"
+ }
+ ],
+ "id": 272,
+ "name": "FunctionCall",
+ "src": "2092:24:0"
+ }
+ ],
+ "id": 273,
+ "name": "ExpressionStatement",
+ "src": "2092:24:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "member_name": "lastPayday",
+ "referencedDeclaration": 11,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 256,
+ "type": "struct Payroll.Employee memory",
+ "value": "e"
+ },
+ "id": 274,
+ "name": "Identifier",
+ "src": "2126:1:0"
+ }
+ ],
+ "id": 276,
+ "name": "MemberAccess",
+ "src": "2126:12:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 261,
+ "type": "uint256",
+ "value": "nextPayday"
+ },
+ "id": 277,
+ "name": "Identifier",
+ "src": "2141:10:0"
+ }
+ ],
+ "id": 278,
+ "name": "Assignment",
+ "src": "2126:25:0"
+ }
+ ],
+ "id": 279,
+ "name": "ExpressionStatement",
+ "src": "2126:25:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "transfer",
+ "referencedDeclaration": null,
+ "type": "function (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "id",
+ "referencedDeclaration": 7,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 256,
+ "type": "struct Payroll.Employee memory",
+ "value": "e"
+ },
+ "id": 280,
+ "name": "Identifier",
+ "src": "2161:1:0"
+ }
+ ],
+ "id": 283,
+ "name": "MemberAccess",
+ "src": "2161:4:0"
+ }
+ ],
+ "id": 284,
+ "name": "MemberAccess",
+ "src": "2161:13:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 9,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 256,
+ "type": "struct Payroll.Employee memory",
+ "value": "e"
+ },
+ "id": 285,
+ "name": "Identifier",
+ "src": "2175:1:0"
+ }
+ ],
+ "id": 286,
+ "name": "MemberAccess",
+ "src": "2175:8:0"
+ }
+ ],
+ "id": 287,
+ "name": "FunctionCall",
+ "src": "2161:23:0"
+ }
+ ],
+ "id": 288,
+ "name": "ExpressionStatement",
+ "src": "2161:23:0"
+ }
+ ],
+ "id": 289,
+ "name": "Block",
+ "src": "2017:174:0"
+ }
+ ],
+ "id": 290,
+ "name": "FunctionDefinition",
+ "src": "1966:225:0"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "calculateRunway",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "view",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 291,
+ "name": "ParameterList",
+ "src": "2225:2:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 298,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 292,
+ "name": "ElementaryTypeName",
+ "src": "2248:4:0"
+ }
+ ],
+ "id": 293,
+ "name": "VariableDeclaration",
+ "src": "2248:4:0"
+ }
+ ],
+ "id": 294,
+ "name": "ParameterList",
+ "src": "2247:6:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 294
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 24,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 295,
+ "name": "Identifier",
+ "src": "2270:11:0"
+ }
+ ],
+ "id": 296,
+ "name": "Return",
+ "src": "2263:18:0"
+ }
+ ],
+ "id": 297,
+ "name": "Block",
+ "src": "2254:34:0"
+ }
+ ],
+ "id": 298,
+ "name": "FunctionDefinition",
+ "src": "2201:87:0"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "hasEnoughFund",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "view",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 299,
+ "name": "ParameterList",
+ "src": "2320:2:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 312,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "bool",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "bool",
+ "type": "bool"
+ },
+ "id": 300,
+ "name": "ElementaryTypeName",
+ "src": "2344:4:0"
+ }
+ ],
+ "id": 301,
+ "name": "VariableDeclaration",
+ "src": "2344:4:0"
+ }
+ ],
+ "id": 302,
+ "name": "ParameterList",
+ "src": "2343:6:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 302
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": ">",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "-",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "balance",
+ "referencedDeclaration": null,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 466,
+ "type": "contract Payroll",
+ "value": "this"
+ },
+ "id": 303,
+ "name": "Identifier",
+ "src": "2367:4:0"
+ }
+ ],
+ "id": 304,
+ "name": "MemberAccess",
+ "src": "2367:12:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "arguments": [
+ null
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ null
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 298,
+ "type": "function () view returns (uint256)",
+ "value": "calculateRunway"
+ },
+ "id": 305,
+ "name": "Identifier",
+ "src": "2382:15:0"
+ }
+ ],
+ "id": 306,
+ "name": "FunctionCall",
+ "src": "2382:17:0"
+ }
+ ],
+ "id": 307,
+ "name": "BinaryOperation",
+ "src": "2367:32:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 308,
+ "name": "Literal",
+ "src": "2402:1:0"
+ }
+ ],
+ "id": 309,
+ "name": "BinaryOperation",
+ "src": "2367:36:0"
+ }
+ ],
+ "id": 310,
+ "name": "Return",
+ "src": "2360:43:0"
+ }
+ ],
+ "id": 311,
+ "name": "Block",
+ "src": "2350:60:0"
+ }
+ ],
+ "id": 312,
+ "name": "FunctionDefinition",
+ "src": "2298:112:0"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "getBalance",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "view",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 313,
+ "name": "ParameterList",
+ "src": "2435:2:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 321,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 314,
+ "name": "ElementaryTypeName",
+ "src": "2458:4:0"
+ }
+ ],
+ "id": 315,
+ "name": "VariableDeclaration",
+ "src": "2458:4:0"
+ }
+ ],
+ "id": 316,
+ "name": "ParameterList",
+ "src": "2457:6:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 316
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "balance",
+ "referencedDeclaration": null,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 466,
+ "type": "contract Payroll",
+ "value": "this"
+ },
+ "id": 317,
+ "name": "Identifier",
+ "src": "2481:4:0"
+ }
+ ],
+ "id": 318,
+ "name": "MemberAccess",
+ "src": "2481:12:0"
+ }
+ ],
+ "id": 319,
+ "name": "Return",
+ "src": "2474:19:0"
+ }
+ ],
+ "id": 320,
+ "name": "Block",
+ "src": "2464:36:0"
+ }
+ ],
+ "id": 321,
+ "name": "FunctionDefinition",
+ "src": "2416:84:0"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "getEmployeeSalary",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "view",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "addr",
+ "scope": 334,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 322,
+ "name": "ElementaryTypeName",
+ "src": "2533:7:0"
+ }
+ ],
+ "id": 323,
+ "name": "VariableDeclaration",
+ "src": "2533:12:0"
+ }
+ ],
+ "id": 324,
+ "name": "ParameterList",
+ "src": "2532:14:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 334,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 325,
+ "name": "ElementaryTypeName",
+ "src": "2567:4:0"
+ }
+ ],
+ "id": 326,
+ "name": "VariableDeclaration",
+ "src": "2567:4:0"
+ }
+ ],
+ "id": 327,
+ "name": "ParameterList",
+ "src": "2566:6:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 327
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 9,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 21,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 328,
+ "name": "Identifier",
+ "src": "2590:9:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 323,
+ "type": "address",
+ "value": "addr"
+ },
+ "id": 329,
+ "name": "Identifier",
+ "src": "2600:4:0"
+ }
+ ],
+ "id": 330,
+ "name": "IndexAccess",
+ "src": "2590:15:0"
+ }
+ ],
+ "id": 331,
+ "name": "MemberAccess",
+ "src": "2590:22:0"
+ }
+ ],
+ "id": 332,
+ "name": "Return",
+ "src": "2583:29:0"
+ }
+ ],
+ "id": 333,
+ "name": "Block",
+ "src": "2573:46:0"
+ }
+ ],
+ "id": 334,
+ "name": "FunctionDefinition",
+ "src": "2506:113:0"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "getAddress",
+ "payable": false,
+ "scope": 343,
+ "stateMutability": "view",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 335,
+ "name": "ParameterList",
+ "src": "2644:2:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 342,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 336,
+ "name": "ElementaryTypeName",
+ "src": "2667:7:0"
+ }
+ ],
+ "id": 337,
+ "name": "VariableDeclaration",
+ "src": "2667:7:0"
+ }
+ ],
+ "id": 338,
+ "name": "ParameterList",
+ "src": "2666:9:0"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 338
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 466,
+ "type": "contract Payroll",
+ "value": "this"
+ },
+ "id": 339,
+ "name": "Identifier",
+ "src": "2693:4:0"
+ }
+ ],
+ "id": 340,
+ "name": "Return",
+ "src": "2686:11:0"
+ }
+ ],
+ "id": 341,
+ "name": "Block",
+ "src": "2676:28:0"
+ }
+ ],
+ "id": 342,
+ "name": "FunctionDefinition",
+ "src": "2625:79:0"
+ }
+ ],
+ "id": 343,
+ "name": "ContractDefinition",
+ "src": "50:2666:0"
+ }
+ ],
+ "id": 344,
+ "name": "SourceUnit",
+ "src": "0:2716:0"
+ },
+ "compiler": {
+ "name": "solc",
+ "version": "0.4.18+commit.9cf6e910.Emscripten.clang"
+ },
+ "networks": {
+ "4447": {
+ "events": {},
+ "links": {},
+ "address": "0xf25186b5081ff5ce73482ad761db0eb0d25abfbf"
+ },
+ "5777": {
+ "events": {},
+ "links": {},
+ "address": "0x9fbda871d559710256a2502a2517b794b482db40"
+ },
+ "1516494346939": {
+ "events": {},
+ "links": {},
+ "address": "0xc8ff05eb96968673de5681a437f3fa31aa15184d"
+ }
+ },
+ "schemaVersion": "1.0.1",
+ "updatedAt": "2018-01-31T20:36:45.861Z"
+}
\ No newline at end of file
diff --git a/Lesson4/assignment/contracts/Migrations.sol b/Lesson4/assignment/contracts/Migrations.sol
new file mode 100644
index 000000000..eeed7a4e9
--- /dev/null
+++ b/Lesson4/assignment/contracts/Migrations.sol
@@ -0,0 +1,23 @@
+pragma solidity ^0.4.2;
+
+contract Migrations {
+ address public owner;
+ uint public last_completed_migration;
+
+ modifier restricted() {
+ if (msg.sender == owner) _;
+ }
+
+ function Migrations() public {
+ owner = msg.sender;
+ }
+
+ function setCompleted(uint completed) public restricted {
+ last_completed_migration = completed;
+ }
+
+ function upgrade(address new_address) public restricted {
+ Migrations upgraded = Migrations(new_address);
+ upgraded.setCompleted(last_completed_migration);
+ }
+}
diff --git a/Lesson4/assignment/contracts/Payroll.sol b/Lesson4/assignment/contracts/Payroll.sol
new file mode 100644
index 000000000..ddc66f8c8
--- /dev/null
+++ b/Lesson4/assignment/contracts/Payroll.sol
@@ -0,0 +1,106 @@
+pragma solidity ^0.4.2;
+
+import "./SafeMath.sol";
+contract Payroll {
+ using SafeMath for uint;
+ struct Employee {
+ address id;
+ uint salary;
+ uint lastPayday;
+ }
+ uint constant payDuration = 10 seconds;
+ address owner;
+ mapping (address => Employee) employees;
+
+ uint totalSalary = 0;
+
+ function Payroll() public {
+ owner = msg.sender;
+ }
+
+ function _partialPaid(Employee employee) private {
+ uint payment = employee.salary.mul((now.sub(employee.lastPayday)).div(payDuration)) ;
+ if(payment > 0){
+ employee.lastPayday = now;
+ employee.id.transfer(payment);
+ }
+ }
+
+
+ modifier requireOwner() {
+ require(msg.sender == owner);
+ _;
+ }
+
+ modifier validAddress(address addr) {
+ require(addr != 0x0);
+ _;
+ }
+
+ function addEmployee(address employeeId, uint salary) public requireOwner
+ validAddress(employeeId){
+ var e = employees[employeeId];
+ if (e.id != 0x0) revert();
+ totalSalary = totalSalary.add(salary);
+ employees[employeeId] = Employee(employeeId, salary, now);
+ }
+
+ function removeEmployee(address employeeId) public payable requireOwner validAddress(employeeId){
+ var e = employees[employeeId];
+ if (e.id == 0x0) revert();
+ _partialPaid(e);
+ totalSalary-= e.salary;
+ e.id=0;
+ e.salary=0;
+
+ delete employees[employeeId];
+
+ }
+
+ function updateEmployee(address employeeId, uint salary) public requireOwner payable validAddress(employeeId){
+ var e = employees[employeeId];
+ if (e.id == 0x0) revert();
+ e.salary = salary;
+ }
+
+
+ function addFund() public payable returns(uint)
+ {
+ return this.balance;
+ }
+
+ function getPaid(address e) public requireOwner {
+ require(employees[e].id != 0x0);
+ getPaid(employees[e]);
+ }
+
+ function getPaid(Employee e) internal requireOwner {
+
+ var nextPayday = e.lastPayday.add(payDuration);
+ assert(nextPayday < now);
+ e.lastPayday = nextPayday;
+ e.id.transfer(e.salary);
+ }
+
+ function calculateRunway() public view returns(uint) {
+ return totalSalary;
+ }
+
+ function hasEnoughFund() public view returns(bool) {
+ return this.balance - calculateRunway() > 0;
+ }
+
+ function getBalance() public view returns(uint) {
+ return this.balance;
+ }
+
+ function getEmployeeSalary(address addr) public view returns(uint) {
+ return employees[addr].salary;
+ }
+
+ function getAddress() public view returns(address) {
+ return this;
+ }
+
+
+}
\ No newline at end of file
diff --git a/Lesson4/assignment/contracts/SafeMath.sol b/Lesson4/assignment/contracts/SafeMath.sol
new file mode 100644
index 000000000..a17ea40cf
--- /dev/null
+++ b/Lesson4/assignment/contracts/SafeMath.sol
@@ -0,0 +1,48 @@
+pragma solidity ^0.4.2;
+
+
+/**
+ * @title SafeMath
+ * @dev Math operations with safety checks that throw on error
+ */
+library SafeMath {
+
+ /**
+ * @dev Multiplies two numbers, throws on overflow.
+ */
+ function mul(uint256 a, uint256 b) internal pure returns (uint256) {
+ if (a == 0) {
+ return 0;
+ }
+ uint256 c = a * b;
+ assert(c / a == b);
+ return c;
+ }
+
+ /**
+ * @dev Integer division of two numbers, truncating the quotient.
+ */
+ function div(uint256 a, uint256 b) internal pure returns (uint256) {
+ // assert(b > 0); // Solidity automatically throws when dividing by 0
+ uint256 c = a / b;
+ // assert(a == b * c + a % b); // There is no case in which this doesn't hold
+ return c;
+ }
+
+ /**
+ * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
+ */
+ function sub(uint256 a, uint256 b) internal pure returns (uint256) {
+ assert(b <= a);
+ return a - b;
+ }
+
+ /**
+ * @dev Adds two numbers, throws on overflow.
+ */
+ function add(uint256 a, uint256 b) internal pure returns (uint256) {
+ uint256 c = a + b;
+ assert(c >= a);
+ return c;
+ }
+}
\ No newline at end of file
diff --git a/Lesson4/assignment/migrations/2_deploy_contracts.js b/Lesson4/assignment/migrations/2_deploy_contracts.js
new file mode 100644
index 000000000..164d78d6c
--- /dev/null
+++ b/Lesson4/assignment/migrations/2_deploy_contracts.js
@@ -0,0 +1,7 @@
+var Payroll = artifacts.require("./Payroll.sol");
+var SafeMath = artifacts.require("./SafeMath.sol");
+module.exports = function(deployer) {
+ deployer.deploy(SafeMath);
+ deployer.link(SafeMath, Payroll);
+ deployer.deploy(Payroll);
+}
diff --git a/Lesson4/assignment/test/TestPayroll.sol b/Lesson4/assignment/test/TestPayroll.sol
new file mode 100644
index 000000000..938f2c432
--- /dev/null
+++ b/Lesson4/assignment/test/TestPayroll.sol
@@ -0,0 +1,27 @@
+pragma solidity ^0.4.2;
+
+import "truffle/Assert.sol";
+import "truffle/DeployedAddresses.sol";
+import "../contracts/Payroll.sol";
+
+contract TestPayroll {
+
+ function testAddEmployee() public {
+ Payroll payroll = Payroll(DeployedAddresses.Payroll());
+ payroll.addFund();
+ payroll.addEmployee(0x1111, 1);
+ payroll.getEmployeeSalary(0x1111);
+
+ Assert.equal(payroll.getEmployeeSalary(0x1111),1,"salay shoud be 1");
+ //Assert.equal(meta.getBalance(tx.origin), expected, "Owner should have 10000 MetaCoin initially");
+ }
+
+ function testRemoveEmployee() public {
+ Payroll payroll = Payroll(DeployedAddresses.Payroll());
+ payroll.addFund();
+ payroll.addEmployee(0x1111, 1);
+ payroll.removeEmployee(0x1111);
+ Assert.equal(payroll.getEmployeeSalary(0x1111),0,"salay shoud be 0");
+ }
+
+}
diff --git a/Lesson4/assignment/test/payroll.js b/Lesson4/assignment/test/payroll.js
new file mode 100644
index 000000000..e4296b066
--- /dev/null
+++ b/Lesson4/assignment/test/payroll.js
@@ -0,0 +1,39 @@
+var PayRoll = artifacts.require("./Payroll.sol");
+
+contract('PayRoll', function (accounts) {
+
+
+ // addEmployee
+ it("...add emoloyee successfully.", function () {
+ return PayRoll.deployed().then(function (instance) {
+ payrollInstance = instance;
+ }).then(function(){
+ return payrollInstance.sendTransaction({value:web3.toWei(1, "ether")});
+ }).then(function(){
+ return payrollInstance.addEmployee("0x123", 1);
+ }).then(function() {
+ return payrollInstance.getEmployeeSalary.call("0x123");
+ })
+ .then(function(salary){
+ assert.equal(salary, 1, "fail");
+ });
+ });
+
+ // removeEmployee
+ it("...remove employee successfully.", function() {
+ return PayRoll.deployed().then(function (instance) {
+ payrollInstance = instance;
+ }).then(function(){
+ return payrollInstance.sendTransaction({value:web3.toWei(1, "ether")});
+ }).then(function() {
+ return payrollInstance.addEmployee(accounts[2], 5);
+ }).then(function() {
+ return payrollInstance.removeEmployee(accounts[2]);
+ }).then(function() {
+ return payrollInstance.getEmployeeSalary.call(accounts[2]);
+ })
+ .then(function(salary) {
+ assert.equal(salary, 0, "fail");
+ });
+ });
+});
\ No newline at end of file
diff --git a/Lesson4/assignment/truffle.js b/Lesson4/assignment/truffle.js
new file mode 100644
index 000000000..f41bb0228
--- /dev/null
+++ b/Lesson4/assignment/truffle.js
@@ -0,0 +1,9 @@
+module.exports = {
+ networks:{
+ development:{
+ host: "localhost",
+ port: 7545,
+ network_id: "*"
+ }
+ }
+};
diff --git a/Lesson4/assignment/yours.sol b/Lesson4/assignment/yours.sol
new file mode 100644
index 000000000..dfdb2c486
--- /dev/null
+++ b/Lesson4/assignment/yours.sol
@@ -0,0 +1 @@
+/*作业请提交在这个目录下*/
diff --git a/Lesson4/orgin/README.md b/Lesson4/orgin/README.md
new file mode 100644
index 000000000..c27ba052f
--- /dev/null
+++ b/Lesson4/orgin/README.md
@@ -0,0 +1,3 @@
+## 硅谷live以太坊智能合约 第四课
+
+这里是每一课的初始代码,有需要的同学可以参考
diff --git a/Lesson4/orgin/payroll.sol b/Lesson4/orgin/payroll.sol
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/Lesson4/orgin/payroll.sol
@@ -0,0 +1 @@
+
diff --git a/Lesson5/README.md b/Lesson5/README.md
new file mode 100644
index 000000000..0d3ed1d1e
--- /dev/null
+++ b/Lesson5/README.md
@@ -0,0 +1,13 @@
+## 硅谷live以太坊智能合约频道官方地址
+
+### 第五课
+
+目录结构
+
|
+
|--orgin 课程初始代码
+
|
+
|--assignment 课程作业提交代码
+
+
+### 本节知识点
+
diff --git a/Lesson5/assignment/README.md b/Lesson5/assignment/README.md
new file mode 100644
index 000000000..5661cd368
--- /dev/null
+++ b/Lesson5/assignment/README.md
@@ -0,0 +1,2 @@
+## 硅谷live以太坊智能合约 第五课作业
+这里是同学提交作业的目录
diff --git a/Lesson5/orgin/LICENSE b/Lesson5/orgin/LICENSE
new file mode 100644
index 000000000..8dada3eda
--- /dev/null
+++ b/Lesson5/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/Lesson5/orgin/README.md b/Lesson5/orgin/README.md
new file mode 100644
index 000000000..7c98c0387
--- /dev/null
+++ b/Lesson5/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/Lesson5/orgin/box-img-lg.png b/Lesson5/orgin/box-img-lg.png
new file mode 100644
index 000000000..60c19962a
Binary files /dev/null and b/Lesson5/orgin/box-img-lg.png differ
diff --git a/Lesson5/orgin/box-img-sm.png b/Lesson5/orgin/box-img-sm.png
new file mode 100644
index 000000000..466e7097e
Binary files /dev/null and b/Lesson5/orgin/box-img-sm.png differ
diff --git a/Lesson5/orgin/config/env.js b/Lesson5/orgin/config/env.js
new file mode 100644
index 000000000..5d0ab7b79
--- /dev/null
+++ b/Lesson5/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/Lesson5/orgin/config/jest/cssTransform.js b/Lesson5/orgin/config/jest/cssTransform.js
new file mode 100644
index 000000000..aa17d127a
--- /dev/null
+++ b/Lesson5/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/Lesson5/orgin/config/jest/fileTransform.js b/Lesson5/orgin/config/jest/fileTransform.js
new file mode 100644
index 000000000..927eb305a
--- /dev/null
+++ b/Lesson5/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/Lesson5/orgin/config/paths.js b/Lesson5/orgin/config/paths.js
new file mode 100644
index 000000000..96c3dfb11
--- /dev/null
+++ b/Lesson5/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/Lesson5/orgin/config/polyfills.js b/Lesson5/orgin/config/polyfills.js
new file mode 100644
index 000000000..7e601502b
--- /dev/null
+++ b/Lesson5/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/Lesson5/orgin/config/webpack.config.dev.js b/Lesson5/orgin/config/webpack.config.dev.js
new file mode 100644
index 000000000..821743a2e
--- /dev/null
+++ b/Lesson5/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