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..90973afd0
--- /dev/null
+++ b/Lesson4/assignment/build/contracts/Migrations.json
@@ -0,0 +1,827 @@
+{
+ "contractName": "Migrations",
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "last_completed_migration",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "completed",
+ "type": "uint256"
+ }
+ ],
+ "name": "setCompleted",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "new_address",
+ "type": "address"
+ }
+ ],
+ "name": "upgrade",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+ ],
+ "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820995baf09e22d4f827edcadc14eae0b4e640ac9c6ec89d0448ee9e3c9a78806ad0029",
+ "deployedBytecode": "0x606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820995baf09e22d4f827edcadc14eae0b4e640ac9c6ec89d0448ee9e3c9a78806ad0029",
+ "sourceMap": "26:488:0:-;;;178:58;;;;;;;;221:10;213:5;;:18;;;;;;;;;;;;;;;;;;26:488;;;;;;",
+ "deployedSourceMap": "26:488:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;;;;;;;;;;;;;;;;;;;;;;;;;;;;74:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;50:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;240:103;;;;;;;;;;;;;;;;;;;;;;;;;;347:165;409:19;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;442:11;409:45;;460:8;:21;;;482:24;;460:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;143:26;347:165;;:::o;74:36::-;;;;:::o;50:20::-;;;;;;;;;;;;;:::o;240:103::-;161:5;;;;;;;;;;;147:19;;:10;:19;;;143:26;;;329:9;302:24;:36;;;;143:26;240:103;:::o",
+ "source": "pragma solidity ^0.4.17;\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/wentao/IdeaProjects/ethereum/class4/contracts/Migrations.sol",
+ "ast": {
+ "attributes": {
+ "absolutePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/Migrations.sol",
+ "exportedSymbols": {
+ "Migrations": [
+ 56
+ ]
+ }
+ },
+ "children": [
+ {
+ "attributes": {
+ "literals": [
+ "solidity",
+ "^",
+ "0.4",
+ ".17"
+ ]
+ },
+ "id": 1,
+ "name": "PragmaDirective",
+ "src": "0:24: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": "50:7:0"
+ }
+ ],
+ "id": 3,
+ "name": "VariableDeclaration",
+ "src": "50: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": "74:4:0"
+ }
+ ],
+ "id": 5,
+ "name": "VariableDeclaration",
+ "src": "74:36:0"
+ },
+ {
+ "attributes": {
+ "name": "restricted",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 6,
+ "name": "ParameterList",
+ "src": "134: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": 539,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 7,
+ "name": "Identifier",
+ "src": "147:3:0"
+ }
+ ],
+ "id": 8,
+ "name": "MemberAccess",
+ "src": "147:10:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 3,
+ "type": "address",
+ "value": "owner"
+ },
+ "id": 9,
+ "name": "Identifier",
+ "src": "161:5:0"
+ }
+ ],
+ "id": 10,
+ "name": "BinaryOperation",
+ "src": "147:19:0"
+ },
+ {
+ "id": 11,
+ "name": "PlaceholderStatement",
+ "src": "168:1:0"
+ }
+ ],
+ "id": 12,
+ "name": "IfStatement",
+ "src": "143:26:0"
+ }
+ ],
+ "id": 13,
+ "name": "Block",
+ "src": "137:37:0"
+ }
+ ],
+ "id": 14,
+ "name": "ModifierDefinition",
+ "src": "115: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": "197:2:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 16,
+ "name": "ParameterList",
+ "src": "207: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": "213: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": 539,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 18,
+ "name": "Identifier",
+ "src": "221:3:0"
+ }
+ ],
+ "id": 19,
+ "name": "MemberAccess",
+ "src": "221:10:0"
+ }
+ ],
+ "id": 20,
+ "name": "Assignment",
+ "src": "213:18:0"
+ }
+ ],
+ "id": 21,
+ "name": "ExpressionStatement",
+ "src": "213:18:0"
+ }
+ ],
+ "id": 22,
+ "name": "Block",
+ "src": "207:29:0"
+ }
+ ],
+ "id": 23,
+ "name": "FunctionDefinition",
+ "src": "178: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": "262:4:0"
+ }
+ ],
+ "id": 25,
+ "name": "VariableDeclaration",
+ "src": "262:14:0"
+ }
+ ],
+ "id": 26,
+ "name": "ParameterList",
+ "src": "261:16:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 29,
+ "name": "ParameterList",
+ "src": "296:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 14,
+ "type": "modifier ()",
+ "value": "restricted"
+ },
+ "id": 27,
+ "name": "Identifier",
+ "src": "285:10:0"
+ }
+ ],
+ "id": 28,
+ "name": "ModifierInvocation",
+ "src": "285: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": "302:24:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 25,
+ "type": "uint256",
+ "value": "completed"
+ },
+ "id": 31,
+ "name": "Identifier",
+ "src": "329:9:0"
+ }
+ ],
+ "id": 32,
+ "name": "Assignment",
+ "src": "302:36:0"
+ }
+ ],
+ "id": 33,
+ "name": "ExpressionStatement",
+ "src": "302:36:0"
+ }
+ ],
+ "id": 34,
+ "name": "Block",
+ "src": "296:47:0"
+ }
+ ],
+ "id": 35,
+ "name": "FunctionDefinition",
+ "src": "240: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": "364:7:0"
+ }
+ ],
+ "id": 37,
+ "name": "VariableDeclaration",
+ "src": "364:19:0"
+ }
+ ],
+ "id": 38,
+ "name": "ParameterList",
+ "src": "363:21:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 41,
+ "name": "ParameterList",
+ "src": "403:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 14,
+ "type": "modifier ()",
+ "value": "restricted"
+ },
+ "id": 39,
+ "name": "Identifier",
+ "src": "392:10:0"
+ }
+ ],
+ "id": 40,
+ "name": "ModifierInvocation",
+ "src": "392: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": "409:10:0"
+ }
+ ],
+ "id": 43,
+ "name": "VariableDeclaration",
+ "src": "409: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": "431:10:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 37,
+ "type": "address",
+ "value": "new_address"
+ },
+ "id": 45,
+ "name": "Identifier",
+ "src": "442:11:0"
+ }
+ ],
+ "id": 46,
+ "name": "FunctionCall",
+ "src": "431:23:0"
+ }
+ ],
+ "id": 47,
+ "name": "VariableDeclarationStatement",
+ "src": "409: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": "460:8:0"
+ }
+ ],
+ "id": 50,
+ "name": "MemberAccess",
+ "src": "460:21:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 5,
+ "type": "uint256",
+ "value": "last_completed_migration"
+ },
+ "id": 51,
+ "name": "Identifier",
+ "src": "482:24:0"
+ }
+ ],
+ "id": 52,
+ "name": "FunctionCall",
+ "src": "460:47:0"
+ }
+ ],
+ "id": 53,
+ "name": "ExpressionStatement",
+ "src": "460:47:0"
+ }
+ ],
+ "id": 54,
+ "name": "Block",
+ "src": "403:109:0"
+ }
+ ],
+ "id": 55,
+ "name": "FunctionDefinition",
+ "src": "347:165:0"
+ }
+ ],
+ "id": 56,
+ "name": "ContractDefinition",
+ "src": "26:488:0"
+ }
+ ],
+ "id": 57,
+ "name": "SourceUnit",
+ "src": "0:515:0"
+ },
+ "compiler": {
+ "name": "solc",
+ "version": "0.4.19+commit.c4cbbb05.Emscripten.clang"
+ },
+ "networks": {
+ "1517826747297": {
+ "events": {},
+ "links": {},
+ "address": "0x7eb9e7728e6a69a3f27573669ec6e8cb919cbc6e"
+ }
+ },
+ "schemaVersion": "1.0.1",
+ "updatedAt": "2018-02-05T10:38:19.949Z"
+}
\ No newline at end of file
diff --git a/Lesson4/assignment/build/contracts/Ownable.json b/Lesson4/assignment/build/contracts/Ownable.json
new file mode 100644
index 000000000..1f89a6968
--- /dev/null
+++ b/Lesson4/assignment/build/contracts/Ownable.json
@@ -0,0 +1,847 @@
+{
+ "contractName": "Ownable",
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "inputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "constructor"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "previousOwner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnershipTransferred",
+ "type": "event"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+ ],
+ "bytecode": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102858061005e6000396000f30060606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610051578063f2fde38b146100a6575b600080fd5b341561005c57600080fd5b6100646100df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b157600080fd5b6100dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610104565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561019b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058203754f3149cecae8c5627a1ca38f242318c6e12fd3d1fc5bc539eb0fd94db71780029",
+ "deployedBytecode": "0x60606040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680638da5cb5b14610051578063f2fde38b146100a6575b600080fd5b341561005c57600080fd5b6100646100df565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156100b157600080fd5b6100dd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610104565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561015f57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561019b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058203754f3149cecae8c5627a1ca38f242318c6e12fd3d1fc5bc539eb0fd94db71780029",
+ "sourceMap": "217:787:0:-;;;469:55;;;;;;;;509:10;501:5;;:18;;;;;;;;;;;;;;;;;;217:787;;;;;;",
+ "deployedSourceMap": "217:787:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;832:169;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20;;;;;;;;;;;;;:::o;832:169::-;653:5;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;928:1;908:22;;:8;:22;;;;900:31;;;;;;;;965:8;937:37;;958:5;;;;;;;;;;;937:37;;;;;;;;;;;;988:8;980:5;;:16;;;;;;;;;;;;;;;;;;832:169;:::o",
+ "source": "pragma solidity ^0.4.18;\n\n\n/**\n * @title Ownable\n * @dev The Ownable contract has an owner address, and provides basic authorization control\n * functions, this simplifies the implementation of \"user permissions\".\n */\ncontract Ownable {\n address public owner;\n\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n\n /**\n * @dev The Ownable constructor sets the original `owner` of the contract to the sender\n * account.\n */\n function Ownable() public {\n owner = msg.sender;\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n require(msg.sender == owner);\n _;\n }\n\n /**\n * @dev Allows the current owner to transfer control of the contract to a newOwner.\n * @param newOwner The address to transfer ownership to.\n */\n function transferOwnership(address newOwner) public onlyOwner {\n require(newOwner != address(0));\n OwnershipTransferred(owner, newOwner);\n owner = newOwner;\n }\n\n}",
+ "sourcePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/Ownable.sol",
+ "ast": {
+ "attributes": {
+ "absolutePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/Ownable.sol",
+ "exportedSymbols": {
+ "Ownable": [
+ 55
+ ]
+ }
+ },
+ "children": [
+ {
+ "attributes": {
+ "literals": [
+ "solidity",
+ "^",
+ "0.4",
+ ".18"
+ ]
+ },
+ "id": 1,
+ "name": "PragmaDirective",
+ "src": "0:24:0"
+ },
+ {
+ "attributes": {
+ "baseContracts": [
+ null
+ ],
+ "contractDependencies": [
+ null
+ ],
+ "contractKind": "contract",
+ "documentation": "@title Ownable\n@dev The Ownable contract has an owner address, and provides basic authorization control\nfunctions, this simplifies the implementation of \"user permissions\".",
+ "fullyImplemented": true,
+ "linearizedBaseContracts": [
+ 55
+ ],
+ "name": "Ownable",
+ "scope": 56
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "owner",
+ "scope": 55,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 2,
+ "name": "ElementaryTypeName",
+ "src": "238:7:0"
+ }
+ ],
+ "id": 3,
+ "name": "VariableDeclaration",
+ "src": "238:20:0"
+ },
+ {
+ "attributes": {
+ "anonymous": false,
+ "name": "OwnershipTransferred"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "indexed": true,
+ "name": "previousOwner",
+ "scope": 9,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 4,
+ "name": "ElementaryTypeName",
+ "src": "291:7:0"
+ }
+ ],
+ "id": 5,
+ "name": "VariableDeclaration",
+ "src": "291:29:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "indexed": true,
+ "name": "newOwner",
+ "scope": 9,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 6,
+ "name": "ElementaryTypeName",
+ "src": "322:7:0"
+ }
+ ],
+ "id": 7,
+ "name": "VariableDeclaration",
+ "src": "322:24:0"
+ }
+ ],
+ "id": 8,
+ "name": "ParameterList",
+ "src": "290:57:0"
+ }
+ ],
+ "id": 9,
+ "name": "EventDefinition",
+ "src": "264:84:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": true,
+ "modifiers": [
+ null
+ ],
+ "name": "Ownable",
+ "payable": false,
+ "scope": 55,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 10,
+ "name": "ParameterList",
+ "src": "485:2:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 11,
+ "name": "ParameterList",
+ "src": "495: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": 12,
+ "name": "Identifier",
+ "src": "501: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": 509,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 13,
+ "name": "Identifier",
+ "src": "509:3:0"
+ }
+ ],
+ "id": 14,
+ "name": "MemberAccess",
+ "src": "509:10:0"
+ }
+ ],
+ "id": 15,
+ "name": "Assignment",
+ "src": "501:18:0"
+ }
+ ],
+ "id": 16,
+ "name": "ExpressionStatement",
+ "src": "501:18:0"
+ }
+ ],
+ "id": 17,
+ "name": "Block",
+ "src": "495:29:0"
+ }
+ ],
+ "id": 18,
+ "name": "FunctionDefinition",
+ "src": "469:55:0"
+ },
+ {
+ "attributes": {
+ "name": "onlyOwner",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 19,
+ "name": "ParameterList",
+ "src": "622: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": 512,
+ "type": "function (bool) pure",
+ "value": "require"
+ },
+ "id": 20,
+ "name": "Identifier",
+ "src": "631: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": 509,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 21,
+ "name": "Identifier",
+ "src": "639:3:0"
+ }
+ ],
+ "id": 22,
+ "name": "MemberAccess",
+ "src": "639:10:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 3,
+ "type": "address",
+ "value": "owner"
+ },
+ "id": 23,
+ "name": "Identifier",
+ "src": "653:5:0"
+ }
+ ],
+ "id": 24,
+ "name": "BinaryOperation",
+ "src": "639:19:0"
+ }
+ ],
+ "id": 25,
+ "name": "FunctionCall",
+ "src": "631:28:0"
+ }
+ ],
+ "id": 26,
+ "name": "ExpressionStatement",
+ "src": "631:28:0"
+ },
+ {
+ "id": 27,
+ "name": "PlaceholderStatement",
+ "src": "665:1:0"
+ }
+ ],
+ "id": 28,
+ "name": "Block",
+ "src": "625:46:0"
+ }
+ ],
+ "id": 29,
+ "name": "ModifierDefinition",
+ "src": "604:67:0"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "transferOwnership",
+ "payable": false,
+ "scope": 55,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "newOwner",
+ "scope": 54,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 30,
+ "name": "ElementaryTypeName",
+ "src": "859:7:0"
+ }
+ ],
+ "id": 31,
+ "name": "VariableDeclaration",
+ "src": "859:16:0"
+ }
+ ],
+ "id": 32,
+ "name": "ParameterList",
+ "src": "858:18:0"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 35,
+ "name": "ParameterList",
+ "src": "894:0:0"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 29,
+ "type": "modifier ()",
+ "value": "onlyOwner"
+ },
+ "id": 33,
+ "name": "Identifier",
+ "src": "884:9:0"
+ }
+ ],
+ "id": 34,
+ "name": "ModifierInvocation",
+ "src": "884:9: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": 512,
+ "type": "function (bool) pure",
+ "value": "require"
+ },
+ "id": 36,
+ "name": "Identifier",
+ "src": "900: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": 31,
+ "type": "address",
+ "value": "newOwner"
+ },
+ "id": 37,
+ "name": "Identifier",
+ "src": "908:8:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "address",
+ "type_conversion": true
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_rational_0_by_1",
+ "typeString": "int_const 0"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "type": "type(address)",
+ "value": "address"
+ },
+ "id": 38,
+ "name": "ElementaryTypeNameExpression",
+ "src": "920: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": 39,
+ "name": "Literal",
+ "src": "928:1:0"
+ }
+ ],
+ "id": 40,
+ "name": "FunctionCall",
+ "src": "920:10:0"
+ }
+ ],
+ "id": 41,
+ "name": "BinaryOperation",
+ "src": "908:22:0"
+ }
+ ],
+ "id": 42,
+ "name": "FunctionCall",
+ "src": "900:31:0"
+ }
+ ],
+ "id": 43,
+ "name": "ExpressionStatement",
+ "src": "900: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_address",
+ "typeString": "address"
+ },
+ {
+ "typeIdentifier": "t_address",
+ "typeString": "address"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 9,
+ "type": "function (address,address)",
+ "value": "OwnershipTransferred"
+ },
+ "id": 44,
+ "name": "Identifier",
+ "src": "937:20:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 3,
+ "type": "address",
+ "value": "owner"
+ },
+ "id": 45,
+ "name": "Identifier",
+ "src": "958:5:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 31,
+ "type": "address",
+ "value": "newOwner"
+ },
+ "id": 46,
+ "name": "Identifier",
+ "src": "965:8:0"
+ }
+ ],
+ "id": 47,
+ "name": "FunctionCall",
+ "src": "937:37:0"
+ }
+ ],
+ "id": 48,
+ "name": "ExpressionStatement",
+ "src": "937:37:0"
+ },
+ {
+ "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": 49,
+ "name": "Identifier",
+ "src": "980:5:0"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 31,
+ "type": "address",
+ "value": "newOwner"
+ },
+ "id": 50,
+ "name": "Identifier",
+ "src": "988:8:0"
+ }
+ ],
+ "id": 51,
+ "name": "Assignment",
+ "src": "980:16:0"
+ }
+ ],
+ "id": 52,
+ "name": "ExpressionStatement",
+ "src": "980:16:0"
+ }
+ ],
+ "id": 53,
+ "name": "Block",
+ "src": "894:107:0"
+ }
+ ],
+ "id": 54,
+ "name": "FunctionDefinition",
+ "src": "832:169:0"
+ }
+ ],
+ "id": 55,
+ "name": "ContractDefinition",
+ "src": "217:787:0"
+ }
+ ],
+ "id": 56,
+ "name": "SourceUnit",
+ "src": "0:1004:0"
+ },
+ "compiler": {
+ "name": "solc",
+ "version": "0.4.19+commit.c4cbbb05.Emscripten.clang"
+ },
+ "networks": {
+ "1517826747297": {
+ "events": {},
+ "links": {},
+ "address": "0xad08beaec3da2baa37c4920c102dc0b1da0249f4"
+ }
+ },
+ "schemaVersion": "1.0.1",
+ "updatedAt": "2018-02-05T10:43:03.875Z"
+}
\ 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..a5d6172d4
--- /dev/null
+++ b/Lesson4/assignment/build/contracts/Payroll.json
@@ -0,0 +1,5006 @@
+{
+ "contractName": "Payroll",
+ "abi": [
+ {
+ "constant": true,
+ "inputs": [],
+ "name": "owner",
+ "outputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": true,
+ "inputs": [
+ {
+ "name": "",
+ "type": "address"
+ }
+ ],
+ "name": "employees",
+ "outputs": [
+ {
+ "name": "id",
+ "type": "address"
+ },
+ {
+ "name": "salary",
+ "type": "uint256"
+ },
+ {
+ "name": "lastPayday",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "view",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "transferOwnership",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "anonymous": false,
+ "inputs": [
+ {
+ "indexed": true,
+ "name": "previousOwner",
+ "type": "address"
+ },
+ {
+ "indexed": true,
+ "name": "newOwner",
+ "type": "address"
+ }
+ ],
+ "name": "OwnershipTransferred",
+ "type": "event"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "employeeId",
+ "type": "address"
+ },
+ {
+ "name": "salary",
+ "type": "uint256"
+ }
+ ],
+ "name": "addEmployee",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "employeeId",
+ "type": "address"
+ }
+ ],
+ "name": "removeEmployee",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "employeeId",
+ "type": "address"
+ },
+ {
+ "name": "salary",
+ "type": "uint256"
+ }
+ ],
+ "name": "updateEmployee",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [],
+ "name": "addFund",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": true,
+ "stateMutability": "payable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [],
+ "name": "calculateRunway",
+ "outputs": [
+ {
+ "name": "",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [],
+ "name": "hasEnoughFund",
+ "outputs": [
+ {
+ "name": "",
+ "type": "bool"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [],
+ "name": "getPaid",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "employeeId",
+ "type": "address"
+ },
+ {
+ "name": "newPaymentAddress",
+ "type": "address"
+ }
+ ],
+ "name": "changePaymentAddress",
+ "outputs": [],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ },
+ {
+ "constant": false,
+ "inputs": [
+ {
+ "name": "id",
+ "type": "address"
+ }
+ ],
+ "name": "getEmployee",
+ "outputs": [
+ {
+ "name": "salary",
+ "type": "uint256"
+ }
+ ],
+ "payable": false,
+ "stateMutability": "nonpayable",
+ "type": "function"
+ }
+ ],
+ "bytecode": "0x60606040526000600155336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550611232806100586000396000f3006060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806323fed09e146100bf57806332648e09146100ec5780634ec19512146101395780635e91d8ec146101625780638da5cb5b146101a4578063a2f09dfa146101f9578063bc456c4214610217578063cf41d6f81461026f578063d067894714610284578063d108177a1461030b578063e7fd9a1314610344578063f2fde38b14610386575b600080fd5b34156100ca57600080fd5b6100d26103bf565b604051808215151515815260200191505060405180910390f35b34156100f757600080fd5b610123600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506103d0565b6040518082815260200191505060405180910390f35b341561014457600080fd5b61014c61046e565b6040518082815260200191505060405180910390f35b341561016d57600080fd5b6101a2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506104a1565b005b34156101af57600080fd5b6101b7610737565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61020161075c565b6040518082815260200191505060405180910390f35b341561022257600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061077b565b005b341561027a57600080fd5b61028261096d565b005b341561028f57600080fd5b6102bb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b16565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390f35b341561031657600080fd5b610342600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b60565b005b341561034f57600080fd5b610384600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610da6565b005b341561039157600080fd5b6103bd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f98565b005b6000806103ca61046e565b11905090565b600080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156104605760009150610468565b806001015491505b50919050565b600061049c6001543073ffffffffffffffffffffffffffffffffffffffff16316110ed90919063ffffffff16565b905090565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104ff57600080fd5b836000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561058a57fe5b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020935061064a84606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050611108565b610663846001015460015461119490919063ffffffff16565b600181905550610684670de0b6b3a7640000866111ad90919063ffffffff16565b925061069b836001546111e890919063ffffffff16565b60018190555082600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555042600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107d857600080fd5b336000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561086357fe5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020925061092383606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050611108565b838360000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b600080336000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156109fb57fe5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209350610a546064856002015461119490919063ffffffff16565b92504283101515610a6157fe5b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055508360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc85600101549081150290604051600060405180830381858888f193505050501515610b1057600080fd5b50505050565b60026020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154905083565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bbd57600080fd5b816000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610c4857fe5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250610d0883606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050611108565b610d21836001015460015461119490919063ffffffff16565b600181905550600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160009055505050505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610e8b57fe5b610ea6670de0b6b3a7640000846111ad90919063ffffffff16565b90506060604051908101604052808573ffffffffffffffffffffffffffffffffffffffff16815260200182815260200142815250600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155905050610f8c816001546111e890919063ffffffff16565b60018190555050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ff357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561102f57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082848115156110fb57fe5b0490508091505092915050565b600061114a606461113c61112985604001514261119490919063ffffffff16565b85602001516111ad90919063ffffffff16565b6110ed90919063ffffffff16565b9050816000015173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561119057600080fd5b5050565b60008282111515156111a257fe5b818303905092915050565b60008060008414156111c257600091506111e1565b82840290508284828115156111d357fe5b041415156111dd57fe5b8091505b5092915050565b60008082840190508381101515156111fc57fe5b80915050929150505600a165627a7a723058205e07e23cff84a2d03fb6a4eebfbd32caa6dc06240e3c1d4125115d0dad8d9f2d0029",
+ "deployedBytecode": "0x6060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806323fed09e146100bf57806332648e09146100ec5780634ec19512146101395780635e91d8ec146101625780638da5cb5b146101a4578063a2f09dfa146101f9578063bc456c4214610217578063cf41d6f81461026f578063d067894714610284578063d108177a1461030b578063e7fd9a1314610344578063f2fde38b14610386575b600080fd5b34156100ca57600080fd5b6100d26103bf565b604051808215151515815260200191505060405180910390f35b34156100f757600080fd5b610123600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506103d0565b6040518082815260200191505060405180910390f35b341561014457600080fd5b61014c61046e565b6040518082815260200191505060405180910390f35b341561016d57600080fd5b6101a2600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506104a1565b005b34156101af57600080fd5b6101b7610737565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61020161075c565b6040518082815260200191505060405180910390f35b341561022257600080fd5b61026d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061077b565b005b341561027a57600080fd5b61028261096d565b005b341561028f57600080fd5b6102bb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b16565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390f35b341561031657600080fd5b610342600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610b60565b005b341561034f57600080fd5b610384600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610da6565b005b341561039157600080fd5b6103bd600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610f98565b005b6000806103ca61046e565b11905090565b600080600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156104605760009150610468565b806001015491505b50919050565b600061049c6001543073ffffffffffffffffffffffffffffffffffffffff16316110ed90919063ffffffff16565b905090565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156104ff57600080fd5b836000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561058a57fe5b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020935061064a84606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050611108565b610663846001015460015461119490919063ffffffff16565b600181905550610684670de0b6b3a7640000866111ad90919063ffffffff16565b925061069b836001546111e890919063ffffffff16565b60018190555082600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555042600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107d857600080fd5b336000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561086357fe5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020925061092383606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050611108565b838360000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b600080336000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515156109fb57fe5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209350610a546064856002015461119490919063ffffffff16565b92504283101515610a6157fe5b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201819055508360000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc85600101549081150290604051600060405180830381858888f193505050501515610b1057600080fd5b50505050565b60026020528060005260406000206000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010154908060020154905083565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bbd57600080fd5b816000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515610c4857fe5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250610d0883606060405190810160405290816000820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160018201548152602001600282015481525050611108565b610d21836001015460015461119490919063ffffffff16565b600181905550600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905560018201600090556002820160009055505050505050565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e0457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020915060008260000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610e8b57fe5b610ea6670de0b6b3a7640000846111ad90919063ffffffff16565b90506060604051908101604052808573ffffffffffffffffffffffffffffffffffffffff16815260200182815260200142815250600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020155905050610f8c816001546111e890919063ffffffff16565b60018190555050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ff357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561102f57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082848115156110fb57fe5b0490508091505092915050565b600061114a606461113c61112985604001514261119490919063ffffffff16565b85602001516111ad90919063ffffffff16565b6110ed90919063ffffffff16565b9050816000015173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561119057600080fd5b5050565b60008282111515156111a257fe5b818303905092915050565b60008060008414156111c257600091506111e1565b82840290508284828115156111d357fe5b041415156111dd57fe5b8091505b5092915050565b60008082840190508381101515156111fc57fe5b80915050929150505600a165627a7a723058205e07e23cff84a2d03fb6a4eebfbd32caa6dc06240e3c1d4125115d0dad8d9f2d0029",
+ "sourceMap": "77:2728:1:-;;;300:1;281:20;;509:10:0;501:5;;:18;;;;;;;;;;;;;;;;;;77:2728:1;;;;;;",
+ "deployedSourceMap": "77:2728:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1939:86;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2582:219;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1838:95;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1313:428;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;238:20:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1747:85:1;;;;;;;;;;;;;;;;;;;;;;;2337:239;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2031:300;;;;;;;;;;;;;;307:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1051:256;;;;;;;;;;;;;;;;;;;;;;;;;;;;724:319;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;832:169:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;1939:86:1;1973:4;2017:1;1997:17;:15;:17::i;:::-;:21;1990:28;;1939:86;:::o;2582:219::-;2624:11;2647:12;2662:9;:13;2672:2;2662:13;;;;;;;;;;;;;;;2647:28;;2704:3;2689:8;:11;;;;;;;;;;;;:18;;;2685:110;;;2729:1;2721:10;;;;2685:110;2768:8;:15;;;2760:24;;2582:219;;;;;:::o;1838:95::-;1874:4;1897:29;1914:11;;1897:4;:12;;;:16;;:29;;;;:::i;:::-;1890:36;;1838:95;:::o;1313:428::-;1416:12;1550:14;653:5:0;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;1394:10:1;411:12;426:9;:21;436:10;426:21;;;;;;;;;;;;;;;411:36;;478:3;463:8;:11;;;;;;;;;;;;:18;;;;456:26;;;;;;1431:9;:21;1441:10;1431:21;;;;;;;;;;;;;;;1416:36;;1462:22;1475:8;1462:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:12;:22::i;:::-;1508:32;1524:8;:15;;;1508:11;;:15;;:32;;;;:::i;:::-;1494:11;:46;;;;1567:19;1578:7;1567:6;:10;;:19;;;;:::i;:::-;1550:36;;1610:26;1626:9;1610:11;;:15;;:26;;;;:::i;:::-;1596:11;:40;;;;1677:9;1646;:21;1656:10;1646:21;;;;;;;;;;;;;;;:28;;:40;;;;1731:3;1696:9;:21;1706:10;1696:21;;;;;;;;;;;;;;;:32;;:38;;;;665:1:0;;1313:428:1;;;;:::o;238:20:0:-;;;;;;;;;;;;;:::o;1747:85:1:-;1790:4;1813;:12;;;1806:19;;1747:85;:::o;2337:239::-;2460:12;653:5:0;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;2438:10:1;411:12;426:9;:21;436:10;426:21;;;;;;;;;;;;;;;411:36;;478:3;463:8;:11;;;;;;;;;;;;:18;;;;456:26;;;;;;2475:9;:21;2485:10;2475:21;;;;;;;;;;;;;;;2460:36;;2506:22;2519:8;2506:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:12;:22::i;:::-;2552:17;2538:8;:11;;;:31;;;;;;;;;;;;;;;;;;665:1:0;;2337:239:1;;;:::o;2031:300::-;2086:12;2133:15;2064:10;411:12;426:9;:21;436:10;426:21;;;;;;;;;;;;;;;411:36;;478:3;463:8;:11;;;;;;;;;;;;:18;;;;456:26;;;;;;2101:9;:21;2111:10;2101:21;;;;;;;;;;;;;;;2086:36;;2151;263:11;2151:8;:19;;;:23;;:36;;;;:::i;:::-;2133:54;;2217:3;2204:10;:16;2197:24;;;;;;2266:10;2231:9;:21;2241:10;2231:21;;;;;;;;;;;;;;;:32;;:45;;;;2286:8;:11;;;;;;;;;;;;:20;;:37;2307:8;:15;;;2286:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2031:300;;;;:::o;307:45::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1051:256::-;1140:12;653:5:0;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;1119:10:1;411:12;426:9;:21;436:10;426:21;;;;;;;;;;;;;;;411:36;;478:3;463:8;:11;;;;;;;;;;;;:18;;;;456:26;;;;;;1155:9;:21;1165:10;1155:21;;;;;;;;;;;;;;;1140:36;;1186:22;1199:8;1186:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:12;:22::i;:::-;1231:32;1247:8;:15;;;1231:11;;:15;;:32;;;;:::i;:::-;1217:11;:46;;;;1279:9;:21;1289:10;1279:21;;;;;;;;;;;;;;;;1272:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;665:1:0;;1051:256:1;;:::o;724:319::-;798:12;880:14;653:5:0;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;813:9:1;:21;823:10;813:21;;;;;;;;;;;;;;;798:36;;866:3;851:8;:11;;;;;;;;;;;;:18;;;844:26;;;;;;897:19;908:7;897:6;:10;;:19;;;;:::i;:::-;880:36;;950;;;;;;;;;959:10;950:36;;;;;;971:9;950:36;;;;982:3;950:36;;;926:9;:21;936:10;926:21;;;;;;;;;;;;;;;:60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1010:26;1026:9;1010:11;;:15;;:26;;;;:::i;:::-;996:11;:40;;;;724:319;;;;:::o;832:169:0:-;653:5;;;;;;;;;;;639:19;;:10;:19;;;631:28;;;;;;;;928:1;908:22;;:8;:22;;;;900:31;;;;;;;;965:8;937:37;;958:5;;;;;;;;;;;937:37;;;;;;;;;;;;988:8;980:5;;:16;;;;;;;;;;;;;;;;;;832:169;:::o;458:265:2:-;516:7;605:9;621:1;617;:5;;;;;;;;605:17;;717:1;710:8;;458:265;;;;;:::o;505:212:1:-;564:12;579:92;263:11;579:62;612:28;620:8;:19;;;612:3;:7;;:28;;;;:::i;:::-;579:8;:15;;;:32;;:62;;;;:::i;:::-;:79;;:92;;;;:::i;:::-;564:107;;681:8;:11;;;:20;;:29;702:7;681:29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;505:212;;:::o;836:110:2:-;894:7;921:1;916;:6;;909:14;;;;;;940:1;936;:5;929:12;;836:110;;;;:::o;203:173::-;261:7;316:9;285:1;280;:6;276:35;;;303:1;296:8;;;;276:35;332:1;328;:5;316:17;;355:1;350;346;:5;;;;;;;;:10;339:18;;;;;;370:1;363:8;;203:173;;;;;;:::o;1008:129::-;1066:7;1081:9;1097:1;1093;:5;1081:17;;1116:1;1111;:6;;1104:14;;;;;;1131:1;1124:8;;1008:129;;;;;:::o",
+ "source": "pragma solidity ^0.4.14;\n\nimport './SafeMath.sol';\nimport './Ownable.sol';\n\n\ncontract Payroll is Ownable {\n using SafeMath for uint;\n struct Employee {\n address id;\n uint salary;\n uint lastPayday;\n }\n\n uint constant payDuration = 100 seconds;\n\n uint totalSalary = 0;\n mapping(address => Employee) public employees;\n\n modifier employeeExist(address employeeId) {\n var employee = employees[employeeId];\n assert(employee.id != 0x0);\n _;\n }\n\n function _partialPaid(Employee employee) private {\n uint payment = employee.salary\n .mul(now.sub(employee.lastPayday))\n .div(payDuration);\n employee.id.transfer(payment);\n }\n\n\n function addEmployee(address employeeId, uint salary) onlyOwner {\n var employee = employees[employeeId];\n assert(employee.id == 0x0);\n uint newSalary = salary.mul(1 ether);\n employees[employeeId] = Employee(employeeId, newSalary, now);\n totalSalary = totalSalary.add(newSalary);\n }\n\n\n\n function removeEmployee(address employeeId) onlyOwner employeeExist(employeeId) {\n var employee = employees[employeeId];\n\n _partialPaid(employee);\n totalSalary = totalSalary.sub(employee.salary);\n delete employees[employeeId];\n }\n\n function updateEmployee(address employeeId, uint salary) onlyOwner employeeExist(employeeId) {\n var employee = employees[employeeId];\n _partialPaid(employee);\n totalSalary = totalSalary.sub(employee.salary);\n uint newSalary = salary.mul(1 ether);\n totalSalary = totalSalary.add(newSalary);\n employees[employeeId].salary = newSalary;\n employees[employeeId].lastPayday = now;\n }\n\n function addFund() payable public returns (uint) {\n return this.balance;\n }\n\n function calculateRunway() returns (uint) {\n return this.balance.div(totalSalary);\n }\n\n function hasEnoughFund() returns (bool) {\n return calculateRunway() > 0;\n }\n\n function getPaid() employeeExist(msg.sender) {\n var employee = employees[msg.sender];\n\n uint nextPayday = employee.lastPayday.sub(payDuration);\n assert(nextPayday < now);\n employees[msg.sender].lastPayday = nextPayday;\n employee.id.transfer(employee.salary);\n\n }\n\n function changePaymentAddress(address employeeId, address newPaymentAddress) onlyOwner employeeExist(msg.sender) {\n var employee = employees[employeeId];\n _partialPaid(employee);\n employee.id = newPaymentAddress;\n }\n\n function getEmployee(address id) returns (uint salary) {\n var employee = employees[id];\n if (employee.id == 0x0) {\n return (0);\n } else {\n return (employee.salary);\n }\n }\n\n\n}",
+ "sourcePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/Payroll.sol",
+ "ast": {
+ "attributes": {
+ "absolutePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/Payroll.sol",
+ "exportedSymbols": {
+ "Payroll": [
+ 399
+ ]
+ }
+ },
+ "children": [
+ {
+ "attributes": {
+ "literals": [
+ "solidity",
+ "^",
+ "0.4",
+ ".14"
+ ]
+ },
+ "id": 57,
+ "name": "PragmaDirective",
+ "src": "0:24:1"
+ },
+ {
+ "attributes": {
+ "SourceUnit": 498,
+ "absolutePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/SafeMath.sol",
+ "file": "./SafeMath.sol",
+ "scope": 400,
+ "symbolAliases": [
+ null
+ ],
+ "unitAlias": ""
+ },
+ "id": 58,
+ "name": "ImportDirective",
+ "src": "26:24:1"
+ },
+ {
+ "attributes": {
+ "SourceUnit": 56,
+ "absolutePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/Ownable.sol",
+ "file": "./Ownable.sol",
+ "scope": 400,
+ "symbolAliases": [
+ null
+ ],
+ "unitAlias": ""
+ },
+ "id": 59,
+ "name": "ImportDirective",
+ "src": "51:23:1"
+ },
+ {
+ "attributes": {
+ "contractDependencies": [
+ 55
+ ],
+ "contractKind": "contract",
+ "documentation": null,
+ "fullyImplemented": true,
+ "linearizedBaseContracts": [
+ 399,
+ 55
+ ],
+ "name": "Payroll",
+ "scope": 400
+ },
+ "children": [
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "Ownable",
+ "referencedDeclaration": 55,
+ "type": "contract Ownable"
+ },
+ "id": 60,
+ "name": "UserDefinedTypeName",
+ "src": "97:7:1"
+ }
+ ],
+ "id": 61,
+ "name": "InheritanceSpecifier",
+ "src": "97:7:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "SafeMath",
+ "referencedDeclaration": 497,
+ "type": "library SafeMath"
+ },
+ "id": 62,
+ "name": "UserDefinedTypeName",
+ "src": "117:8:1"
+ },
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 63,
+ "name": "ElementaryTypeName",
+ "src": "130:4:1"
+ }
+ ],
+ "id": 64,
+ "name": "UsingForDirective",
+ "src": "111:24:1"
+ },
+ {
+ "attributes": {
+ "canonicalName": "Payroll.Employee",
+ "name": "Employee",
+ "scope": 399,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "id",
+ "scope": 71,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 65,
+ "name": "ElementaryTypeName",
+ "src": "166:7:1"
+ }
+ ],
+ "id": 66,
+ "name": "VariableDeclaration",
+ "src": "166:10:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "salary",
+ "scope": 71,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 67,
+ "name": "ElementaryTypeName",
+ "src": "186:4:1"
+ }
+ ],
+ "id": 68,
+ "name": "VariableDeclaration",
+ "src": "186:11:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "lastPayday",
+ "scope": 71,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 69,
+ "name": "ElementaryTypeName",
+ "src": "207:4:1"
+ }
+ ],
+ "id": 70,
+ "name": "VariableDeclaration",
+ "src": "207:15:1"
+ }
+ ],
+ "id": 71,
+ "name": "StructDefinition",
+ "src": "140:89:1"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "name": "payDuration",
+ "scope": 399,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "uint256",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 72,
+ "name": "ElementaryTypeName",
+ "src": "235:4:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "313030",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": "seconds",
+ "token": "number",
+ "type": "int_const 100",
+ "value": "100"
+ },
+ "id": 73,
+ "name": "Literal",
+ "src": "263:11:1"
+ }
+ ],
+ "id": 74,
+ "name": "VariableDeclaration",
+ "src": "235:39:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "totalSalary",
+ "scope": 399,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "uint256",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 75,
+ "name": "ElementaryTypeName",
+ "src": "281:4:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 76,
+ "name": "Literal",
+ "src": "300:1:1"
+ }
+ ],
+ "id": 77,
+ "name": "VariableDeclaration",
+ "src": "281:20:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employees",
+ "scope": 399,
+ "stateVariable": true,
+ "storageLocation": "default",
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "type": "mapping(address => struct Payroll.Employee storage ref)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 78,
+ "name": "ElementaryTypeName",
+ "src": "315:7:1"
+ },
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "Employee",
+ "referencedDeclaration": 71,
+ "type": "struct Payroll.Employee storage pointer"
+ },
+ "id": 79,
+ "name": "UserDefinedTypeName",
+ "src": "326:8:1"
+ }
+ ],
+ "id": 80,
+ "name": "Mapping",
+ "src": "307:28:1"
+ }
+ ],
+ "id": 81,
+ "name": "VariableDeclaration",
+ "src": "307:45:1"
+ },
+ {
+ "attributes": {
+ "name": "employeeExist",
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employeeId",
+ "scope": 99,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 82,
+ "name": "ElementaryTypeName",
+ "src": "382:7:1"
+ }
+ ],
+ "id": 83,
+ "name": "VariableDeclaration",
+ "src": "382:18:1"
+ }
+ ],
+ "id": 84,
+ "name": "ParameterList",
+ "src": "381:20:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 85
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 99,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 85,
+ "name": "VariableDeclaration",
+ "src": "411:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 86,
+ "name": "Identifier",
+ "src": "426:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 83,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 87,
+ "name": "Identifier",
+ "src": "436:10:1"
+ }
+ ],
+ "id": 88,
+ "name": "IndexAccess",
+ "src": "426:21:1"
+ }
+ ],
+ "id": 89,
+ "name": "VariableDeclarationStatement",
+ "src": "411:36:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 500,
+ "type": "function (bool) pure",
+ "value": "assert"
+ },
+ "id": 90,
+ "name": "Identifier",
+ "src": "456:6:1"
+ },
+ {
+ "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": 66,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 85,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 91,
+ "name": "Identifier",
+ "src": "463:8:1"
+ }
+ ],
+ "id": 92,
+ "name": "MemberAccess",
+ "src": "463:11:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "307830",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0x0"
+ },
+ "id": 93,
+ "name": "Literal",
+ "src": "478:3:1"
+ }
+ ],
+ "id": 94,
+ "name": "BinaryOperation",
+ "src": "463:18:1"
+ }
+ ],
+ "id": 95,
+ "name": "FunctionCall",
+ "src": "456:26:1"
+ }
+ ],
+ "id": 96,
+ "name": "ExpressionStatement",
+ "src": "456:26:1"
+ },
+ {
+ "id": 97,
+ "name": "PlaceholderStatement",
+ "src": "491:1:1"
+ }
+ ],
+ "id": 98,
+ "name": "Block",
+ "src": "402:97:1"
+ }
+ ],
+ "id": 99,
+ "name": "ModifierDefinition",
+ "src": "359:140:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "_partialPaid",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "private"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 128,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee memory",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "contractScope": null,
+ "name": "Employee",
+ "referencedDeclaration": 71,
+ "type": "struct Payroll.Employee storage pointer"
+ },
+ "id": 100,
+ "name": "UserDefinedTypeName",
+ "src": "527:8:1"
+ }
+ ],
+ "id": 101,
+ "name": "VariableDeclaration",
+ "src": "527:17:1"
+ }
+ ],
+ "id": 102,
+ "name": "ParameterList",
+ "src": "526:19:1"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 103,
+ "name": "ParameterList",
+ "src": "554:0:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 105
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "payment",
+ "scope": 128,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 104,
+ "name": "ElementaryTypeName",
+ "src": "564:4:1"
+ }
+ ],
+ "id": 105,
+ "name": "VariableDeclaration",
+ "src": "564:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "div",
+ "referencedDeclaration": 452,
+ "type": "function (uint256,uint256) pure returns (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": "mul",
+ "referencedDeclaration": 434,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 68,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 101,
+ "type": "struct Payroll.Employee memory",
+ "value": "employee"
+ },
+ "id": 106,
+ "name": "Identifier",
+ "src": "579:8:1"
+ }
+ ],
+ "id": 107,
+ "name": "MemberAccess",
+ "src": "579:15:1"
+ }
+ ],
+ "id": 108,
+ "name": "MemberAccess",
+ "src": "579:32:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sub",
+ "referencedDeclaration": 472,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 511,
+ "type": "uint256",
+ "value": "now"
+ },
+ "id": 109,
+ "name": "Identifier",
+ "src": "612:3:1"
+ }
+ ],
+ "id": 110,
+ "name": "MemberAccess",
+ "src": "612:7:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "lastPayday",
+ "referencedDeclaration": 70,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 101,
+ "type": "struct Payroll.Employee memory",
+ "value": "employee"
+ },
+ "id": 111,
+ "name": "Identifier",
+ "src": "620:8:1"
+ }
+ ],
+ "id": 112,
+ "name": "MemberAccess",
+ "src": "620:19:1"
+ }
+ ],
+ "id": 113,
+ "name": "FunctionCall",
+ "src": "612:28:1"
+ }
+ ],
+ "id": 114,
+ "name": "FunctionCall",
+ "src": "579:62:1"
+ }
+ ],
+ "id": 115,
+ "name": "MemberAccess",
+ "src": "579:79:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 74,
+ "type": "uint256",
+ "value": "payDuration"
+ },
+ "id": 116,
+ "name": "Identifier",
+ "src": "659:11:1"
+ }
+ ],
+ "id": 117,
+ "name": "FunctionCall",
+ "src": "579:92:1"
+ }
+ ],
+ "id": 118,
+ "name": "VariableDeclarationStatement",
+ "src": "564:107:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_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": 66,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 101,
+ "type": "struct Payroll.Employee memory",
+ "value": "employee"
+ },
+ "id": 119,
+ "name": "Identifier",
+ "src": "681:8:1"
+ }
+ ],
+ "id": 122,
+ "name": "MemberAccess",
+ "src": "681:11:1"
+ }
+ ],
+ "id": 123,
+ "name": "MemberAccess",
+ "src": "681:20:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 105,
+ "type": "uint256",
+ "value": "payment"
+ },
+ "id": 124,
+ "name": "Identifier",
+ "src": "702:7:1"
+ }
+ ],
+ "id": 125,
+ "name": "FunctionCall",
+ "src": "681:29:1"
+ }
+ ],
+ "id": 126,
+ "name": "ExpressionStatement",
+ "src": "681:29:1"
+ }
+ ],
+ "id": 127,
+ "name": "Block",
+ "src": "554:163:1"
+ }
+ ],
+ "id": 128,
+ "name": "FunctionDefinition",
+ "src": "505:212:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "addEmployee",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employeeId",
+ "scope": 174,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 129,
+ "name": "ElementaryTypeName",
+ "src": "745:7:1"
+ }
+ ],
+ "id": 130,
+ "name": "VariableDeclaration",
+ "src": "745:18:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "salary",
+ "scope": 174,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 131,
+ "name": "ElementaryTypeName",
+ "src": "765:4:1"
+ }
+ ],
+ "id": 132,
+ "name": "VariableDeclaration",
+ "src": "765:11:1"
+ }
+ ],
+ "id": 133,
+ "name": "ParameterList",
+ "src": "744:33:1"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 136,
+ "name": "ParameterList",
+ "src": "788:0:1"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 29,
+ "type": "modifier ()",
+ "value": "onlyOwner"
+ },
+ "id": 134,
+ "name": "Identifier",
+ "src": "778:9:1"
+ }
+ ],
+ "id": 135,
+ "name": "ModifierInvocation",
+ "src": "778:9:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 137
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 174,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 137,
+ "name": "VariableDeclaration",
+ "src": "798:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 138,
+ "name": "Identifier",
+ "src": "813:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 130,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 139,
+ "name": "Identifier",
+ "src": "823:10:1"
+ }
+ ],
+ "id": 140,
+ "name": "IndexAccess",
+ "src": "813:21:1"
+ }
+ ],
+ "id": 141,
+ "name": "VariableDeclarationStatement",
+ "src": "798:36:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 500,
+ "type": "function (bool) pure",
+ "value": "assert"
+ },
+ "id": 142,
+ "name": "Identifier",
+ "src": "844:6:1"
+ },
+ {
+ "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": 66,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 137,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 143,
+ "name": "Identifier",
+ "src": "851:8:1"
+ }
+ ],
+ "id": 144,
+ "name": "MemberAccess",
+ "src": "851:11:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "307830",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0x0"
+ },
+ "id": 145,
+ "name": "Literal",
+ "src": "866:3:1"
+ }
+ ],
+ "id": 146,
+ "name": "BinaryOperation",
+ "src": "851:18:1"
+ }
+ ],
+ "id": 147,
+ "name": "FunctionCall",
+ "src": "844:26:1"
+ }
+ ],
+ "id": 148,
+ "name": "ExpressionStatement",
+ "src": "844:26:1"
+ },
+ {
+ "attributes": {
+ "assignments": [
+ 150
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "newSalary",
+ "scope": 174,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 149,
+ "name": "ElementaryTypeName",
+ "src": "880:4:1"
+ }
+ ],
+ "id": 150,
+ "name": "VariableDeclaration",
+ "src": "880:14:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_rational_1000000000000000000_by_1",
+ "typeString": "int_const 1000000000000000000"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "mul",
+ "referencedDeclaration": 434,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 132,
+ "type": "uint256",
+ "value": "salary"
+ },
+ "id": 151,
+ "name": "Identifier",
+ "src": "897:6:1"
+ }
+ ],
+ "id": 152,
+ "name": "MemberAccess",
+ "src": "897:10:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "31",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": "ether",
+ "token": "number",
+ "type": "int_const 1000000000000000000",
+ "value": "1"
+ },
+ "id": 153,
+ "name": "Literal",
+ "src": "908:7:1"
+ }
+ ],
+ "id": 154,
+ "name": "FunctionCall",
+ "src": "897:19:1"
+ }
+ ],
+ "id": 155,
+ "name": "VariableDeclarationStatement",
+ "src": "880:36:1"
+ },
+ {
+ "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": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 156,
+ "name": "Identifier",
+ "src": "926:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 130,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 157,
+ "name": "Identifier",
+ "src": "936:10:1"
+ }
+ ],
+ "id": 158,
+ "name": "IndexAccess",
+ "src": "926:21:1"
+ },
+ {
+ "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": 71,
+ "type": "type(struct Payroll.Employee storage pointer)",
+ "value": "Employee"
+ },
+ "id": 159,
+ "name": "Identifier",
+ "src": "950:8:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 130,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 160,
+ "name": "Identifier",
+ "src": "959:10:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 150,
+ "type": "uint256",
+ "value": "newSalary"
+ },
+ "id": 161,
+ "name": "Identifier",
+ "src": "971:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 511,
+ "type": "uint256",
+ "value": "now"
+ },
+ "id": 162,
+ "name": "Identifier",
+ "src": "982:3:1"
+ }
+ ],
+ "id": 163,
+ "name": "FunctionCall",
+ "src": "950:36:1"
+ }
+ ],
+ "id": 164,
+ "name": "Assignment",
+ "src": "926:60:1"
+ }
+ ],
+ "id": 165,
+ "name": "ExpressionStatement",
+ "src": "926:60:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 166,
+ "name": "Identifier",
+ "src": "996:11:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "add",
+ "referencedDeclaration": 496,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 167,
+ "name": "Identifier",
+ "src": "1010:11:1"
+ }
+ ],
+ "id": 168,
+ "name": "MemberAccess",
+ "src": "1010:15:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 150,
+ "type": "uint256",
+ "value": "newSalary"
+ },
+ "id": 169,
+ "name": "Identifier",
+ "src": "1026:9:1"
+ }
+ ],
+ "id": 170,
+ "name": "FunctionCall",
+ "src": "1010:26:1"
+ }
+ ],
+ "id": 171,
+ "name": "Assignment",
+ "src": "996:40:1"
+ }
+ ],
+ "id": 172,
+ "name": "ExpressionStatement",
+ "src": "996:40:1"
+ }
+ ],
+ "id": 173,
+ "name": "Block",
+ "src": "788:255:1"
+ }
+ ],
+ "id": 174,
+ "name": "FunctionDefinition",
+ "src": "724:319:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "removeEmployee",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employeeId",
+ "scope": 207,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 175,
+ "name": "ElementaryTypeName",
+ "src": "1075:7:1"
+ }
+ ],
+ "id": 176,
+ "name": "VariableDeclaration",
+ "src": "1075:18:1"
+ }
+ ],
+ "id": 177,
+ "name": "ParameterList",
+ "src": "1074:20:1"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 183,
+ "name": "ParameterList",
+ "src": "1131:0:1"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 29,
+ "type": "modifier ()",
+ "value": "onlyOwner"
+ },
+ "id": 178,
+ "name": "Identifier",
+ "src": "1095:9:1"
+ }
+ ],
+ "id": 179,
+ "name": "ModifierInvocation",
+ "src": "1095:9:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 99,
+ "type": "modifier (address)",
+ "value": "employeeExist"
+ },
+ "id": 180,
+ "name": "Identifier",
+ "src": "1105:13:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 176,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 181,
+ "name": "Identifier",
+ "src": "1119:10:1"
+ }
+ ],
+ "id": 182,
+ "name": "ModifierInvocation",
+ "src": "1105:25:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 184
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 207,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 184,
+ "name": "VariableDeclaration",
+ "src": "1140:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 185,
+ "name": "Identifier",
+ "src": "1155:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 176,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 186,
+ "name": "Identifier",
+ "src": "1165:10:1"
+ }
+ ],
+ "id": 187,
+ "name": "IndexAccess",
+ "src": "1155:21:1"
+ }
+ ],
+ "id": 188,
+ "name": "VariableDeclarationStatement",
+ "src": "1140:36:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_struct$_Employee_$71_storage_ptr",
+ "typeString": "struct Payroll.Employee storage pointer"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 128,
+ "type": "function (struct Payroll.Employee memory)",
+ "value": "_partialPaid"
+ },
+ "id": 189,
+ "name": "Identifier",
+ "src": "1186:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 184,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 190,
+ "name": "Identifier",
+ "src": "1199:8:1"
+ }
+ ],
+ "id": 191,
+ "name": "FunctionCall",
+ "src": "1186:22:1"
+ }
+ ],
+ "id": 192,
+ "name": "ExpressionStatement",
+ "src": "1186:22:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 193,
+ "name": "Identifier",
+ "src": "1217:11:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sub",
+ "referencedDeclaration": 472,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 194,
+ "name": "Identifier",
+ "src": "1231:11:1"
+ }
+ ],
+ "id": 195,
+ "name": "MemberAccess",
+ "src": "1231:15:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 68,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 184,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 196,
+ "name": "Identifier",
+ "src": "1247:8:1"
+ }
+ ],
+ "id": 197,
+ "name": "MemberAccess",
+ "src": "1247:15:1"
+ }
+ ],
+ "id": 198,
+ "name": "FunctionCall",
+ "src": "1231:32:1"
+ }
+ ],
+ "id": 199,
+ "name": "Assignment",
+ "src": "1217:46:1"
+ }
+ ],
+ "id": 200,
+ "name": "ExpressionStatement",
+ "src": "1217:46:1"
+ },
+ {
+ "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": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 201,
+ "name": "Identifier",
+ "src": "1279:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 176,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 202,
+ "name": "Identifier",
+ "src": "1289:10:1"
+ }
+ ],
+ "id": 203,
+ "name": "IndexAccess",
+ "src": "1279:21:1"
+ }
+ ],
+ "id": 204,
+ "name": "UnaryOperation",
+ "src": "1272:28:1"
+ }
+ ],
+ "id": 205,
+ "name": "ExpressionStatement",
+ "src": "1272:28:1"
+ }
+ ],
+ "id": 206,
+ "name": "Block",
+ "src": "1131:176:1"
+ }
+ ],
+ "id": 207,
+ "name": "FunctionDefinition",
+ "src": "1051:256:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "updateEmployee",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employeeId",
+ "scope": 265,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 208,
+ "name": "ElementaryTypeName",
+ "src": "1337:7:1"
+ }
+ ],
+ "id": 209,
+ "name": "VariableDeclaration",
+ "src": "1337:18:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "salary",
+ "scope": 265,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 210,
+ "name": "ElementaryTypeName",
+ "src": "1357:4:1"
+ }
+ ],
+ "id": 211,
+ "name": "VariableDeclaration",
+ "src": "1357:11:1"
+ }
+ ],
+ "id": 212,
+ "name": "ParameterList",
+ "src": "1336:33:1"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 218,
+ "name": "ParameterList",
+ "src": "1406:0:1"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 29,
+ "type": "modifier ()",
+ "value": "onlyOwner"
+ },
+ "id": 213,
+ "name": "Identifier",
+ "src": "1370:9:1"
+ }
+ ],
+ "id": 214,
+ "name": "ModifierInvocation",
+ "src": "1370:9:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 99,
+ "type": "modifier (address)",
+ "value": "employeeExist"
+ },
+ "id": 215,
+ "name": "Identifier",
+ "src": "1380:13:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 209,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 216,
+ "name": "Identifier",
+ "src": "1394:10:1"
+ }
+ ],
+ "id": 217,
+ "name": "ModifierInvocation",
+ "src": "1380:25:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 219
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 265,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 219,
+ "name": "VariableDeclaration",
+ "src": "1416:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 220,
+ "name": "Identifier",
+ "src": "1431:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 209,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 221,
+ "name": "Identifier",
+ "src": "1441:10:1"
+ }
+ ],
+ "id": 222,
+ "name": "IndexAccess",
+ "src": "1431:21:1"
+ }
+ ],
+ "id": 223,
+ "name": "VariableDeclarationStatement",
+ "src": "1416:36:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_struct$_Employee_$71_storage_ptr",
+ "typeString": "struct Payroll.Employee storage pointer"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 128,
+ "type": "function (struct Payroll.Employee memory)",
+ "value": "_partialPaid"
+ },
+ "id": 224,
+ "name": "Identifier",
+ "src": "1462:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 219,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 225,
+ "name": "Identifier",
+ "src": "1475:8:1"
+ }
+ ],
+ "id": 226,
+ "name": "FunctionCall",
+ "src": "1462:22:1"
+ }
+ ],
+ "id": 227,
+ "name": "ExpressionStatement",
+ "src": "1462:22:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 228,
+ "name": "Identifier",
+ "src": "1494:11:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sub",
+ "referencedDeclaration": 472,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 229,
+ "name": "Identifier",
+ "src": "1508:11:1"
+ }
+ ],
+ "id": 230,
+ "name": "MemberAccess",
+ "src": "1508:15:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 68,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 219,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 231,
+ "name": "Identifier",
+ "src": "1524:8:1"
+ }
+ ],
+ "id": 232,
+ "name": "MemberAccess",
+ "src": "1524:15:1"
+ }
+ ],
+ "id": 233,
+ "name": "FunctionCall",
+ "src": "1508:32:1"
+ }
+ ],
+ "id": 234,
+ "name": "Assignment",
+ "src": "1494:46:1"
+ }
+ ],
+ "id": 235,
+ "name": "ExpressionStatement",
+ "src": "1494:46:1"
+ },
+ {
+ "attributes": {
+ "assignments": [
+ 237
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "newSalary",
+ "scope": 265,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 236,
+ "name": "ElementaryTypeName",
+ "src": "1550:4:1"
+ }
+ ],
+ "id": 237,
+ "name": "VariableDeclaration",
+ "src": "1550:14:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_rational_1000000000000000000_by_1",
+ "typeString": "int_const 1000000000000000000"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "mul",
+ "referencedDeclaration": 434,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 211,
+ "type": "uint256",
+ "value": "salary"
+ },
+ "id": 238,
+ "name": "Identifier",
+ "src": "1567:6:1"
+ }
+ ],
+ "id": 239,
+ "name": "MemberAccess",
+ "src": "1567:10:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "31",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": "ether",
+ "token": "number",
+ "type": "int_const 1000000000000000000",
+ "value": "1"
+ },
+ "id": 240,
+ "name": "Literal",
+ "src": "1578:7:1"
+ }
+ ],
+ "id": 241,
+ "name": "FunctionCall",
+ "src": "1567:19:1"
+ }
+ ],
+ "id": 242,
+ "name": "VariableDeclarationStatement",
+ "src": "1550:36:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 243,
+ "name": "Identifier",
+ "src": "1596:11:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "add",
+ "referencedDeclaration": 496,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 244,
+ "name": "Identifier",
+ "src": "1610:11:1"
+ }
+ ],
+ "id": 245,
+ "name": "MemberAccess",
+ "src": "1610:15:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 237,
+ "type": "uint256",
+ "value": "newSalary"
+ },
+ "id": 246,
+ "name": "Identifier",
+ "src": "1626:9:1"
+ }
+ ],
+ "id": 247,
+ "name": "FunctionCall",
+ "src": "1610:26:1"
+ }
+ ],
+ "id": 248,
+ "name": "Assignment",
+ "src": "1596:40:1"
+ }
+ ],
+ "id": 249,
+ "name": "ExpressionStatement",
+ "src": "1596:40:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "member_name": "salary",
+ "referencedDeclaration": 68,
+ "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": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 250,
+ "name": "Identifier",
+ "src": "1646:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 209,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 251,
+ "name": "Identifier",
+ "src": "1656:10:1"
+ }
+ ],
+ "id": 252,
+ "name": "IndexAccess",
+ "src": "1646:21:1"
+ }
+ ],
+ "id": 253,
+ "name": "MemberAccess",
+ "src": "1646:28:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 237,
+ "type": "uint256",
+ "value": "newSalary"
+ },
+ "id": 254,
+ "name": "Identifier",
+ "src": "1677:9:1"
+ }
+ ],
+ "id": 255,
+ "name": "Assignment",
+ "src": "1646:40:1"
+ }
+ ],
+ "id": 256,
+ "name": "ExpressionStatement",
+ "src": "1646:40:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "member_name": "lastPayday",
+ "referencedDeclaration": 70,
+ "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": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 257,
+ "name": "Identifier",
+ "src": "1696:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 209,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 258,
+ "name": "Identifier",
+ "src": "1706:10:1"
+ }
+ ],
+ "id": 259,
+ "name": "IndexAccess",
+ "src": "1696:21:1"
+ }
+ ],
+ "id": 260,
+ "name": "MemberAccess",
+ "src": "1696:32:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 511,
+ "type": "uint256",
+ "value": "now"
+ },
+ "id": 261,
+ "name": "Identifier",
+ "src": "1731:3:1"
+ }
+ ],
+ "id": 262,
+ "name": "Assignment",
+ "src": "1696:38:1"
+ }
+ ],
+ "id": 263,
+ "name": "ExpressionStatement",
+ "src": "1696:38:1"
+ }
+ ],
+ "id": 264,
+ "name": "Block",
+ "src": "1406:335:1"
+ }
+ ],
+ "id": 265,
+ "name": "FunctionDefinition",
+ "src": "1313:428:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "addFund",
+ "payable": true,
+ "scope": 399,
+ "stateMutability": "payable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 266,
+ "name": "ParameterList",
+ "src": "1763:2:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 274,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 267,
+ "name": "ElementaryTypeName",
+ "src": "1790:4:1"
+ }
+ ],
+ "id": 268,
+ "name": "VariableDeclaration",
+ "src": "1790:4:1"
+ }
+ ],
+ "id": 269,
+ "name": "ParameterList",
+ "src": "1789:6:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 269
+ },
+ "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": 524,
+ "type": "contract Payroll",
+ "value": "this"
+ },
+ "id": 270,
+ "name": "Identifier",
+ "src": "1813:4:1"
+ }
+ ],
+ "id": 271,
+ "name": "MemberAccess",
+ "src": "1813:12:1"
+ }
+ ],
+ "id": 272,
+ "name": "Return",
+ "src": "1806:19:1"
+ }
+ ],
+ "id": 273,
+ "name": "Block",
+ "src": "1796:36:1"
+ }
+ ],
+ "id": 274,
+ "name": "FunctionDefinition",
+ "src": "1747:85:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "calculateRunway",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 275,
+ "name": "ParameterList",
+ "src": "1862:2:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 286,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 276,
+ "name": "ElementaryTypeName",
+ "src": "1874:4:1"
+ }
+ ],
+ "id": 277,
+ "name": "VariableDeclaration",
+ "src": "1874:4:1"
+ }
+ ],
+ "id": 278,
+ "name": "ParameterList",
+ "src": "1873:6:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 278
+ },
+ "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": "div",
+ "referencedDeclaration": 452,
+ "type": "function (uint256,uint256) pure returns (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": 524,
+ "type": "contract Payroll",
+ "value": "this"
+ },
+ "id": 279,
+ "name": "Identifier",
+ "src": "1897:4:1"
+ }
+ ],
+ "id": 280,
+ "name": "MemberAccess",
+ "src": "1897:12:1"
+ }
+ ],
+ "id": 281,
+ "name": "MemberAccess",
+ "src": "1897:16:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 77,
+ "type": "uint256",
+ "value": "totalSalary"
+ },
+ "id": 282,
+ "name": "Identifier",
+ "src": "1914:11:1"
+ }
+ ],
+ "id": 283,
+ "name": "FunctionCall",
+ "src": "1897:29:1"
+ }
+ ],
+ "id": 284,
+ "name": "Return",
+ "src": "1890:36:1"
+ }
+ ],
+ "id": 285,
+ "name": "Block",
+ "src": "1880:53:1"
+ }
+ ],
+ "id": 286,
+ "name": "FunctionDefinition",
+ "src": "1838:95:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "hasEnoughFund",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 287,
+ "name": "ParameterList",
+ "src": "1961:2:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 297,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "bool",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "bool",
+ "type": "bool"
+ },
+ "id": 288,
+ "name": "ElementaryTypeName",
+ "src": "1973:4:1"
+ }
+ ],
+ "id": 289,
+ "name": "VariableDeclaration",
+ "src": "1973:4:1"
+ }
+ ],
+ "id": 290,
+ "name": "ParameterList",
+ "src": "1972:6:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 290
+ },
+ "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,
+ "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": 286,
+ "type": "function () returns (uint256)",
+ "value": "calculateRunway"
+ },
+ "id": 291,
+ "name": "Identifier",
+ "src": "1997:15:1"
+ }
+ ],
+ "id": 292,
+ "name": "FunctionCall",
+ "src": "1997:17:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 293,
+ "name": "Literal",
+ "src": "2017:1:1"
+ }
+ ],
+ "id": 294,
+ "name": "BinaryOperation",
+ "src": "1997:21:1"
+ }
+ ],
+ "id": 295,
+ "name": "Return",
+ "src": "1990:28:1"
+ }
+ ],
+ "id": 296,
+ "name": "Block",
+ "src": "1979:46:1"
+ }
+ ],
+ "id": 297,
+ "name": "FunctionDefinition",
+ "src": "1939:86:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "getPaid",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 298,
+ "name": "ParameterList",
+ "src": "2047:2:1"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 303,
+ "name": "ParameterList",
+ "src": "2076:0:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 99,
+ "type": "modifier (address)",
+ "value": "employeeExist"
+ },
+ "id": 299,
+ "name": "Identifier",
+ "src": "2050:13:1"
+ },
+ {
+ "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": 509,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 300,
+ "name": "Identifier",
+ "src": "2064:3:1"
+ }
+ ],
+ "id": 301,
+ "name": "MemberAccess",
+ "src": "2064:10:1"
+ }
+ ],
+ "id": 302,
+ "name": "ModifierInvocation",
+ "src": "2050:25:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 304
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 342,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 304,
+ "name": "VariableDeclaration",
+ "src": "2086:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 305,
+ "name": "Identifier",
+ "src": "2101:9:1"
+ },
+ {
+ "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": 509,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 306,
+ "name": "Identifier",
+ "src": "2111:3:1"
+ }
+ ],
+ "id": 307,
+ "name": "MemberAccess",
+ "src": "2111:10:1"
+ }
+ ],
+ "id": 308,
+ "name": "IndexAccess",
+ "src": "2101:21:1"
+ }
+ ],
+ "id": 309,
+ "name": "VariableDeclarationStatement",
+ "src": "2086:36:1"
+ },
+ {
+ "attributes": {
+ "assignments": [
+ 311
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "nextPayday",
+ "scope": 342,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 310,
+ "name": "ElementaryTypeName",
+ "src": "2133:4:1"
+ }
+ ],
+ "id": 311,
+ "name": "VariableDeclaration",
+ "src": "2133:15:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "uint256",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ }
+ ],
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "sub",
+ "referencedDeclaration": 472,
+ "type": "function (uint256,uint256) pure returns (uint256)"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "lastPayday",
+ "referencedDeclaration": 70,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 304,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 312,
+ "name": "Identifier",
+ "src": "2151:8:1"
+ }
+ ],
+ "id": 313,
+ "name": "MemberAccess",
+ "src": "2151:19:1"
+ }
+ ],
+ "id": 314,
+ "name": "MemberAccess",
+ "src": "2151:23:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 74,
+ "type": "uint256",
+ "value": "payDuration"
+ },
+ "id": 315,
+ "name": "Identifier",
+ "src": "2175:11:1"
+ }
+ ],
+ "id": 316,
+ "name": "FunctionCall",
+ "src": "2151:36:1"
+ }
+ ],
+ "id": 317,
+ "name": "VariableDeclarationStatement",
+ "src": "2133:54:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 500,
+ "type": "function (bool) pure",
+ "value": "assert"
+ },
+ "id": 318,
+ "name": "Identifier",
+ "src": "2197:6:1"
+ },
+ {
+ "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": 311,
+ "type": "uint256",
+ "value": "nextPayday"
+ },
+ "id": 319,
+ "name": "Identifier",
+ "src": "2204:10:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 511,
+ "type": "uint256",
+ "value": "now"
+ },
+ "id": 320,
+ "name": "Identifier",
+ "src": "2217:3:1"
+ }
+ ],
+ "id": 321,
+ "name": "BinaryOperation",
+ "src": "2204:16:1"
+ }
+ ],
+ "id": 322,
+ "name": "FunctionCall",
+ "src": "2197:24:1"
+ }
+ ],
+ "id": 323,
+ "name": "ExpressionStatement",
+ "src": "2197:24:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "=",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": true,
+ "member_name": "lastPayday",
+ "referencedDeclaration": 70,
+ "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": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 324,
+ "name": "Identifier",
+ "src": "2231:9:1"
+ },
+ {
+ "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": 509,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 325,
+ "name": "Identifier",
+ "src": "2241:3:1"
+ }
+ ],
+ "id": 326,
+ "name": "MemberAccess",
+ "src": "2241:10:1"
+ }
+ ],
+ "id": 327,
+ "name": "IndexAccess",
+ "src": "2231:21:1"
+ }
+ ],
+ "id": 328,
+ "name": "MemberAccess",
+ "src": "2231:32:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 311,
+ "type": "uint256",
+ "value": "nextPayday"
+ },
+ "id": 329,
+ "name": "Identifier",
+ "src": "2266:10:1"
+ }
+ ],
+ "id": 330,
+ "name": "Assignment",
+ "src": "2231:45:1"
+ }
+ ],
+ "id": 331,
+ "name": "ExpressionStatement",
+ "src": "2231:45:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_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": 66,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 304,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 332,
+ "name": "Identifier",
+ "src": "2286:8:1"
+ }
+ ],
+ "id": 335,
+ "name": "MemberAccess",
+ "src": "2286:11:1"
+ }
+ ],
+ "id": 336,
+ "name": "MemberAccess",
+ "src": "2286:20:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 68,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 304,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 337,
+ "name": "Identifier",
+ "src": "2307:8:1"
+ }
+ ],
+ "id": 338,
+ "name": "MemberAccess",
+ "src": "2307:15:1"
+ }
+ ],
+ "id": 339,
+ "name": "FunctionCall",
+ "src": "2286:37:1"
+ }
+ ],
+ "id": 340,
+ "name": "ExpressionStatement",
+ "src": "2286:37:1"
+ }
+ ],
+ "id": 341,
+ "name": "Block",
+ "src": "2076:255:1"
+ }
+ ],
+ "id": 342,
+ "name": "FunctionDefinition",
+ "src": "2031:300:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "name": "changePaymentAddress",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employeeId",
+ "scope": 371,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 343,
+ "name": "ElementaryTypeName",
+ "src": "2367:7:1"
+ }
+ ],
+ "id": 344,
+ "name": "VariableDeclaration",
+ "src": "2367:18:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "newPaymentAddress",
+ "scope": 371,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 345,
+ "name": "ElementaryTypeName",
+ "src": "2387:7:1"
+ }
+ ],
+ "id": 346,
+ "name": "VariableDeclaration",
+ "src": "2387:25:1"
+ }
+ ],
+ "id": 347,
+ "name": "ParameterList",
+ "src": "2366:47:1"
+ },
+ {
+ "attributes": {
+ "parameters": [
+ null
+ ]
+ },
+ "children": [],
+ "id": 354,
+ "name": "ParameterList",
+ "src": "2450:0:1"
+ },
+ {
+ "attributes": {
+ "arguments": [
+ null
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 29,
+ "type": "modifier ()",
+ "value": "onlyOwner"
+ },
+ "id": 348,
+ "name": "Identifier",
+ "src": "2414:9:1"
+ }
+ ],
+ "id": 349,
+ "name": "ModifierInvocation",
+ "src": "2414:9:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 99,
+ "type": "modifier (address)",
+ "value": "employeeExist"
+ },
+ "id": 350,
+ "name": "Identifier",
+ "src": "2424:13:1"
+ },
+ {
+ "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": 509,
+ "type": "msg",
+ "value": "msg"
+ },
+ "id": 351,
+ "name": "Identifier",
+ "src": "2438:3:1"
+ }
+ ],
+ "id": 352,
+ "name": "MemberAccess",
+ "src": "2438:10:1"
+ }
+ ],
+ "id": 353,
+ "name": "ModifierInvocation",
+ "src": "2424:25:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 355
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 371,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 355,
+ "name": "VariableDeclaration",
+ "src": "2460:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 356,
+ "name": "Identifier",
+ "src": "2475:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 344,
+ "type": "address",
+ "value": "employeeId"
+ },
+ "id": 357,
+ "name": "Identifier",
+ "src": "2485:10:1"
+ }
+ ],
+ "id": 358,
+ "name": "IndexAccess",
+ "src": "2475:21:1"
+ }
+ ],
+ "id": 359,
+ "name": "VariableDeclarationStatement",
+ "src": "2460:36:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_struct$_Employee_$71_storage_ptr",
+ "typeString": "struct Payroll.Employee storage pointer"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 128,
+ "type": "function (struct Payroll.Employee memory)",
+ "value": "_partialPaid"
+ },
+ "id": 360,
+ "name": "Identifier",
+ "src": "2506:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 355,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 361,
+ "name": "Identifier",
+ "src": "2519:8:1"
+ }
+ ],
+ "id": 362,
+ "name": "FunctionCall",
+ "src": "2506:22:1"
+ }
+ ],
+ "id": 363,
+ "name": "ExpressionStatement",
+ "src": "2506:22:1"
+ },
+ {
+ "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": 66,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 355,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 364,
+ "name": "Identifier",
+ "src": "2538:8:1"
+ }
+ ],
+ "id": 366,
+ "name": "MemberAccess",
+ "src": "2538:11:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 346,
+ "type": "address",
+ "value": "newPaymentAddress"
+ },
+ "id": 367,
+ "name": "Identifier",
+ "src": "2552:17:1"
+ }
+ ],
+ "id": 368,
+ "name": "Assignment",
+ "src": "2538:31:1"
+ }
+ ],
+ "id": 369,
+ "name": "ExpressionStatement",
+ "src": "2538:31:1"
+ }
+ ],
+ "id": 370,
+ "name": "Block",
+ "src": "2450:126:1"
+ }
+ ],
+ "id": 371,
+ "name": "FunctionDefinition",
+ "src": "2337:239:1"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "getEmployee",
+ "payable": false,
+ "scope": 399,
+ "stateMutability": "nonpayable",
+ "superFunction": null,
+ "visibility": "public"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "id",
+ "scope": 398,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "address",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "address",
+ "type": "address"
+ },
+ "id": 372,
+ "name": "ElementaryTypeName",
+ "src": "2603:7:1"
+ }
+ ],
+ "id": 373,
+ "name": "VariableDeclaration",
+ "src": "2603:10:1"
+ }
+ ],
+ "id": 374,
+ "name": "ParameterList",
+ "src": "2602:12:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "salary",
+ "scope": 398,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint",
+ "type": "uint256"
+ },
+ "id": 375,
+ "name": "ElementaryTypeName",
+ "src": "2624:4:1"
+ }
+ ],
+ "id": 376,
+ "name": "VariableDeclaration",
+ "src": "2624:11:1"
+ }
+ ],
+ "id": 377,
+ "name": "ParameterList",
+ "src": "2623:13:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 378
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "employee",
+ "scope": 398,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "struct Payroll.Employee storage pointer",
+ "typeName": null,
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [],
+ "id": 378,
+ "name": "VariableDeclaration",
+ "src": "2647:12:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "struct Payroll.Employee storage ref"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 81,
+ "type": "mapping(address => struct Payroll.Employee storage ref)",
+ "value": "employees"
+ },
+ "id": 379,
+ "name": "Identifier",
+ "src": "2662:9:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 373,
+ "type": "address",
+ "value": "id"
+ },
+ "id": 380,
+ "name": "Identifier",
+ "src": "2672:2:1"
+ }
+ ],
+ "id": 381,
+ "name": "IndexAccess",
+ "src": "2662:13:1"
+ }
+ ],
+ "id": 382,
+ "name": "VariableDeclarationStatement",
+ "src": "2647:28:1"
+ },
+ {
+ "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": 66,
+ "type": "address"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 378,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 383,
+ "name": "Identifier",
+ "src": "2689:8:1"
+ }
+ ],
+ "id": 384,
+ "name": "MemberAccess",
+ "src": "2689:11:1"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "307830",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0x0"
+ },
+ "id": 385,
+ "name": "Literal",
+ "src": "2704:3:1"
+ }
+ ],
+ "id": 386,
+ "name": "BinaryOperation",
+ "src": "2689:18:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 377
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isInlineArray": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "type": "int_const 0"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 387,
+ "name": "Literal",
+ "src": "2729:1:1"
+ }
+ ],
+ "id": 388,
+ "name": "TupleExpression",
+ "src": "2728:3:1"
+ }
+ ],
+ "id": 389,
+ "name": "Return",
+ "src": "2721:10:1"
+ }
+ ],
+ "id": 390,
+ "name": "Block",
+ "src": "2709:33:1"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 377
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isInlineArray": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": true,
+ "isPure": false,
+ "lValueRequested": false,
+ "member_name": "salary",
+ "referencedDeclaration": 68,
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 378,
+ "type": "struct Payroll.Employee storage pointer",
+ "value": "employee"
+ },
+ "id": 391,
+ "name": "Identifier",
+ "src": "2768:8:1"
+ }
+ ],
+ "id": 392,
+ "name": "MemberAccess",
+ "src": "2768:15:1"
+ }
+ ],
+ "id": 393,
+ "name": "TupleExpression",
+ "src": "2767:17:1"
+ }
+ ],
+ "id": 394,
+ "name": "Return",
+ "src": "2760:24:1"
+ }
+ ],
+ "id": 395,
+ "name": "Block",
+ "src": "2748:47:1"
+ }
+ ],
+ "id": 396,
+ "name": "IfStatement",
+ "src": "2685:110:1"
+ }
+ ],
+ "id": 397,
+ "name": "Block",
+ "src": "2637:164:1"
+ }
+ ],
+ "id": 398,
+ "name": "FunctionDefinition",
+ "src": "2582:219:1"
+ }
+ ],
+ "id": 399,
+ "name": "ContractDefinition",
+ "src": "77:2728:1"
+ }
+ ],
+ "id": 400,
+ "name": "SourceUnit",
+ "src": "0:2805:1"
+ },
+ "compiler": {
+ "name": "solc",
+ "version": "0.4.19+commit.c4cbbb05.Emscripten.clang"
+ },
+ "networks": {
+ "1517826747297": {
+ "events": {},
+ "links": {},
+ "address": "0x5d152e02a1b07b1e0d0d922e262cbfdb01a2a676"
+ }
+ },
+ "schemaVersion": "1.0.1",
+ "updatedAt": "2018-02-05T10:43:03.880Z"
+}
\ No newline at end of file
diff --git a/Lesson4/assignment/build/contracts/SafeMath.json b/Lesson4/assignment/build/contracts/SafeMath.json
new file mode 100644
index 000000000..96d81f2c2
--- /dev/null
+++ b/Lesson4/assignment/build/contracts/SafeMath.json
@@ -0,0 +1,1353 @@
+{
+ "contractName": "SafeMath",
+ "abi": [],
+ "bytecode": "0x60606040523415600e57600080fd5b603580601b6000396000f3006060604052600080fd00a165627a7a72305820292313b0e02561c0832d9e09aa52925beaf05f41a0352bd9ea90f7a405cf7e940029",
+ "deployedBytecode": "0x6060604052600080fd00a165627a7a72305820292313b0e02561c0832d9e09aa52925beaf05f41a0352bd9ea90f7a405cf7e940029",
+ "sourceMap": "117:1022:2:-;;;;;;;;;;;;;;;;;",
+ "deployedSourceMap": "117:1022:2:-;;;;;",
+ "source": "pragma solidity ^0.4.18;\n\n\n/**\n * @title SafeMath\n * @dev Math operations with safety checks that throw on error\n */\nlibrary SafeMath {\n\n /**\n * @dev Multiplies two numbers, throws on overflow.\n */\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n assert(c / a == b);\n return c;\n }\n\n /**\n * @dev Integer division of two numbers, truncating the quotient.\n */\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\n // assert(b > 0); // Solidity automatically throws when dividing by 0\n uint256 c = a / b;\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\n return c;\n }\n\n /**\n * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).\n */\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\n assert(b <= a);\n return a - b;\n }\n\n /**\n * @dev Adds two numbers, throws on overflow.\n */\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\n uint256 c = a + b;\n assert(c >= a);\n return c;\n }\n}",
+ "sourcePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/SafeMath.sol",
+ "ast": {
+ "attributes": {
+ "absolutePath": "/Users/wentao/IdeaProjects/ethereum/class4/contracts/SafeMath.sol",
+ "exportedSymbols": {
+ "SafeMath": [
+ 497
+ ]
+ }
+ },
+ "children": [
+ {
+ "attributes": {
+ "literals": [
+ "solidity",
+ "^",
+ "0.4",
+ ".18"
+ ]
+ },
+ "id": 401,
+ "name": "PragmaDirective",
+ "src": "0:24:2"
+ },
+ {
+ "attributes": {
+ "baseContracts": [
+ null
+ ],
+ "contractDependencies": [
+ null
+ ],
+ "contractKind": "library",
+ "documentation": "@title SafeMath\n@dev Math operations with safety checks that throw on error",
+ "fullyImplemented": true,
+ "linearizedBaseContracts": [
+ 497
+ ],
+ "name": "SafeMath",
+ "scope": 498
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "mul",
+ "payable": false,
+ "scope": 497,
+ "stateMutability": "pure",
+ "superFunction": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "a",
+ "scope": 434,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 402,
+ "name": "ElementaryTypeName",
+ "src": "216:7:2"
+ }
+ ],
+ "id": 403,
+ "name": "VariableDeclaration",
+ "src": "216:9:2"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "b",
+ "scope": 434,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 404,
+ "name": "ElementaryTypeName",
+ "src": "227:7:2"
+ }
+ ],
+ "id": 405,
+ "name": "VariableDeclaration",
+ "src": "227:9:2"
+ }
+ ],
+ "id": 406,
+ "name": "ParameterList",
+ "src": "215:22:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 434,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 407,
+ "name": "ElementaryTypeName",
+ "src": "261:7:2"
+ }
+ ],
+ "id": 408,
+ "name": "VariableDeclaration",
+ "src": "261:7:2"
+ }
+ ],
+ "id": 409,
+ "name": "ParameterList",
+ "src": "260:9:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "falseBody": null
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "==",
+ "type": "bool"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 403,
+ "type": "uint256",
+ "value": "a"
+ },
+ "id": 410,
+ "name": "Identifier",
+ "src": "280:1:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 411,
+ "name": "Literal",
+ "src": "285:1:2"
+ }
+ ],
+ "id": 412,
+ "name": "BinaryOperation",
+ "src": "280:6:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "functionReturnParameters": 409
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "hexvalue": "30",
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": true,
+ "lValueRequested": false,
+ "subdenomination": null,
+ "token": "number",
+ "type": "int_const 0",
+ "value": "0"
+ },
+ "id": 413,
+ "name": "Literal",
+ "src": "303:1:2"
+ }
+ ],
+ "id": 414,
+ "name": "Return",
+ "src": "296:8:2"
+ }
+ ],
+ "id": 415,
+ "name": "Block",
+ "src": "288:23:2"
+ }
+ ],
+ "id": 416,
+ "name": "IfStatement",
+ "src": "276:35:2"
+ },
+ {
+ "attributes": {
+ "assignments": [
+ 418
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "c",
+ "scope": 434,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 417,
+ "name": "ElementaryTypeName",
+ "src": "316:7:2"
+ }
+ ],
+ "id": 418,
+ "name": "VariableDeclaration",
+ "src": "316:9:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "*",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 403,
+ "type": "uint256",
+ "value": "a"
+ },
+ "id": 419,
+ "name": "Identifier",
+ "src": "328:1:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 405,
+ "type": "uint256",
+ "value": "b"
+ },
+ "id": 420,
+ "name": "Identifier",
+ "src": "332:1:2"
+ }
+ ],
+ "id": 421,
+ "name": "BinaryOperation",
+ "src": "328:5:2"
+ }
+ ],
+ "id": 422,
+ "name": "VariableDeclarationStatement",
+ "src": "316:17:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 500,
+ "type": "function (bool) pure",
+ "value": "assert"
+ },
+ "id": 423,
+ "name": "Identifier",
+ "src": "339:6:2"
+ },
+ {
+ "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,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 418,
+ "type": "uint256",
+ "value": "c"
+ },
+ "id": 424,
+ "name": "Identifier",
+ "src": "346:1:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 403,
+ "type": "uint256",
+ "value": "a"
+ },
+ "id": 425,
+ "name": "Identifier",
+ "src": "350:1:2"
+ }
+ ],
+ "id": 426,
+ "name": "BinaryOperation",
+ "src": "346:5:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 405,
+ "type": "uint256",
+ "value": "b"
+ },
+ "id": 427,
+ "name": "Identifier",
+ "src": "355:1:2"
+ }
+ ],
+ "id": 428,
+ "name": "BinaryOperation",
+ "src": "346:10:2"
+ }
+ ],
+ "id": 429,
+ "name": "FunctionCall",
+ "src": "339:18:2"
+ }
+ ],
+ "id": 430,
+ "name": "ExpressionStatement",
+ "src": "339:18:2"
+ },
+ {
+ "attributes": {
+ "functionReturnParameters": 409
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 418,
+ "type": "uint256",
+ "value": "c"
+ },
+ "id": 431,
+ "name": "Identifier",
+ "src": "370:1:2"
+ }
+ ],
+ "id": 432,
+ "name": "Return",
+ "src": "363:8:2"
+ }
+ ],
+ "id": 433,
+ "name": "Block",
+ "src": "270:106:2"
+ }
+ ],
+ "id": 434,
+ "name": "FunctionDefinition",
+ "src": "203:173:2"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "div",
+ "payable": false,
+ "scope": 497,
+ "stateMutability": "pure",
+ "superFunction": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "a",
+ "scope": 452,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 435,
+ "name": "ElementaryTypeName",
+ "src": "471:7:2"
+ }
+ ],
+ "id": 436,
+ "name": "VariableDeclaration",
+ "src": "471:9:2"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "b",
+ "scope": 452,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 437,
+ "name": "ElementaryTypeName",
+ "src": "482:7:2"
+ }
+ ],
+ "id": 438,
+ "name": "VariableDeclaration",
+ "src": "482:9:2"
+ }
+ ],
+ "id": 439,
+ "name": "ParameterList",
+ "src": "470:22:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 452,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 440,
+ "name": "ElementaryTypeName",
+ "src": "516:7:2"
+ }
+ ],
+ "id": 441,
+ "name": "VariableDeclaration",
+ "src": "516:7:2"
+ }
+ ],
+ "id": 442,
+ "name": "ParameterList",
+ "src": "515:9:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 444
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "c",
+ "scope": 452,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 443,
+ "name": "ElementaryTypeName",
+ "src": "605:7:2"
+ }
+ ],
+ "id": 444,
+ "name": "VariableDeclaration",
+ "src": "605:9:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "/",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 436,
+ "type": "uint256",
+ "value": "a"
+ },
+ "id": 445,
+ "name": "Identifier",
+ "src": "617:1:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 438,
+ "type": "uint256",
+ "value": "b"
+ },
+ "id": 446,
+ "name": "Identifier",
+ "src": "621:1:2"
+ }
+ ],
+ "id": 447,
+ "name": "BinaryOperation",
+ "src": "617:5:2"
+ }
+ ],
+ "id": 448,
+ "name": "VariableDeclarationStatement",
+ "src": "605:17:2"
+ },
+ {
+ "attributes": {
+ "functionReturnParameters": 442
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 444,
+ "type": "uint256",
+ "value": "c"
+ },
+ "id": 449,
+ "name": "Identifier",
+ "src": "717:1:2"
+ }
+ ],
+ "id": 450,
+ "name": "Return",
+ "src": "710:8:2"
+ }
+ ],
+ "id": 451,
+ "name": "Block",
+ "src": "525:198:2"
+ }
+ ],
+ "id": 452,
+ "name": "FunctionDefinition",
+ "src": "458:265:2"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "sub",
+ "payable": false,
+ "scope": 497,
+ "stateMutability": "pure",
+ "superFunction": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "a",
+ "scope": 472,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 453,
+ "name": "ElementaryTypeName",
+ "src": "849:7:2"
+ }
+ ],
+ "id": 454,
+ "name": "VariableDeclaration",
+ "src": "849:9:2"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "b",
+ "scope": 472,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 455,
+ "name": "ElementaryTypeName",
+ "src": "860:7:2"
+ }
+ ],
+ "id": 456,
+ "name": "VariableDeclaration",
+ "src": "860:9:2"
+ }
+ ],
+ "id": 457,
+ "name": "ParameterList",
+ "src": "848:22:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 472,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 458,
+ "name": "ElementaryTypeName",
+ "src": "894:7:2"
+ }
+ ],
+ "id": 459,
+ "name": "VariableDeclaration",
+ "src": "894:7:2"
+ }
+ ],
+ "id": 460,
+ "name": "ParameterList",
+ "src": "893:9:2"
+ },
+ {
+ "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": 500,
+ "type": "function (bool) pure",
+ "value": "assert"
+ },
+ "id": 461,
+ "name": "Identifier",
+ "src": "909:6:2"
+ },
+ {
+ "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": 456,
+ "type": "uint256",
+ "value": "b"
+ },
+ "id": 462,
+ "name": "Identifier",
+ "src": "916:1:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 454,
+ "type": "uint256",
+ "value": "a"
+ },
+ "id": 463,
+ "name": "Identifier",
+ "src": "921:1:2"
+ }
+ ],
+ "id": 464,
+ "name": "BinaryOperation",
+ "src": "916:6:2"
+ }
+ ],
+ "id": 465,
+ "name": "FunctionCall",
+ "src": "909:14:2"
+ }
+ ],
+ "id": 466,
+ "name": "ExpressionStatement",
+ "src": "909:14:2"
+ },
+ {
+ "attributes": {
+ "functionReturnParameters": 460
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "-",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 454,
+ "type": "uint256",
+ "value": "a"
+ },
+ "id": 467,
+ "name": "Identifier",
+ "src": "936:1:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 456,
+ "type": "uint256",
+ "value": "b"
+ },
+ "id": 468,
+ "name": "Identifier",
+ "src": "940:1:2"
+ }
+ ],
+ "id": 469,
+ "name": "BinaryOperation",
+ "src": "936:5:2"
+ }
+ ],
+ "id": 470,
+ "name": "Return",
+ "src": "929:12:2"
+ }
+ ],
+ "id": 471,
+ "name": "Block",
+ "src": "903:43:2"
+ }
+ ],
+ "id": 472,
+ "name": "FunctionDefinition",
+ "src": "836:110:2"
+ },
+ {
+ "attributes": {
+ "constant": true,
+ "implemented": true,
+ "isConstructor": false,
+ "modifiers": [
+ null
+ ],
+ "name": "add",
+ "payable": false,
+ "scope": 497,
+ "stateMutability": "pure",
+ "superFunction": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "a",
+ "scope": 496,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 473,
+ "name": "ElementaryTypeName",
+ "src": "1021:7:2"
+ }
+ ],
+ "id": 474,
+ "name": "VariableDeclaration",
+ "src": "1021:9:2"
+ },
+ {
+ "attributes": {
+ "constant": false,
+ "name": "b",
+ "scope": 496,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 475,
+ "name": "ElementaryTypeName",
+ "src": "1032:7:2"
+ }
+ ],
+ "id": 476,
+ "name": "VariableDeclaration",
+ "src": "1032:9:2"
+ }
+ ],
+ "id": 477,
+ "name": "ParameterList",
+ "src": "1020:22:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "",
+ "scope": 496,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 478,
+ "name": "ElementaryTypeName",
+ "src": "1066:7:2"
+ }
+ ],
+ "id": 479,
+ "name": "VariableDeclaration",
+ "src": "1066:7:2"
+ }
+ ],
+ "id": 480,
+ "name": "ParameterList",
+ "src": "1065:9:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "assignments": [
+ 482
+ ]
+ },
+ "children": [
+ {
+ "attributes": {
+ "constant": false,
+ "name": "c",
+ "scope": 496,
+ "stateVariable": false,
+ "storageLocation": "default",
+ "type": "uint256",
+ "value": null,
+ "visibility": "internal"
+ },
+ "children": [
+ {
+ "attributes": {
+ "name": "uint256",
+ "type": "uint256"
+ },
+ "id": 481,
+ "name": "ElementaryTypeName",
+ "src": "1081:7:2"
+ }
+ ],
+ "id": 482,
+ "name": "VariableDeclaration",
+ "src": "1081:9:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "commonType": {
+ "typeIdentifier": "t_uint256",
+ "typeString": "uint256"
+ },
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "lValueRequested": false,
+ "operator": "+",
+ "type": "uint256"
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 474,
+ "type": "uint256",
+ "value": "a"
+ },
+ "id": 483,
+ "name": "Identifier",
+ "src": "1093:1:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 476,
+ "type": "uint256",
+ "value": "b"
+ },
+ "id": 484,
+ "name": "Identifier",
+ "src": "1097:1:2"
+ }
+ ],
+ "id": 485,
+ "name": "BinaryOperation",
+ "src": "1093:5:2"
+ }
+ ],
+ "id": 486,
+ "name": "VariableDeclarationStatement",
+ "src": "1081:17:2"
+ },
+ {
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "isConstant": false,
+ "isLValue": false,
+ "isPure": false,
+ "isStructConstructorCall": false,
+ "lValueRequested": false,
+ "names": [
+ null
+ ],
+ "type": "tuple()",
+ "type_conversion": false
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": [
+ {
+ "typeIdentifier": "t_bool",
+ "typeString": "bool"
+ }
+ ],
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 500,
+ "type": "function (bool) pure",
+ "value": "assert"
+ },
+ "id": 487,
+ "name": "Identifier",
+ "src": "1104:6:2"
+ },
+ {
+ "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": 482,
+ "type": "uint256",
+ "value": "c"
+ },
+ "id": 488,
+ "name": "Identifier",
+ "src": "1111:1:2"
+ },
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 474,
+ "type": "uint256",
+ "value": "a"
+ },
+ "id": 489,
+ "name": "Identifier",
+ "src": "1116:1:2"
+ }
+ ],
+ "id": 490,
+ "name": "BinaryOperation",
+ "src": "1111:6:2"
+ }
+ ],
+ "id": 491,
+ "name": "FunctionCall",
+ "src": "1104:14:2"
+ }
+ ],
+ "id": 492,
+ "name": "ExpressionStatement",
+ "src": "1104:14:2"
+ },
+ {
+ "attributes": {
+ "functionReturnParameters": 480
+ },
+ "children": [
+ {
+ "attributes": {
+ "argumentTypes": null,
+ "overloadedDeclarations": [
+ null
+ ],
+ "referencedDeclaration": 482,
+ "type": "uint256",
+ "value": "c"
+ },
+ "id": 493,
+ "name": "Identifier",
+ "src": "1131:1:2"
+ }
+ ],
+ "id": 494,
+ "name": "Return",
+ "src": "1124:8:2"
+ }
+ ],
+ "id": 495,
+ "name": "Block",
+ "src": "1075:62:2"
+ }
+ ],
+ "id": 496,
+ "name": "FunctionDefinition",
+ "src": "1008:129:2"
+ }
+ ],
+ "id": 497,
+ "name": "ContractDefinition",
+ "src": "117:1022:2"
+ }
+ ],
+ "id": 498,
+ "name": "SourceUnit",
+ "src": "0:1139:2"
+ },
+ "compiler": {
+ "name": "solc",
+ "version": "0.4.19+commit.c4cbbb05.Emscripten.clang"
+ },
+ "networks": {
+ "1517826747297": {
+ "events": {},
+ "links": {},
+ "address": "0x38af3515e68b2c3982b0d98f54a04d068a4fcfad"
+ }
+ },
+ "schemaVersion": "1.0.1",
+ "updatedAt": "2018-02-05T10:43:03.877Z"
+}
\ 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..f170cb4fa
--- /dev/null
+++ b/Lesson4/assignment/contracts/Migrations.sol
@@ -0,0 +1,23 @@
+pragma solidity ^0.4.17;
+
+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/Ownable.sol b/Lesson4/assignment/contracts/Ownable.sol
new file mode 100644
index 000000000..d52c4864a
--- /dev/null
+++ b/Lesson4/assignment/contracts/Ownable.sol
@@ -0,0 +1,42 @@
+pragma solidity ^0.4.18;
+
+
+/**
+ * @title Ownable
+ * @dev The Ownable contract has an owner address, and provides basic authorization control
+ * functions, this simplifies the implementation of "user permissions".
+ */
+contract Ownable {
+ address public owner;
+
+
+ event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
+
+
+ /**
+ * @dev The Ownable constructor sets the original `owner` of the contract to the sender
+ * account.
+ */
+ function Ownable() public {
+ owner = msg.sender;
+ }
+
+ /**
+ * @dev Throws if called by any account other than the owner.
+ */
+ modifier onlyOwner() {
+ require(msg.sender == owner);
+ _;
+ }
+
+ /**
+ * @dev Allows the current owner to transfer control of the contract to a newOwner.
+ * @param newOwner The address to transfer ownership to.
+ */
+ function transferOwnership(address newOwner) public onlyOwner {
+ require(newOwner != address(0));
+ OwnershipTransferred(owner, newOwner);
+ owner = newOwner;
+ }
+
+}
\ No newline at end of file
diff --git a/Lesson4/assignment/contracts/Payroll.sol b/Lesson4/assignment/contracts/Payroll.sol
new file mode 100644
index 000000000..f36a93a0e
--- /dev/null
+++ b/Lesson4/assignment/contracts/Payroll.sol
@@ -0,0 +1,100 @@
+pragma solidity ^0.4.14;
+
+import './SafeMath.sol';
+import './Ownable.sol';
+
+
+contract Payroll is Ownable {
+ using SafeMath for uint;
+ struct Employee {
+ address id;
+ uint salary;
+ uint lastPayday;
+ }
+
+ uint constant payDuration = 100 seconds;
+
+ uint totalSalary = 0;
+ mapping(address => Employee) public employees;
+
+ modifier employeeExist(address employeeId) {
+ var employee = employees[employeeId];
+ assert(employee.id != 0x0);
+ _;
+ }
+
+ function _partialPaid(Employee employee) private {
+ uint payment = employee.salary
+ .mul(now.sub(employee.lastPayday))
+ .div(payDuration);
+ employee.id.transfer(payment);
+ }
+
+
+ function addEmployee(address employeeId, uint salary) onlyOwner {
+ var employee = employees[employeeId];
+ assert(employee.id == 0x0);
+ uint newSalary = salary.mul(1 ether);
+ employees[employeeId] = Employee(employeeId, newSalary, now);
+ totalSalary = totalSalary.add(newSalary);
+ }
+
+
+
+ function removeEmployee(address employeeId) onlyOwner employeeExist(employeeId) {
+ var employee = employees[employeeId];
+
+ _partialPaid(employee);
+ totalSalary = totalSalary.sub(employee.salary);
+ delete employees[employeeId];
+ }
+
+ function updateEmployee(address employeeId, uint salary) onlyOwner employeeExist(employeeId) {
+ var employee = employees[employeeId];
+ _partialPaid(employee);
+ totalSalary = totalSalary.sub(employee.salary);
+ uint newSalary = salary.mul(1 ether);
+ totalSalary = totalSalary.add(newSalary);
+ employees[employeeId].salary = newSalary;
+ employees[employeeId].lastPayday = now;
+ }
+
+ function addFund() payable public returns (uint) {
+ return this.balance;
+ }
+
+ function calculateRunway() returns (uint) {
+ return this.balance.div(totalSalary);
+ }
+
+ function hasEnoughFund() returns (bool) {
+ return calculateRunway() > 0;
+ }
+
+ function getPaid() employeeExist(msg.sender) {
+ var employee = employees[msg.sender];
+
+ uint nextPayday = employee.lastPayday.sub(payDuration);
+ assert(nextPayday < now);
+ employees[msg.sender].lastPayday = nextPayday;
+ employee.id.transfer(employee.salary);
+
+ }
+
+ function changePaymentAddress(address employeeId, address newPaymentAddress) onlyOwner employeeExist(msg.sender) {
+ var employee = employees[employeeId];
+ _partialPaid(employee);
+ employee.id = newPaymentAddress;
+ }
+
+ function getEmployee(address id) returns (uint salary) {
+ var employee = employees[id];
+ if (employee.id == 0x0) {
+ return (0);
+ } else {
+ return (employee.salary);
+ }
+ }
+
+
+}
\ 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..a54a5eee6
--- /dev/null
+++ b/Lesson4/assignment/contracts/SafeMath.sol
@@ -0,0 +1,48 @@
+pragma solidity ^0.4.18;
+
+
+/**
+ * @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/1_initial_migration.js b/Lesson4/assignment/migrations/1_initial_migration.js
new file mode 100644
index 000000000..4d5f3f9b0
--- /dev/null
+++ b/Lesson4/assignment/migrations/1_initial_migration.js
@@ -0,0 +1,5 @@
+var Migrations = artifacts.require("./Migrations.sol");
+
+module.exports = function(deployer) {
+ deployer.deploy(Migrations);
+};
diff --git a/Lesson4/assignment/migrations/2_deploy_contracts.js b/Lesson4/assignment/migrations/2_deploy_contracts.js
new file mode 100644
index 000000000..c8b6f927e
--- /dev/null
+++ b/Lesson4/assignment/migrations/2_deploy_contracts.js
@@ -0,0 +1,11 @@
+var SafeMathLib = artifacts.require("./SafeMath.sol");
+var OwnableLib = artifacts.require("./Ownable.sol");
+var Payroll = artifacts.require("./Payroll.sol");
+
+module.exports = function(deployer) {
+ deployer.deploy(SafeMathLib);
+ deployer.deploy(OwnableLib);
+ deployer.link(SafeMathLib, Payroll);
+ deployer.link(OwnableLib, Payroll);
+ deployer.deploy(Payroll);
+};
\ No newline at end of file
diff --git a/Lesson4/assignment/test/payroll.js b/Lesson4/assignment/test/payroll.js
new file mode 100644
index 000000000..3234deccd
--- /dev/null
+++ b/Lesson4/assignment/test/payroll.js
@@ -0,0 +1,29 @@
+var Payroll = artifacts.require("../contracts/Payroll.sol");
+
+
+
+contract('Payroll', function(accounts) {
+
+ var id = "0xca35b7d915458ef540ade6068dfe2f44e8fa733c";
+
+ it("Add an employee", function() {
+ return Payroll.deployed().then(function(instance) {
+ payroll = instance;
+ payroll.addEmployee(id, 1);
+ }).then(function() {
+ return payroll.getEmployee.call(id);
+ }).then(function(res) {
+ assert.equal(res, '1000000000000000000', "Add employee error");
+ });
+ });
+
+ it("Remove an employee", function() {
+ return Payroll.deployed().then(function(instance) {
+ payroll = instance;
+ payroll.removeEmployee(accounts[1]);
+ }).then(function() {
+ assert(true, "Remove Error !");
+ });
+ });
+
+});
diff --git a/Lesson4/assignment/truffle-config.js b/Lesson4/assignment/truffle-config.js
new file mode 100644
index 000000000..a6330d6d5
--- /dev/null
+++ b/Lesson4/assignment/truffle-config.js
@@ -0,0 +1,4 @@
+module.exports = {
+ // See
+ // to customize your Truffle configuration!
+};
diff --git a/Lesson4/assignment/truffle.js b/Lesson4/assignment/truffle.js
new file mode 100644
index 000000000..29034612d
--- /dev/null
+++ b/Lesson4/assignment/truffle.js
@@ -0,0 +1,9 @@
+module.exports = {
+ networks: {
+ development: {
+ host: "localhost",
+ port: 8545,
+ 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/assignment/yours.sol b/Lesson5/assignment/yours.sol
new file mode 100644
index 000000000..dfdb2c486
--- /dev/null
+++ b/Lesson5/assignment/yours.sol
@@ -0,0 +1 @@
+/*作业请提交在这个目录下*/
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