UNPKG

@aragon/apps-payroll

Version:

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

1,119 lines 1.03 MB
{ "contractName": "PPFMock", "abi": [ { "constant": true, "inputs": [], "name": "ratePrecision", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "pure", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "address" }, { "name": "", "type": "address" } ], "name": "get", "outputs": [ { "name": "xrt", "type": "uint128" }, { "name": "when", "type": "uint64" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b5061011e806100206000396000f30060806040526004361060485763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663d81e84238114604d578063f40a04481460b3575b600080fd5b348015605857600080fd5b50607e73ffffffffffffffffffffffffffffffffffffffff6004358116906024351660d7565b604080516fffffffffffffffffffffffffffffffff909316835267ffffffffffffffff90911660208301528051918290030190f35b34801560be57600080fd5b5060c560e6565b60408051918252519081900360200190f35b50661aa535d3d0c00091429150565b670de0b6b3a7640000905600a165627a7a7230582083b752132a2edd9448fab0bf4ded4b1f9461f74d50166b1be8d23e9bcde5fcb90029", "deployedBytecode": "0x60806040526004361060485763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663d81e84238114604d578063f40a04481460b3575b600080fd5b348015605857600080fd5b50607e73ffffffffffffffffffffffffffffffffffffffff6004358116906024351660d7565b604080516fffffffffffffffffffffffffffffffff909316835267ffffffffffffffff90911660208301528051918290030190f35b34801560be57600080fd5b5060c560e6565b60408051918252519081900360200190f35b50661aa535d3d0c00091429150565b670de0b6b3a7640000905600a165627a7a7230582083b752132a2edd9448fab0bf4ded4b1f9461f74d50166b1be8d23e9bcde5fcb90029", "sourceMap": "744:289:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;744:289:1;;;;;;;", "deployedSourceMap": "744:289:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;871:160;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;871:160:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;776:89;;8:9:-1;5:2;;;30:1;27;20:12;5:2;776:89:1;;;;;;;;;;;;;;;;;;;;871:160;-1:-1:-1;965:16:1;;1022:3;;-1:-1:-1;871:160:1:o;776:89::-;850:8;776:89;:::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, "leftHandSide": { "argumentTypes": null, "id": 2060, "name": "ens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2041, "src": "1303:3:1", "typeDescriptions": { "typeIdentifier": "t_contract$_ENS_$13457", "typeString": "contract ENS" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 2061, "name": "_ens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2057, "src": "1309:4:1", "typeDescriptions": { "typeIdentifier": "t_contract$_ENS_$13457", "typeString": "contract ENS" } }, "src": "1303:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_ENS_$13457", "typeString": "contract ENS" } }, "id": 2063, "nodeType": "ExpressionStatement", "src": "1303:10:1" }, { "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 2070, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 2065, "name": "_fac", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2055, "src": "1402:4:1", "typeDescriptions": { "typeIdentifier": "t_contract$_DAOFactory_$12439", "typeString": "contract DAOFactory" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_DAOFactory_$12439", "typeString": "contract DAOFactory" } ], "id": 2064, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1394:7:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 2066, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1394:13:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 2068, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1419:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 2067, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1411:7:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 2069, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1411:10:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "src": "1394:27:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "falseBody": { "id": 2092, "nodeType": "Block", "src": "1559:35:1", "statements": [ { "expression": { "argumentTypes": null, "id": 2090, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 2088, "name": "fac", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2043, "src": "1573:3:1", "typeDescriptions": { "typeIdentifier": "t_contract$_DAOFactory_$12439", "typeString": "contract DAOFactory" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 2089, "name": "_fac", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 2055, "src": "1579:4:1", "typeDescriptions": { "typeIdentifier": "t_contract$_DAOFactory_$12439", "typeString": "contract DAOFactory" } }, "src": "1573:10:1", "typeDescriptions": { "typeIdentifier": "t_contract$_DAOFactory_$12439", "typeString": "contract DAOFactory" } }, "id": 2091, "nodeType": "Expressi