init vault app

This commit is contained in:
haythem 2019-06-26 17:36:11 +01:00
parent d653b3715f
commit 22021f2d46
13 changed files with 249 additions and 0 deletions

7
apps/vault/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
# Dependencies
node_modules
# Build dirs
.cache/
build/
dist/

0
apps/vault/.ipfsignore Normal file
View File

31
apps/vault/README.md Normal file
View File

@ -0,0 +1,31 @@
# Aragon Bare Boilerplate
> 🕵️ [Find more boilerplates using GitHub](https://github.com/search?q=topic:aragon-boilerplate) |
> ✨ [Official boilerplates](https://github.com/search?q=topic:aragon-boilerplate+org:aragon)
Bare boilerplate for Aragon applications.
This boilerplate *only* includes the contract interfaces and `@aragon/client`, along with the two required application manifests: `manifest.json` and `arapp.json`.
This boilerplate is ideal for building applications that do not use React
## Usage
```sh
aragon init foo.aragonpm.test bare
```
## What's in the box?
### npm Scripts
- **test**: Runs your Truffle tests
- **build**: Compiles your contracts
- **start**: Runs your app locally
- **deploy**: Deploys your app smart contract to a local chain
- **publish**: Publishes a new version of your app
### Libraries
- [**@aragon/os**](https://github.com/aragon/aragonOS): Aragon interfaces
- [**@aragon/client**](https://github.com/aragon/aragon.js/tree/master/packages/aragon-client): Wrapper for Aragon application RPC

View File

@ -0,0 +1,6 @@
<!doctype>
<html>
<body>
<h1>Hello world!</h1>
</body>
</html>

18
apps/vault/app/script.js Normal file
View File

@ -0,0 +1,18 @@
import Aragon from '@aragon/client'
const app = new Aragon()
const initialState = {
dummyValue: 0
}
app.store((state, event) => {
if (state === null) state = initialState
switch (event.event) {
case 'DummyEvent':
return { dummyValue: 1 }
default:
return state
}
})

28
apps/vault/arapp.json Normal file
View File

@ -0,0 +1,28 @@
{
"roles": [
{
"name": "Dummy role",
"id": "DUMMY_ROLE",
"params": []
}
],
"environments": {
"default": {
"network": "development",
"appName": "kredits-vault.open.aragonpm.eth"
},
"rinkeby": {
"registry": "0x98df287b6c145399aaa709692c8d308357bc085d",
"appName": "kredits-vault.open.aragonpm.eth",
"wsRPC": "wss://rinkeby.eth.aragon.network/ws",
"network": "rinkeby"
},
"mainnet": {
"registry": "0x314159265dd8dbb310642f98f50c066173c1259b",
"appName": "kredits-vault.open.aragonpm.eth",
"wsRPC": "wss://mainnet.eth.aragon.network/ws",
"network": "mainnet"
}
},
"path": "contracts/App.sol"
}

View File

@ -0,0 +1,26 @@
pragma solidity ^0.4.24;
import "@aragon/os/contracts/apps/AragonApp.sol";
contract App is AragonApp {
////
//// ....
//// .,,,,..,,,,.
//// ..,,.. .. .,,,..
//// .,,. ..,:....,,.. .,,.
//// ,: ...,. .,,..,. :,
//// .:. ,. , ,.. .:.
//// ,:,. .. .,,., :,
//// ,;. ........,..,..:,
//// ,:. .. .....:,
//// .:, .::.
//// .,,. .,,.
//// .,,,..,,,.
//// ....
////
//// Build something beautiful.
function initialize() public onlyInit {
initialized();
}
}

View File

@ -0,0 +1,23 @@
pragma solidity ^0.4.4;
contract Migrations {
address public owner;
uint public last_completed_migration;
modifier restricted() {
if (msg.sender == owner) _;
}
function Migrations() {
owner = msg.sender;
}
function setCompleted(uint completed) restricted {
last_completed_migration = completed;
}
function upgrade(address new_address) restricted {
Migrations upgraded = Migrations(new_address);
upgraded.setCompleted(last_completed_migration);
}
}

10
apps/vault/manifest.json Normal file
View File

@ -0,0 +1,10 @@
{
"name": "Application",
"description": "An application for Aragon",
"icons": [{
"src": "/dist/images/icon.png",
"sizes": "192x192"
}],
"start_url": "/dist/index.html",
"script": "/dist/script.js"
}

View File

@ -0,0 +1,5 @@
var Migrations = artifacts.require('./Migrations.sol')
module.exports = function (deployer) {
deployer.deploy(Migrations)
}

View File

@ -0,0 +1,5 @@
var App = artifacts.require('./App.sol')
module.exports = function (deployer) {
deployer.deploy(App)
}

27
apps/vault/package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "kredits-vault",
"version": "1.0.0",
"description": "",
"dependencies": {
"@aragon/client": "^1.1.0",
"@aragon/os": "^4.0.1"
},
"devDependencies": {
"@aragon/cli": "^5.4.0",
"parcel-bundler": "^1.11.0"
},
"scripts": {
"start": "aragon run",
"test": "aragon contracts test",
"compile": "aragon contracts compile",
"deploy": "aragon deploy",
"build:app": "parcel build app/index.html -d dist/ --public-url \".\" --no-cache",
"build:script": "parcel build app/script.js -d dist/ --no-cache",
"build": "npm run build:app && npm run build:script",
"publish:patch": "aragon apm publish patch",
"publish:minor": "aragon apm publish minor",
"publish:major": "aragon apm publish major",
"versions": "aragon apm versions"
},
"keywords": []
}

63
apps/vault/truffle.js Normal file
View File

@ -0,0 +1,63 @@
/**
* https://github.com/aragon/aragonOS/blob/v4.0.0/truffle-config.js
*/
const homedir = require('homedir')
const path = require('path')
const HDWalletProvider = require('truffle-hdwallet-provider')
const HDWalletProviderPrivkey = require('truffle-hdwallet-provider-privkey')
const DEFAULT_MNEMONIC = 'explain tackle mirror kit van hammer degree position ginger unfair soup bonus'
const defaultRPC = (network) =>
`https://${network}.infura.io`
const configFilePath = (filename) =>
path.join(homedir(), `.aragon/${filename}`)
const mnemonic = () => {
try {
return require(configFilePath('mnemonic.json')).mnemonic
} catch (e) {
return DEFAULT_MNEMONIC
}
}
const settingsForNetwork = (network) => {
try {
return require(configFilePath(`${network}_key.json`))
} catch (e) {
return { }
}
}
// Lazily loaded provider
const providerForNetwork = (network) => (
() => {
let { rpc, keys } = settingsForNetwork(network)
rpc = rpc || defaultRPC(network)
if (!keys || keys.length == 0) {
return new HDWalletProvider(mnemonic(), rpc)
}
return new HDWalletProviderPrivkey(keys, rpc)
}
)
module.exports = {
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*'
},
mainnet: {
network_id: 1,
provider: providerForNetwork('mainnet')
},
rinkeby: {
network_id: 4,
provider: providerForNetwork('rinkeby')
}
}
}