UNPKG

@aragon/apps-payroll

Version:

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

956 lines (955 loc) 1.04 MB
{ "contractName": "KitBase", "abi": [ { "constant": true, "inputs": [], "name": "ens", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "fac", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_fac", "type": "address" }, { "name": "_ens", "type": "address" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "dao", "type": "address" } ], "name": "DeployInstance", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "appProxy", "type": "address" }, { "indexed": false, "name": "appId", "type": "bytes32" } ], "name": "InstalledApp", "type": "event" }, { "constant": true, "inputs": [ { "name": "appId", "type": "bytes32" } ], "name": "latestVersionAppBase", "outputs": [ { "name": "base", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b5060405160408061083083398101604052805160209091015160008054600160a060020a031916600160a060020a03808416919091178255831615156101505760408051808201909152600881527f626172652d6b6974000000000000000000000000000000000000000000000000602082015261009690640100000000610174810204565b90506100aa81640100000000610276810204565b600160a060020a031663c3b314726040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561010057600080fd5b505af1158015610114573d6000803e3d6000fd5b505050506040513d602081101561012a57600080fd5b505160018054600160a060020a031916600160a060020a0390921691909117905561016c565b60018054600160a060020a031916600160a060020a0385161790555b505050610494565b60007f9065c3e7f7b7ef1ef4e53d2d0b8e0cef02874ab020c1ece79d5f0d3d0111c0ba600102826040518082805190602001908083835b602083106101ca5780518252601f1990920191602091820191016101ab565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208282019790975281840196909652825180820384018152606090910192839052805190959294508493509185019190508083835b602083106102445780518252601f199092019160209182019101610225565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050565b60008054604080517f0178b8bf0000000000000000000000000000000000000000000000000000000081526004810185905290518392600160a060020a031691630178b8bf91602480830192602092919082900301818787803b1580156102dc57600080fd5b505af11580156102f0573d6000803e3d6000fd5b505050506040513d602081101561030657600080fd5b5051604080517f3b3b57de000000000000000000000000000000000000000000000000000000008152600481018690529051600160a060020a0390921691633b3b57de916024808201926020929091908290030181600087803b15801561036c57600080fd5b505af1158015610380573d6000803e3d6000fd5b505050506040513d602081101561039657600080fd5b5051604080517fc36af4600000000000000000000000000000000000000000000000000000000081529051919250600160a060020a0383169163c36af4609160048082019260009290919082900301818387803b1580156103f657600080fd5b505af115801561040a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260a081101561043357600080fd5b6060820151608083018051919284019184919064010000000081111561045857600080fd5b8201602081018481111561046b57600080fd5b815164010000000081118282018710171561048557600080fd5b50949998505050505050505050565b61038d806104a36000396000f3006080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633f15457f811461005b578063c3b3147214610099578063c6d2c717146100ae575b600080fd5b34801561006757600080fd5b506100706100c6565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100a557600080fd5b506100706100e2565b3480156100ba57600080fd5b506100706004356100fe565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60008054604080517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018590529051839273ffffffffffffffffffffffffffffffffffffffff1691630178b8bf91602480830192602092919082900301818787803b15801561017157600080fd5b505af1158015610185573d6000803e3d6000fd5b505050506040513d602081101561019b57600080fd5b5051604080517f3b3b57de00000000000000000000000000000000000000000000000000000000815260048101869052905173ffffffffffffffffffffffffffffffffffffffff90921691633b3b57de916024808201926020929091908290030181600087803b15801561020e57600080fd5b505af1158015610222573d6000803e3d6000fd5b505050506040513d602081101561023857600080fd5b5051604080517fc36af460000000000000000000000000000000000000000000000000000000008152905191925073ffffffffffffffffffffffffffffffffffffffff83169163c36af4609160048082019260009290919082900301818387803b1580156102a557600080fd5b505af11580156102b9573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405260a081101561030057600080fd5b6060820151608083018051919284019184919064010000000081111561032557600080fd5b8201602081018481111561033857600080fd5b815164010000000081118282018710171561035257600080fd5b509499985050505050505050505600a165627a7a72305820f1b21a20a36dd64d9d7cad1ee586320308ebdf7015d3c6c5ffa8f135840aa9b70029", "deployedBytecode": "0x6080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633f15457f811461005b578063c3b3147214610099578063c6d2c717146100ae575b600080fd5b34801561006757600080fd5b506100706100c6565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156100a557600080fd5b506100706100e2565b3480156100ba57600080fd5b506100706004356100fe565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60008054604080517f0178b8bf000000000000000000000000000000000000000000000000000000008152600481018590529051839273ffffffffffffffffffffffffffffffffffffffff1691630178b8bf91602480830192602092919082900301818787803b15801561017157600080fd5b505af1158015610185573d6000803e3d6000fd5b505050506040513d602081101561019b57600080fd5b5051604080517f3b3b57de00000000000000000000000000000000000000000000000000000000815260048101869052905173ffffffffffffffffffffffffffffffffffffffff90921691633b3b57de916024808201926020929091908290030181600087803b15801561020e57600080fd5b505af1158015610222573d6000803e3d6000fd5b505050506040513d602081101561023857600080fd5b5051604080517fc36af460000000000000000000000000000000000000000000000000000000008152905191925073ffffffffffffffffffffffffffffffffffffffff83169163c36af4609160048082019260009290919082900301818387803b1580156102a557600080fd5b505af11580156102b9573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405260a081101561030057600080fd5b6060820151608083018051919284019184919064010000000081111561032557600080fd5b8201602081018481111561033857600080fd5b815164010000000081118282018710171561035257600080fd5b509499985050505050505050505600a165627a7a72305820f1b21a20a36dd64d9d7cad1ee586320308ebdf7015d3c6c5ffa8f135840aa9b70029", "sourceMap": "1036:1363:1:-;;;1247:353;8:9:-1;5:2;;;30:1;27;20:12;5:2;1247:353:1;;;;;;;;;;;;;;;;;;;1437:15;1303:10;;-1:-1:-1;;;;;;1303:10:1;-1:-1:-1;;;;;1303:10:1;;;;;;;;;1394:27;;;1390:204;;;1455:23;;;;;;;;;;;;;;;;;;;:11;;;;:23;:::i;:::-;1437:41;-1:-1:-1;1506:29:1;1437:41;1506:20;;;;:29;:::i;:::-;-1:-1:-1;;;;;1498:42:1;;:44;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1498:44:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1498:44:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1498:44:1;1492:3;:50;;-1:-1:-1;;;;;;1492:50:1;-1:-1:-1;;;;;1492:50:1;;;;;;;;;1390:204;;;1573:3;:10;;-1:-1:-1;;;;;;1573:10:1;-1:-1:-1;;;;;1573:10:1;;;;;1390:204;1247:353;;;1036:1363;;379:151:17;436:7;306:66;489:8;;515:4;499:22;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;499:22:17;;;;;;;;;;;;472:50;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;6:49;;472:50:17;;;;;;;;462:61;;472:50;;;;-1:-1:-1;472:50:17;;-1:-1:-1;462:61:17;;;;;-1:-1:-1;462:61:17;472:50;462:61;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;;;;365:33;;462:61:17;;;;;;;;;;;;-1:-1:-1;;;;;379:151:17:o;1606:221:1:-;1672:12;1728:3;;:19;;;;;;;;;;;;;;1672:12;;-1:-1:-1;;;;;1728:3:1;;:12;;:19;;;;;;;;;;;;;;1672:12;1728:3;:19;;;5:2:-1;;;;30:1;27;20:12;5:2;1728:19:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1728:19:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1728:19:1;1713:47;;;;;;;;;;;;;;-1:-1:-1;;;;;1713:40:1;;;;;;:47;;;;;1728:19;;1713:47;;;;;;;;;:40;:47;;;5:2:-1;;;;30:1;27;20:12;5:2;1713:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1713:47:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1713:47:1;1782:16;;;;;;;;1713:47;;-1:-1:-1;;;;;;1782:14:1;;;;;:16;;;;;;;;;;;;;;;;:14;:16;;;5:2:-1;;;;30:1;27;20:12;5:2;1782:16:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1782:16:1;;;;;;39::-1;36:1;17:17;2:54;101:4;1782:16:1;80:15:-1;;;-1:-1;;76:31;65:43;;120:4;113:20;13:3;5:12;;2:2;;;30:1;27;20:12;2:2;1782:16:1;;;;;;;;;;;;;;;;;20:11:-1;12:20;;9:2;;;45:1;42;35:12;9:2;64:21;;126:4;117:14;;142:31;;;139:2;;;186:1;183;176:12;139:2;218:10;;268:11;251:29;;293:43;;;290:58;-1:-1;239:118;236:2;;;370:1;367;360:12;236:2;-1:-1;1771:27:1;;1606:221;-1:-1:-1;;;;;;;;;1606:221:1:o;1036:1363::-;;;;;;;", "deployedSourceMap": "1036:1363:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1102:14;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1102:14:1;;;;;;;;;;;;;;;;;;;;;;;1122:21;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1122:21:1;;;;1606:221;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1606:221:1;;;;;1102:14;;;;;;:::o;1122:21::-;;;;;;:::o;1606:221::-;1672:12;1728:3;;:19;;;;;;;;;;;;;;1672:12;;1728:3;;;:12;;:19;;;;;;;;;;;;;;1672:12;1728:3;:19;;;5:2:-1;;;;30:1;27;20:12;5:2;1728:19:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1728:19:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1728:19:1;1713:47;;;;;;;;;;;;;;:40;;;;;;;:47;;;;;1728:19;;1713:47;;;;;;;;;:40;:47;;;5:2:-1;;;;30:1;27;20:12;5:2;1713:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1713:47:1;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;1713:47:1;1782:16;;;;;;;;1713:47;;-1:-1:-1;1782:14:1;;;;;;:16;;;;;;;;;;;;;;;;:14;:16;;;5:2:-1;;;;30:1;27;20:12;5:2;1782:16:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1782:16:1;;;;;;39::-1;36:1;17:17;2:54;101:4;1782:16:1;80:15:-1;;;97:9;76:31;65:43;;120:4;113:20;13:3;5:12;;2:2;;;30:1;27;20:12;2:2;1782:16:1;;;;;;;;;;;;;;;;;20:11:-1;12:20;;9:2;;;45:1;42;35:12;9:2;64:21;;126:4;117:14;;142:31;;;139:2;;;186:1;183;176:12;139:2;218:10;;268:11;251:29;;293:43;;;290:58;-1:-1;239:118;236:2;;;370:1;367;360:12;236:2;-1:-1;1771:27:1;;1606:221;-1:-1:-1;;;;;;;;;1606:221:1:o", "source": "pragma solidity 0.4.24;\n\nimport \"@aragon/apps-finance/contracts/Finance.sol\";\nimport \"@aragon/apps-shared-minime/contracts/MiniMeToken.sol\";\nimport \"@aragon/apps-vault/contracts/Vault.sol\";\nimport \"@aragon/os/contracts/acl/ACL.sol\";\nimport \"@aragon/os/contracts/apm/APMNamehash.sol\";\nimport \"@aragon/os/contracts/apm/Repo.sol\";\nimport \"@aragon/os/contracts/evmscript/IEVMScriptRegistry.sol\";\nimport \"@aragon/os/contracts/factory/DAOFactory.sol\";\nimport \"@aragon/os/contracts/kernel/Kernel.sol\";\nimport \"@aragon/os/contracts/lib/ens/ENS.sol\";\nimport \"@aragon/os/contracts/lib/ens/PublicResolver.sol\";\nimport \"@aragon/ppf-contracts/contracts/IFeed.sol\";\nimport \"@aragon/apps-token-manager/contracts/TokenManager.sol\";\n\nimport \"../Payroll.sol\";\n\n\ncontract PPFMock is IFeed {\n function ratePrecision() external pure returns (uint256) {\n return 10 ** 18;\n }\n\n function get(address, address) external view returns (uint128 xrt, uint64 when) {\n xrt = 7500000000000000; // 1 ETH = ~133USD\n when = uint64(now);\n }\n}\n\n\ncontract KitBase is APMNamehash, EVMScriptRegistryConstants {\n ENS public ens;\n DAOFactory public fac;\n\n event DeployInstance(address dao);\n event InstalledApp(address appProxy, bytes32 appId);\n\n constructor(DAOFactory _fac, ENS _ens) public {\n ens = _ens;\n\n // If no factory is passed, get it from on-chain bare-kit\n if (address(_fac) == address(0)) {\n bytes32 bareKit = apmNamehash(\"bare-kit\");\n fac = KitBase(latestVersionAppBase(bareKit)).fac();\n } else {\n fac = _fac;\n }\n }\n\n function latestVersionAppBase(bytes32 appId) public view returns (address base) {\n Repo repo = Repo(PublicResolver(ens.resolver(appId)).addr(appId));\n (,base,) = repo.getLatest();\n\n return base;\n }\n\n function cleanupDAOPermissions(Kernel dao, ACL acl, address root) internal {\n // Kernel permission clean up\n cleanupPermission(acl, root, dao, dao.APP_MANAGER_ROLE());\n\n // ACL permission clean up\n cleanupPermission(acl, root, acl, acl.CREATE_PERMISSIONS_ROLE());\n }\n\n function cleanupPermission(ACL acl, address root, address app, bytes32 permission) internal {\n acl.grantPermission(root, app, permission);\n acl.revokePermission(this, app, permission);\n acl.setPermissionManager(root, app, permission);\n }\n}\n\n\ncontract PayrollKit is KitBase {\n MiniMeTokenFactory tokenFactory;\n\n uint64 internal constant FINANCE_PERIOD_DURATION = 31557600;\n uint64 internal constant RATE_EXPIRY_TIME = 1000;\n uint64 internal constant MAX_UINT64 = uint64(-1);\n\n constructor(ENS ens) KitBase(DAOFactory(0), ens) public {\n tokenFactory = new MiniMeTokenFactory();\n }\n\n function newInstance()\n public\n returns (Kernel dao, Payroll payroll)\n {\n address root = msg.sender;\n\n dao = fac.newDAO(this);\n ACL acl = ACL(dao.acl());\n\n // Payroll prerequisites\n PPFMock priceFeed = new PPFMock();\n MiniMeToken denominationToken = newToken(\"USD Dollar\", \"USD\");\n\n // Allow this contract to install new apps for now\n acl.createPermission(this, dao, dao.APP_MANAGER_ROLE(), this);\n\n Vault vault;\n Finance finance;\n (vault, finance) = installBaseApps(dao, acl, root);\n payroll = installPayroll(dao, acl, root, finance, denominationToken, priceFeed);\n\n // Deploy payroll tokens\n MiniMeToken token1 = installManagedToken(dao, acl, root, finance, \"Token 1\", \"TK1\");\n payroll.setAllowedToken(token1, true);\n\n MiniMeToken token2 = installManagedToken(dao, acl, root, finance, \"Token 2\", \"TK2\");\n payroll.setAllowedToken(token2, true);\n\n MiniMeToken token3 = installManagedToken(dao, acl, root, finance, \"Token 3\", \"TK3\");\n payroll.setAllowedToken(token3, true);\n\n // Add employees to payroll\n addEmployees(payroll, root, token1, token2);\n\n // Clean up\n cleanupDAOPermissions(dao, acl, root);\n cleanupPermission(acl, root, payroll, payroll.MANAGE_ALLOWED_TOKENS_ROLE());\n cleanupPermission(acl, root, payroll, payroll.ADD_EMPLOYEE_ROLE());\n\n emit DeployInstance(dao);\n }\n\n function installBaseApps(Kernel dao, ACL acl, address root) internal returns (Vault, Finance) {\n bytes32 vaultAppId = apmNamehash(\"vault\");\n bytes32 financeAppId = apmNamehash(\"finance\");\n\n Vault vault = Vault(dao.newAppInstance(vaultAppId, latestVersionAppBase(vaultAppId)));\n emit InstalledApp(vault, vaultAppId);\n\n Finance finance = Finance(dao.newAppInstance(financeAppId, latestVersionAppBase(financeAppId)));\n emit InstalledApp(finance, financeAppId);\n\n vault.initialize();\n finance.initialize(vault, FINANCE_PERIOD_DURATION);\n acl.createPermission(finance, vault, vault.TRANSFER_ROLE(), root);\n\n return (vault, finance);\n }\n\n function installPayroll(\n Kernel dao,\n ACL acl,\n address root,\n Finance finance,\n MiniMeToken denominationToken,\n IFeed priceFeed\n )\n internal\n returns (Payroll)\n {\n bytes32 payrollAppId = apmNamehash(\"payroll\");\n\n Payroll payroll = Payroll(dao.newAppInstance(payrollAppId, latestVersionAppBase(payrollAppId)));\n emit InstalledApp(payroll, payrollAppId);\n\n payroll.initialize(finance, denominationToken, priceFeed, RATE_EXPIRY_TIME);\n acl.createPermission(payroll, finance, finance.CREATE_PAYMENTS_ROLE(), root);\n acl.createPermission(root, payroll, payroll.TERMINATE_EMPLOYEE_ROLE(), root);\n\n // Allow this contract to add tokens to Payroll for now\n acl.createPermission(this, payroll, payroll.MANAGE_ALLOWED_TOKENS_ROLE(), this);\n\n // Allow this contract to add employees to Payroll for now\n acl.createPermission(this, payroll, payroll.ADD_EMPLOYEE_ROLE(), this);\n\n return payroll;\n }\n\n function installManagedToken(\n Kernel dao,\n ACL acl,\n address root,\n Finance finance,\n string name,\n string symbol\n )\n internal\n returns (MiniMeToken)\n {\n bytes32 tokenManagerAppId = apmNamehash(\"token-manager\");\n\n MiniMeToken token = newToken(name, symbol);\n TokenManager tokenManager = TokenManager(dao.newAppInstance(tokenManagerAppId, latestVersionAppBase(tokenManagerAppId)));\n emit InstalledApp(tokenManager, tokenManagerAppId);\n\n token.changeController(tokenManager);\n tokenManager.initialize(token, true, 0);\n\n // Allow this contract to mint tokens for now\n acl.createPermission(this, tokenManager, tokenManager.MINT_ROLE(), this);\n\n // Add some of the tokens to the Finance app\n tokenManager.mint(this, MAX_UINT64);\n token.approve(finance, MAX_UINT64);\n finance.deposit(token, MAX_UINT64, \"Initial deposit\");\n\n // Clean up permissions\n cleanupPermission(acl, root, tokenManager, tokenManager.MINT_ROLE());\n\n return token;\n }\n\n function newToken(string name, string symbol) internal returns (MiniMeToken token) {\n token = tokenFactory.createCloneToken(MiniMeToken(0), 0, name, 18, symbol, true);\n }\n\n function addEmployees(Payroll payroll, address root, MiniMeToken token1, MiniMeToken token2) internal {\n address account2 = 0x8401Eb5ff34cc943f096A32EF3d5113FEbE8D4Eb;\n address account3 = 0x306469457266CBBe7c0505e8Aad358622235e768;\n address account4 = 0xd873F6DC68e3057e4B7da74c6b304d0eF0B484C7;\n\n uint256 salary1 = 2535047025122316; // 80000\n uint256 salary2 = 2851927903262605; // 90000\n uint256 salary3 = 3168808781402895; // 100000\n uint256 salary4 = 2218166146982026; // 70000\n\n // Set up first user; use this contract as the account so we can set up the initial distribution\n payroll.addEmployee(this, salary1, uint64(now - 86400), \"CEO\");\n\n address[] memory allowedTokens = new address[](2);\n allowedTokens[0] = address(token1);\n allowedTokens[1] = address(token2);\n\n uint256[] memory distribution = new uint256[](2);\n distribution[0] = 45;\n distribution[1] = 55;\n\n payroll.determineAllocation(allowedTokens, distribution);\n payroll.changeAddressByEmployee(root); // Set account to root\n\n // Create more users\n payroll.addEmployee(account2, salary2, uint64(now - 86400), \"Project Manager\");\n payroll.addEmployee(account3, salary3, uint64(now - 172800), \"Developer\");\n payroll.addEmployee(account4, salary4, uint64(now - 172800), \"Developer\");\n }\n}\n", "sourcePath": "/Users/facu/Documents/work/aragon/dev/aragon-apps/future-apps/payroll/contracts/examples/PayrollKit.sol", "ast": { "absolutePath": "/Users/facu/Documents/work/aragon/dev/aragon-apps/future-apps/payroll/contracts/examples/PayrollKit.sol", "exportedSymbols": { "KitBase": [ 2191 ], "PPFMock": [ 2035 ], "PayrollKit": [ 2860 ] }, "id": 2861, "nodeType": "SourceUnit", "nodes": [ { "id": 1986, "literals": [ "solidity", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:23:1" }, { "absolutePath": "@aragon/apps-finance/contracts/Finance.sol", "file": "@aragon/apps-finance/contracts/Finance.sol", "id": 1987, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 5529, "src": "25:52:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/apps-shared-minime/contracts/MiniMeToken.sol", "file": "@aragon/apps-shared-minime/contracts/MiniMeToken.sol", "id": 1988, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 6725, "src": "78:62:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/apps-vault/contracts/Vault.sol", "file": "@aragon/apps-vault/contracts/Vault.sol", "id": 1989, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 7858, "src": "141:48:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/acl/ACL.sol", "file": "@aragon/os/contracts/acl/ACL.sol", "id": 1990, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 9153, "src": "190:42:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/apm/APMNamehash.sol", "file": "@aragon/os/contracts/apm/APMNamehash.sol", "id": 1991, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 9717, "src": "233:50:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/apm/Repo.sol", "file": "@aragon/os/contracts/apm/Repo.sol", "id": 1992, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 10110, "src": "284:43:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/evmscript/IEVMScriptRegistry.sol", "file": "@aragon/os/contracts/evmscript/IEVMScriptRegistry.sol", "id": 1993, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 11871, "src": "328:63:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/factory/DAOFactory.sol", "file": "@aragon/os/contracts/factory/DAOFactory.sol", "id": 1994, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 12440, "src": "392:53:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/kernel/Kernel.sol", "file": "@aragon/os/contracts/kernel/Kernel.sol", "id": 1995, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 13093, "src": "446:48:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/lib/ens/ENS.sol", "file": "@aragon/os/contracts/lib/ens/ENS.sol", "id": 1996, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 13458, "src": "495:46:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/os/contracts/lib/ens/PublicResolver.sol", "file": "@aragon/os/contracts/lib/ens/PublicResolver.sol", "id": 1997, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 13920, "src": "542:57:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/ppf-contracts/contracts/IFeed.sol", "file": "@aragon/ppf-contracts/contracts/IFeed.sol", "id": 1998, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 14314, "src": "600:51:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@aragon/apps-token-manager/contracts/TokenManager.sol", "file": "@aragon/apps-token-manager/contracts/TokenManager.sol", "id": 1999, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 7604, "src": "652:63:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/Users/facu/Documents/work/aragon/dev/aragon-apps/future-apps/payroll/contracts/Payroll.sol", "file": "../Payroll.sol", "id": 2000, "nodeType": "ImportDirective", "scope": 2861, "sourceUnit": 1985, "src": "717:24:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 2001, "name": "IFeed", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 14313, "src": "764:5:1", "typeDescriptions": { "typeIdentifier": "t_contract$_IFeed_$14313", "typeString": "contract IFeed" } }, "id": 2002, "nodeType": "InheritanceSpecifier", "src": "764:5:1" } ], "contractDependencies": [ 14313 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 2035, "linearizedBaseContracts": [ 2035, 14313 ], "name": "PPFMock", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 2011, "nodeType": "Block", "src": "833:32:1", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_rational_1000000000000000000_by_1", "typeString": "int_const 1000000000000000000" }, "id": 2009, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "hexValue": "3130", "id": 2007, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "850:2:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_10_by_1", "typeString": "int_const 10" }, "value": "10" }, "nodeType": "BinaryOperation", "operator": "**", "rightExpression": { "argumentTypes": null, "hexValue": "3138", "id": 2008, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "856:2:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_18_by_1", "typeString": "int_const 18" }, "value": "18" }, "src": "850:8:1", "typeDescriptions": { "typeIdentifier": "t_rational_1000000000000000000_by_1", "typeString": "int_const 1000000000000000000" } }, "functionReturnParameters": 2006, "id": 2010, "nodeType": "Return", "src": "843:15:1" } ] }, "documentation": null, "id": 2012, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "ratePrecision", "nodeType": "FunctionDefinition", "parameters": { "id": 2003, "nodeType": "ParameterList", "parameters": [], "src": "798:2:1" }, "payable": false, "returnParameters": { "id": 2006, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2005, "name": "", "nodeType": "VariableDeclaration", "scope": 2012, "src": "824:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 2004, "name": "uint256", "nodeType": "ElementaryTypeName", "src": "824:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "823:9:1" }, "scope": 2035, "src": "776:89:1", "stateMutability": "pure", "superFunction": 14301, "visibility": "external" }, { "body": { "id": 2033, "nodeType": "Block", "src": "951:80:1", "statements": [ { "expression": { "argumentTypes": null, "id": 2025, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2023, "name": "xrt", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2019, "src": "959:3:1", "typeDescriptions": { "typeIdentifier": "t_uint128", "typeString": "uint128" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "hexValue": "37353030303030303030303030303030", "id": 2024, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "965:16:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_7500000000000000_by_1", "typeString": "int_const 7500000000000000" }, "value": "7500000000000000" }, "src": "959:22:1", "typeDescriptions": { "typeIdentifier": "t_uint128", "typeString": "uint128" } }, "id": 2026, "nodeType": "ExpressionStatement", "src": "959:22:1" }, { "expression": { "argumentTypes": null, "id": 2031, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2027, "name": "when", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2021, "src": "1008:4:1", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 2029, "name": "now", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 15155, "src": "1022:3:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 2028, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1015:6:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_uint64_$", "typeString": "type(uint64)" }, "typeName": "uint64" }, "id": 2030, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1015:11:1", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "src": "1008:18:1", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "id": 2032, "nodeType": "ExpressionStatement", "src": "1008:18:1" } ] }, "documentation": null, "id": 2034, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "get", "nodeType": "FunctionDefinition", "parameters": { "id": 2017, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2014, "name": "", "nodeType": "VariableDeclaration", "scope": 2034, "src": "884:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2013, "name": "address", "nodeType": "ElementaryTypeName", "src": "884:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2016, "name": "", "nodeType": "VariableDeclaration", "scope": 2034, "src": "893:7:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2015, "name": "address", "nodeType": "ElementaryTypeName", "src": "893:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "883:18:1" }, "payable": false, "returnParameters": { "id": 2022, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2019, "name": "xrt", "nodeType": "VariableDeclaration", "scope": 2034, "src": "925:11:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint128", "typeString": "uint128" }, "typeName": { "id": 2018, "name": "uint128", "nodeType": "ElementaryTypeName", "src": "925:7:1", "typeDescriptions": { "typeIdentifier": "t_uint128", "typeString": "uint128" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2021, "name": "when", "nodeType": "VariableDeclaration", "scope": 2034, "src": "938:11:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" }, "typeName": { "id": 2020, "name": "uint64", "nodeType": "ElementaryTypeName", "src": "938:6:1", "typeDescriptions": { "typeIdentifier": "t_uint64", "typeString": "uint64" } }, "value": null, "visibility": "internal" } ], "src": "924:26:1" }, "scope": 2035, "src": "871:160:1", "stateMutability": "view", "superFunction": 14312, "visibility": "external" } ], "scope": 2861, "src": "744:289:1" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 2036, "name": "APMNamehash", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 9716, "src": "1056:11:1", "typeDescriptions": { "typeIdentifier": "t_contract$_APMNamehash_$9716", "typeString": "contract APMNamehash" } }, "id": 2037, "nodeType": "InheritanceSpecifier", "src": "1056:11:1" }, { "arguments": null, "baseName": { "contractScope": null, "id": 2038, "name": "EVMScriptRegistryConstants", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 11850, "src": "1069:26:1", "typeDescriptions": { "typeIdentifier": "t_contract$_EVMScriptRegistryConstants_$11850", "typeString": "contract EVMScriptRegistryConstants" } }, "id": 2039, "nodeType": "InheritanceSpecifier", "src": "1069:26:1" } ], "contractDependencies": [ 9716, 11850 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 2191, "linearizedBaseContracts": [ 2191, 11850, 9716 ], "name": "KitBase", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 2041, "name": "ens", "nodeType": "VariableDeclaration", "scope": 2191, "src": "1102:14:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_ENS_$13457", "typeString": "contract ENS" }, "typeName": { "contractScope": null, "id": 2040, "name": "ENS", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 13457, "src": "1102:3:1", "typeDescriptions": { "typeIdentifier": "t_contract$_ENS_$13457", "typeString": "contract ENS" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 2043, "name": "fac", "nodeType": "VariableDeclaration", "scope": 2191, "src": "1122:21:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_DAOFactory_$12439", "typeString": "contract DAOFactory" }, "typeName": { "contractScope": null, "id": 2042, "name": "DAOFactory", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 12439, "src": "1122:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_DAOFactory_$12439", "typeString": "contract DAOFactory" } }, "value": null, "visibility": "public" }, { "anonymous": false, "documentation": null, "id": 2047, "name": "DeployInstance", "nodeType": "EventDefinition", "parameters": { "id": 2046, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2045, "indexed": false, "name": "dao", "nodeType": "VariableDeclaration", "scope": 2047, "src": "1171:11:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2044, "name": "address", "nodeType": "ElementaryTypeName", "src": "1171:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" } ], "src": "1170:13:1" }, "src": "1150:34:1" }, { "anonymous": false, "documentation": null, "id": 2053, "name": "InstalledApp", "nodeType": "EventDefinition", "parameters": { "id": 2052, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 2049, "indexed": false, "name": "appProxy", "nodeType": "VariableDeclaration", "scope": 2053, "src": "1208:16:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 2048, "name": "address", "nodeType": "ElementaryTypeName", "src": "1208:7:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 2051, "indexed": false, "name": "appId", "nodeType": "VariableDeclaration", "scope": 2053, "src": "1226:13:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 2050, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "1226:7:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "src": "1207:33:1" }, "src": "1189:52:1" }, { "body": { "id": 2094, "nodeType": "Block", "src": "1293:307:1", "statements": [ { "expression": { "argumentTypes": null, "id": 2062, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false,