Skip to content

Commit c762af1

Browse files
committed
Added empty counter template app with test harness.
1 parent 9abfde6 commit c762af1

30 files changed

+702
-0
lines changed

.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015", "stage-2", "stage-3"]
3+
}

.eslintignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
app/node_modules
3+
build
4+
.cache
5+
dist
6+
coverage

.eslintrc.json

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"es6": true
5+
},
6+
"extends": [
7+
"standard",
8+
"standard-react",
9+
"prettier",
10+
"prettier/react"
11+
],
12+
"parser": "babel-eslint",
13+
"parserOptions": {
14+
"ecmaVersion": 6,
15+
"ecmaFeatures": {
16+
"jsx": true
17+
},
18+
"sourceType": "module"
19+
},
20+
"plugins": ["prettier", "react"],
21+
"rules": {
22+
"valid-jsdoc": "error",
23+
"react/prop-types": 0,
24+
"prettier/prettier": [
25+
"error",
26+
{
27+
"singleQuote": true,
28+
"semi": false,
29+
"trailingComma": "es5",
30+
"bracketSpacing": true,
31+
"jsxBracketSameLine": false
32+
}
33+
],
34+
"linebreak-style": ["error", "unix"]
35+
}
36+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sol linguist-language=Solidity

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
build
3+
.cache
4+
dist
5+
ipfs.cmd
6+
package-lock.json
7+
coverage.json
8+
coverage

.ipfsignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Git files
2+
.gitignore
3+
4+
# Build files
5+
.cache
6+
node_modules
7+
build
8+
coverage
9+
10+
# Lock files
11+
package-lock.json
12+
yarn.lock
13+
14+
# Others
15+
test

.solcover.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
norpc: true,
3+
copyPackages: [],
4+
skipFiles: [
5+
'test',
6+
]
7+
}

.soliumignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
contracts/Migrations.sol

.soliumrc.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"extends": "solium:all",
3+
"plugins": [
4+
"security"
5+
],
6+
"rules": {
7+
"imports-on-top": ["error"],
8+
"variable-declarations": ["error"],
9+
"array-declarations": ["error"],
10+
"operator-whitespace": ["error"],
11+
"lbrace": ["error"],
12+
"mixedcase": ["warning"],
13+
"camelcase": ["error"],
14+
"uppercase": ["warning"],
15+
"no-empty-blocks": ["error"],
16+
"no-unused-vars": ["error"],
17+
"quotes": ["error"],
18+
"indentation": ["error"],
19+
"whitespace": ["error"],
20+
"deprecated-suicide": ["error"],
21+
"arg-overflow": ["error", 8],
22+
"pragma-on-top": ["error"],
23+
"security/enforce-explicit-visibility": ["error"],
24+
"consequent": 0,
25+
"error-reason": ["warning"],
26+
"function-order": [
27+
"error",
28+
{
29+
"ignore": {
30+
"functions": ["initialize"]
31+
}
32+
}
33+
]
34+
}
35+
}

app/.babelrc

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"modules": false,
7+
"targets": {
8+
"browsers": [
9+
"> 1%",
10+
"last 3 versions",
11+
"ie >= 9",
12+
"ios >= 8",
13+
"android >= 4.2"
14+
]
15+
},
16+
"useBuiltIns": false
17+
}
18+
]
19+
],
20+
"plugins": [
21+
"@babel/plugin-proposal-class-properties",
22+
[
23+
"styled-components",
24+
{
25+
"displayName": true
26+
}
27+
]
28+
]
29+
}

app/index.html

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Aragon App</title>
5+
</head>
6+
<body>
7+
<div id="root"></div>
8+
<script src="src/index.js"></script>
9+
</body>
10+
</html>

app/package.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "delay-frontend",
3+
"version": "1.0.0",
4+
"main": "src/index.js",
5+
"dependencies": {
6+
"@aragon/api": "^2.0.0-beta.4",
7+
"@aragon/api-react": "^2.0.0-beta.4",
8+
"@aragon/ui": "^0.40.1",
9+
"core-js": "^3.1.4",
10+
"react": "^16.8.6",
11+
"react-dom": "^16.8.6",
12+
"regenerator-runtime": "^0.13.2",
13+
"rxjs": "^6.5.2",
14+
"styled-components": "^4.3.2"
15+
},
16+
"devDependencies": {
17+
"@babel/core": "^7.5.4",
18+
"@babel/plugin-proposal-class-properties": "^7.5.0",
19+
"@babel/preset-env": "^7.5.4",
20+
"copyfiles": "^2.1.1",
21+
"parcel-bundler": "^1.12.3"
22+
},
23+
"scripts": {
24+
"build": "npm run sync-assets && npm run build:app && npm run build:script",
25+
"build:app": "parcel build index.html -d ../dist/ --public-url \".\" --no-cache",
26+
"build:script": "parcel build src/script.js --out-dir ../dist/ --no-cache",
27+
"watch:script": "parcel watch src/script.js --out-dir ../dist/ --no-hmr",
28+
"devserver": "parcel serve index.html -p 8001 --out-dir ../dist/ --no-cache",
29+
"start": "npm run sync-assets && npm run build:script -- --no-minify && npm run devserver",
30+
"sync-assets": "copy-aragon-ui-assets ../dist && copyfiles './public/**/*' ../dist"
31+
}
32+
}

app/public/meta/details.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
An application for Aragon.
2+
3+
**Features**
4+
- Feature \#1.
5+
- Feature \#2.
6+
- Feature \#3.

app/public/meta/icon.svg

+1
Loading

app/public/meta/screenshot-1.png

2.24 KB
Loading

app/src/App.js

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React from 'react'
2+
import { useAragonApi } from '@aragon/api-react'
3+
import { Main, Button } from '@aragon/ui'
4+
import styled from 'styled-components'
5+
6+
function App() {
7+
const { api, appState } = useAragonApi()
8+
const { count, syncing } = appState
9+
return (
10+
<Main>
11+
<BaseLayout>
12+
{syncing && <Syncing />}
13+
<Count>Count: {count}</Count>
14+
<Buttons>
15+
<Button mode="secondary" onClick={() => api.decrement(1)}>
16+
Decrement
17+
</Button>
18+
<Button mode="secondary" onClick={() => api.increment(1)}>
19+
Increment
20+
</Button>
21+
</Buttons>
22+
</BaseLayout>
23+
</Main>
24+
)
25+
}
26+
27+
const BaseLayout = styled.div`
28+
display: flex;
29+
align-items: center;
30+
justify-content: center;
31+
height: 100vh;
32+
flex-direction: column;
33+
`
34+
35+
const Count = styled.h1`
36+
font-size: 30px;
37+
`
38+
39+
const Buttons = styled.div`
40+
display: grid;
41+
grid-auto-flow: column;
42+
grid-gap: 40px;
43+
margin-top: 20px;
44+
`
45+
46+
const Syncing = styled.div.attrs({ children: 'Syncing…' })`
47+
position: absolute;
48+
top: 15px;
49+
right: 20px;
50+
`
51+
52+
export default App

app/src/index.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react'
2+
import ReactDOM from 'react-dom'
3+
import { AragonApi } from '@aragon/api-react'
4+
import App from './App'
5+
6+
const reducer = state => {
7+
if (state === null) {
8+
return { count: 0, syncing: true }
9+
}
10+
return state
11+
}
12+
13+
ReactDOM.render(
14+
<AragonApi reducer={reducer}>
15+
<App />
16+
</AragonApi>,
17+
document.getElementById('root')
18+
)

app/src/script.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import 'core-js/stable'
2+
import 'regenerator-runtime/runtime'
3+
import AragonApi from '@aragon/api'
4+
5+
const api = new AragonApi()
6+
7+
const initialState = async (state) => ({
8+
count: await getValue()
9+
})
10+
11+
api.store(
12+
async (state, event) => {
13+
let newState
14+
15+
switch (event.event) {
16+
case 'Increment':
17+
newState = {count: await getValue()}
18+
break
19+
case 'Decrement':
20+
newState = {count: await getValue()}
21+
break
22+
default:
23+
newState = state
24+
}
25+
26+
return newState
27+
},
28+
{
29+
init: initialState
30+
}
31+
)
32+
33+
async function getValue() {
34+
return parseInt(await api.call('value').toPromise(), 10)
35+
}

arapp.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"roles": [
3+
4+
],
5+
"environments": {
6+
"default": {
7+
"network": "development",
8+
"appName": "delay.open.aragonpm.eth"
9+
},
10+
"rinkeby": {
11+
"registry": "0x98df287b6c145399aaa709692c8d308357bc085d",
12+
"appName": "delay.open.aragonpm.eth",
13+
"wsRPC": "wss://rinkeby.eth.aragon.network/ws",
14+
"network": "rinkeby"
15+
},
16+
"mainnet": {
17+
"registry": "0x314159265dd8dbb310642f98f50c066173c1259b",
18+
"appName": "delay.open.aragonpm.eth",
19+
"wsRPC": "wss://mainnet.eth.aragon.network/ws",
20+
"network": "mainnet"
21+
}
22+
},
23+
"path": "contracts/Delay.sol"
24+
}

contracts/Delay.sol

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
pragma solidity ^0.4.24;
2+
3+
import "@aragon/os/contracts/apps/AragonApp.sol";
4+
5+
contract Delay is AragonApp {
6+
7+
function initialize() public onlyInit {
8+
initialized();
9+
}
10+
11+
}

0 commit comments

Comments
 (0)