diff --git a/apps/vault/.gitignore b/apps/vault/.gitignore new file mode 100644 index 0000000..c91478f --- /dev/null +++ b/apps/vault/.gitignore @@ -0,0 +1,7 @@ +# Dependencies +node_modules + +# Build dirs +.cache/ +build/ +dist/ diff --git a/apps/vault/.ipfsignore b/apps/vault/.ipfsignore new file mode 100644 index 0000000..e69de29 diff --git a/apps/vault/README.md b/apps/vault/README.md new file mode 100644 index 0000000..7e4c807 --- /dev/null +++ b/apps/vault/README.md @@ -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 diff --git a/apps/vault/app/index.html b/apps/vault/app/index.html new file mode 100644 index 0000000..25afe6d --- /dev/null +++ b/apps/vault/app/index.html @@ -0,0 +1,6 @@ + + + +

Hello world!

+ + diff --git a/apps/vault/app/script.js b/apps/vault/app/script.js new file mode 100644 index 0000000..d5f7bdb --- /dev/null +++ b/apps/vault/app/script.js @@ -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 + } +}) diff --git a/apps/vault/arapp.json b/apps/vault/arapp.json new file mode 100644 index 0000000..ed6e02e --- /dev/null +++ b/apps/vault/arapp.json @@ -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" +} diff --git a/apps/vault/contracts/App.sol b/apps/vault/contracts/App.sol new file mode 100644 index 0000000..8b9e94d --- /dev/null +++ b/apps/vault/contracts/App.sol @@ -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(); + } +} diff --git a/apps/vault/contracts/misc/Migrations.sol b/apps/vault/contracts/misc/Migrations.sol new file mode 100644 index 0000000..7e7fe8d --- /dev/null +++ b/apps/vault/contracts/misc/Migrations.sol @@ -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); + } +} diff --git a/apps/vault/manifest.json b/apps/vault/manifest.json new file mode 100644 index 0000000..cb4062f --- /dev/null +++ b/apps/vault/manifest.json @@ -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" +} diff --git a/apps/vault/migrations/1_initial_migration.js b/apps/vault/migrations/1_initial_migration.js new file mode 100644 index 0000000..4296895 --- /dev/null +++ b/apps/vault/migrations/1_initial_migration.js @@ -0,0 +1,5 @@ +var Migrations = artifacts.require('./Migrations.sol') + +module.exports = function (deployer) { + deployer.deploy(Migrations) +} diff --git a/apps/vault/migrations/2_deploy_contracts.js b/apps/vault/migrations/2_deploy_contracts.js new file mode 100644 index 0000000..a7eac7b --- /dev/null +++ b/apps/vault/migrations/2_deploy_contracts.js @@ -0,0 +1,5 @@ +var App = artifacts.require('./App.sol') + +module.exports = function (deployer) { + deployer.deploy(App) +} diff --git a/apps/vault/package.json b/apps/vault/package.json new file mode 100644 index 0000000..d733e82 --- /dev/null +++ b/apps/vault/package.json @@ -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": [] +} diff --git a/apps/vault/truffle.js b/apps/vault/truffle.js new file mode 100644 index 0000000..328d757 --- /dev/null +++ b/apps/vault/truffle.js @@ -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') + } + } +}