Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions templates/experimental/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
module.exports = {
env: {
browser: true,
es6: true,
node: true,
commonjs: true,
},
extends: [
'eslint:recommended',
'plugin:import/errors',
'plugin:react/recommended',
'plugin:jsx-a11y/recommended',
],
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 2018,
sourceType: 'module',
},
plugins: ['react'],
rules: {
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
'react/no-typos': 1,
semi: ['error', 'never'],
'array-bracket-spacing': [
'error',
'always',
{
objectsInArrays: false,
arraysInArrays: false,
singleValue: false,
},
],
'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
'object-curly-spacing': ['error', 'always'],
// 'import/no-unused-modules': [
// 'warn',
// {
// unusedExports: true,
// missingExports: true,
// ignoreExports: [],
// },
// ],
'no-undef': 'error',
'no-unused-vars': [
'warn',
{ vars: 'all', args: 'after-used', ignoreRestSiblings: false },
],
'no-console': ['warn', { allow: ['warn', 'error'] }],
'react/jsx-uses-react': 'warn',
'react/jsx-uses-vars': 'warn',
'react/jsx-filename-extension': 'off',
'react/no-unused-prop-types': 'warn',
'sort-imports': ['warn', { ignoreDeclarationSort: true }],
},
settings: {
react: {
version: 'detect',
},
},
}
13 changes: 13 additions & 0 deletions templates/experimental/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"trailingComma": "es5",
"semi": false,
"singleQuote": true,
"overrides": [
{
"files": ".babelrc",
"options": {
"parser": "json"
}
}
]
}
5 changes: 5 additions & 0 deletions templates/experimental/.solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
norpc: true,
skipFiles: ['test'],
deepSkip: true
}
Empty file.
23 changes: 23 additions & 0 deletions templates/experimental/.soliumrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "solium:all",
"rules": {
"imports-on-top": ["error"],
"variable-declarations": ["error"],
"array-declarations": ["error"],
"operator-whitespace": ["error"],
"lbrace": ["error"],
"mixedcase": 0,
"camelcase": ["error"],
"uppercase": 0,
"no-empty-blocks": ["error"],
"no-unused-vars": ["error"],
"quotes": ["error"],
"indentation": ["error", 4],
"whitespace": ["error"],
"deprecated-suicide": ["error"],
"arg-overflow": ["error", 8],
"pragma-on-top": ["error"],
"security/enforce-explicit-visibility": ["error"],
"error-reason": ["error"]
}
}
83 changes: 83 additions & 0 deletions templates/experimental/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Open Enterprise DEV template

The Open Enterprise template includes the collection of Aragon apps that enable organizations to curate issues, collectively budget, and design custom reward and bounty programs.

## Usage

Create a new token for the Open Enterprise entity:

```
template.newToken(name, symbol)
```

- `name`: Name for the token used in the organization
- `symbol`: Symbol for the token used in the organization

Create a new Open Enterprise entity:

```
template.newInstance(name, members, votingSettings, financePeriod, useAgentAsVault)
```

- `id`: Id for org, will assign `[id].aragonid.eth`
- `members`: Array of member addresses (1 token will be minted for each member)
- `votingSettings`: Array of `[supportRequired, minAcceptanceQuorum, voteDuration]` to set up the voting app of the organization
- `financePeriod`: Initial duration for accounting periods, it can be set to zero in order to use the default of 30 days.
- `useAgentAsVault`: Use an Agent app as a more advanced form of Vault app

Alternatively, create a new Open Enterprise entity with a Payroll app:

```
template.newInstance(name, members, votingSettings, financePeriod, useAgentAsVault, payrollSettings)
```

- `payrollSettings`: Array of `[address denominationToken , IFeed priceFeed, uint64 rateExpiryTime, address employeeManager (set to voting if 0x0)]` for the Payroll app

## Deploying templates

After deploying ENS, APM and AragonID, just run:

```
npm run deploy:rinkeby
```

The network details will be automatically selected by the `arapp.json`'s environments.

## Permissions

| App | Permission | Grantee | Manager |
|-------------------|-----------------------|---------------|---------|
| Kernel | APP_MANAGER | Voting | Voting |
| ACL | CREATE_PERMISSIONS | Voting | Voting |
| EVMScriptRegistry | REGISTRY_MANAGER | Voting | Voting |
| EVMScriptRegistry | REGISTRY_ADD_EXECUTOR | Voting | Voting |
| Voting | CREATE_VOTES | Token Manager | Voting |
| Voting | MODIFY_QUORUM | Voting | Voting |
| Voting | MODIFY_SUPPORT | Voting | Voting |
| Agent or Vault | TRANSFER | Finance | Voting |
| Finance | CREATE_PAYMENTS | Voting | Voting |
| Finance | EXECUTE_PAYMENTS | Voting | Voting |
| Finance | MANAGE_PAYMENTS | Voting | Voting |
| Token Manager | MINT | Voting | Voting |
| Token Manager | BURN | Voting | Voting |

### Additional permissions if the Agent app is installed

| App | Permission | Grantee | Manager |
|-------------------|-----------------------|---------------|---------|
| Agent | RUN_SCRIPT | Voting | Voting |
| Agent | EXECUTE | Voting | Voting |

### Additional permissions if the Payroll app is installed

| App | Permission | Grantee | Manager |
|---------------------|----------------------------|---------------------|---------------|
| Finance | CREATE_PAYMENTS | Payroll | Voting |
| Payroll | ADD_BONUS_ROLE | EOA or Voting | Voting |
| Payroll | ADD_EMPLOYEE_ROLE | EOA or Voting | Voting |
| Payroll | ADD_REIMBURSEMENT_ROLE | EOA or Voting | Voting |
| Payroll | TERMINATE_EMPLOYEE_ROLE | EOA or Voting | Voting |
| Payroll | SET_EMPLOYEE_SALARY_ROLE | EOA or voting | Voting |
| Payroll | MODIFY_PRICE_FEED_ROLE | Voting | Voting |
| Payroll | MODIFY_RATE_EXPIRY_ROLE | Voting | Voting |
| Payroll | MANAGE_ALLOWED_TOKENS_ROLE | Voting | Voting |
22 changes: 22 additions & 0 deletions templates/experimental/arapp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"environments": {
"default": {
"appName": "open-enterprise-template.aragonpm.eth",
"network": "rpc",
"registry": "0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1"
},
"dev": {
"appName": "oe-dev-template.aragonpm.eth",
"network": "rpc",
"registry": "0x5f6f7e8cc7346a11ca2def8f827b7a0b612c56a1"
},
"rinkeby": {
"appName": "open-enterprise-template-experimental.open.aragonpm.eth",
"network": "rpc",
"registry": "0x98Df287B6C145399Aaa709692c8D308357bC085D",
"wsRPC": "wss://rinkeby.eth.aragon.network/ws"
}
},
"roles": [],
"path": "contracts/DevTemplate.sol"
}
140 changes: 140 additions & 0 deletions templates/experimental/contracts/BaseCache.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
pragma solidity 0.4.24;

import "./BaseTemplate.sol";
import { DotVoting } from "@autarklabs/apps-dot-voting/contracts/DotVoting.sol";


contract BaseCache is BaseTemplate {
// string constant private ERROR_MISSING_BASE_CACHE = "TEMPLATE_MISSING_BASE_CACHE";

struct InstalledBase {
ACL acl;
Kernel dao;
Vault vault;
}

struct InstalledTokens {
MiniMeToken token1;
MiniMeToken token2;
}

struct InstalledTokenManagers {
TokenManager tokenManager1;
TokenManager tokenManager2;
WhitelistOracle whitelist;
}

struct InstalledVotingApps {
DotVoting dotVoting;
Voting voting;
bool secondaryDot;
bool secondaryVoting;
}

mapping (address => InstalledBase) internal baseCache;
mapping (address => InstalledTokens) internal tokensCache;
mapping (address => InstalledTokenManagers) internal tokenManagersCache;
mapping (address => InstalledVotingApps) internal votingAppsCache;

constructor(address[5] _deployedSetupContracts)
BaseTemplate(
DAOFactory(_deployedSetupContracts[0]),
ENS(_deployedSetupContracts[1]),
MiniMeTokenFactory(_deployedSetupContracts[2]),
IFIFSResolvingRegistrar(_deployedSetupContracts[3])
) public {}

function _cacheBase(
ACL _acl,
Kernel _dao,
Vault _vault,
address _owner
) internal
{
InstalledBase storage baseInstance = baseCache[_owner];
baseInstance.acl = _acl;
baseInstance.dao = _dao;
baseInstance.vault = _vault;
}

function _cacheTokens(
MiniMeToken _token1,
MiniMeToken _token2,
address _owner
) internal
{
InstalledTokens storage tokensInstance = tokensCache[_owner];
tokensInstance.token1 = _token1;
tokensInstance.token2 = _token2;
}

function _cacheTokenManagers(
TokenManager _tokenManager1,
TokenManager _tokenManager2,
WhitelistOracle _whitelist,
address _owner
) internal
{
InstalledTokenManagers storage tokenManagersInstance = tokenManagersCache[_owner];
tokenManagersInstance.tokenManager1 = _tokenManager1;
tokenManagersInstance.tokenManager2 = _tokenManager2;
tokenManagersInstance.whitelist = _whitelist;
}

function _cacheVotingApps(
DotVoting _dotVoting,
Voting _voting,
bool _secondaryDot,
bool _secondaryVoting,
address _owner
) internal
{
InstalledVotingApps storage votingAppsInstance = votingAppsCache[_owner];
votingAppsInstance.dotVoting = _dotVoting;
votingAppsInstance.voting = _voting;
votingAppsInstance.secondaryDot = _secondaryDot;
votingAppsInstance.secondaryVoting = _secondaryVoting;
}

function _popBaseCache(address _owner) internal returns (ACL, Kernel, Vault) {
// require(baseCache[_owner] != address(0), ERROR_MISSING_BASE_CACHE);

InstalledBase storage baseInstance = baseCache[_owner];
ACL acl = baseInstance.acl;
Kernel dao = baseInstance.dao;
Vault vault = baseInstance.vault;

delete baseCache[_owner];
return (acl, dao, vault);
}

function _popTokensCache(address _owner) internal returns (MiniMeToken, MiniMeToken) {
InstalledTokens storage tokensInstance = tokensCache[_owner];
MiniMeToken token1 = tokensInstance.token1;
MiniMeToken token2 = tokensInstance.token2;

delete tokensCache[_owner];
return (token1, token2);
}

function _popTokenManagersCache(address _owner) internal returns (TokenManager, TokenManager, WhitelistOracle) {
InstalledTokenManagers storage tokenManagersInstance = tokenManagersCache[_owner];
TokenManager tokenManager1 = tokenManagersInstance.tokenManager1;
TokenManager tokenManager2 = tokenManagersInstance.tokenManager2;
WhitelistOracle whitelist = tokenManagersInstance.whitelist;

delete tokenManagersCache[_owner];
return (tokenManager1, tokenManager2, whitelist);
}

function _popVotingAppsCache(address _owner) internal returns (DotVoting, Voting, bool, bool) {
InstalledVotingApps storage votingAppsInstance = votingAppsCache[_owner];
DotVoting dotVoting = votingAppsInstance.dotVoting;
Voting voting = votingAppsInstance.voting;
bool secondaryDot = votingAppsInstance.secondaryDot;
bool secondaryVoting = votingAppsInstance.secondaryVoting;

delete votingAppsCache[_owner];
return (dotVoting, voting, secondaryDot, secondaryVoting);
}
}
Loading