Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 43ce8f7
Showing
27 changed files
with
2,168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.embark/ | ||
node_modules/ | ||
dist/ | ||
config/production/password | ||
config/livenet/password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Status Meritocracy | ||
|
||
The Status Meritocracy allows `Contributors` to show their appreciation of other `Contributors` efforts in Status. | ||
|
||
### Summary | ||
|
||
The Status Meritocracy is a SNT Reward System that allows a `Contributor` in the registry to award allocated SNT, along with praise, to other `Contributors`. | ||
|
||
The DApp will also display a leaderboard of `Contributors` who have been awarded the most and have partcipated the most in the Meritocracy, along with their praise | ||
|
||
### Roles | ||
#### Contributor | ||
Abilities: | ||
- can send SNT to the Meritocracy contract, which is allocated evenly over `Contributors` | ||
- can `award` allocated SNT to `Contributors` | ||
- can withdraw SNT awarded to them, only when they have awarded all their allocatable SNT (or it has been forfeited by `Admins`) | ||
|
||
#### Admin | ||
Abilities: | ||
- add/remove `Contributors` | ||
- set upper limit of `Contributor` `registry` | ||
- forfeit all `Contributors` allocatable SNT, can only be called once a week at maximum. | ||
|
||
#### Owner | ||
Abilities: | ||
- is Admin | ||
- can add/remove `Admins`, | ||
- can changeOwner | ||
- can change ERC20Token contract address | ||
- can recover funds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import EmbarkJS from 'Embark/EmbarkJS'; | ||
import Meritocracy from 'Embark/contracts/Meritocracy'; | ||
import React from 'react'; | ||
import { Form, FormGroup, FormControl, HelpBlock, Button } from 'react-bootstrap'; | ||
|
||
class Blockchain extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
valueSet: 10, | ||
valueGet: "", | ||
logs: [] | ||
} | ||
} | ||
|
||
handleChange(e) { | ||
this.setState({ valueSet: e.target.value }); | ||
} | ||
|
||
checkEnter(e, func) { | ||
if (e.key !== 'Enter') { | ||
return; | ||
} | ||
e.preventDefault(); | ||
func.apply(this, [e]); | ||
} | ||
|
||
setValue(e) { | ||
e.preventDefault(); | ||
|
||
var value = parseInt(this.state.valueSet, 10); | ||
|
||
SimpleStorage.methods.set(value).send(); | ||
this._addToLog("SimpleStorage.methods.set(value).send()"); | ||
} | ||
|
||
getValue(e) { | ||
e.preventDefault(); | ||
|
||
SimpleStorage.methods.get().call().then(_value => this.setState({ valueGet: _value })); | ||
this._addToLog("SimpleStorage.methods.get(console.log)"); | ||
} | ||
|
||
_addToLog(txt) { | ||
this.state.logs.push(txt); | ||
this.setState({ logs: this.state.logs }); | ||
} | ||
|
||
render() { | ||
return (<React.Fragment> | ||
<h3> 1. Set the value in the blockchain</h3> | ||
<Form inline onKeyDown={(e) => this.checkEnter(e, this.setValue)}> | ||
<FormGroup> | ||
<FormControl | ||
type="text" | ||
defaultValue={this.state.valueSet} | ||
onChange={(e) => this.handleChange(e)}/> | ||
<Button bsStyle="primary" onClick={(e) => this.setValue(e)}>Set Value</Button> | ||
<HelpBlock>Once you set the value, the transaction will need to be mined and then the value will be updated | ||
on the blockchain.</HelpBlock> | ||
</FormGroup> | ||
</Form> | ||
|
||
<h3> 2. Get the current value</h3> | ||
<Form inline> | ||
<FormGroup> | ||
<HelpBlock>current value is <span className="value">{this.state.valueGet}</span></HelpBlock> | ||
<Button bsStyle="primary" onClick={(e) => this.getValue(e)}>Get Value</Button> | ||
<HelpBlock>Click the button to get the current value. The initial value is 100.</HelpBlock> | ||
</FormGroup> | ||
</Form> | ||
|
||
<h3> 3. Contract Calls </h3> | ||
<p>Javascript calls being made: </p> | ||
<div className="logs"> | ||
{ | ||
this.state.logs.map((item, i) => <p key={i}>{item}</p>) | ||
} | ||
</div> | ||
</React.Fragment> | ||
); | ||
} | ||
} | ||
|
||
export default Blockchain; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
div { | ||
margin: 15px; | ||
} | ||
|
||
.logs { | ||
background-color: black; | ||
font-size: 14px; | ||
color: white; | ||
font-weight: bold; | ||
padding: 10px; | ||
border-radius: 8px; | ||
} | ||
|
||
.tab-content { | ||
border-left: 1px solid #ddd; | ||
border-right: 1px solid #ddd; | ||
border-bottom: 1px solid #ddd; | ||
padding: 10px; | ||
margin: 0px; | ||
} | ||
|
||
.nav-tabs { | ||
margin-bottom: 0; | ||
} | ||
|
||
.status-offline { | ||
vertical-align: middle; | ||
margin-left: 5px; | ||
margin-top: 4px; | ||
width: 12px; | ||
height: 12px; | ||
background: red; | ||
-moz-border-radius: 10px; | ||
-webkit-border-radius: 10px; | ||
border-radius: 10px; | ||
} | ||
|
||
.status-online { | ||
vertical-align: middle; | ||
margin-left: 5px; | ||
margin-top: 4px; | ||
width: 12px; | ||
height: 12px; | ||
background: mediumseagreen; | ||
-moz-border-radius: 10px; | ||
-webkit-border-radius: 10px; | ||
border-radius: 10px; | ||
} | ||
|
||
input.form-control { | ||
margin-right: 5px; | ||
} | ||
|
||
.alert-result { | ||
margin-left: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import {Tabs, Tab} from 'react-bootstrap'; | ||
|
||
import EmbarkJS from 'Embark/EmbarkJS'; | ||
import Blockchain from './components/blockchain'; | ||
|
||
import './dapp.css'; | ||
|
||
class App extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.handleSelect = this.handleSelect.bind(this); | ||
|
||
this.state = { | ||
error: null, | ||
activeKey: 1, | ||
whisperEnabled: false, | ||
storageEnabled: false, | ||
blockchainEnabled: false | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
EmbarkJS.onReady((err) => { | ||
this.setState({blockchainEnabled: true}); | ||
if (err) { | ||
// If err is not null then it means something went wrong connecting to ethereum | ||
// you can use this to ask the user to enable metamask for e.g | ||
return this.setState({error: err.message || err}); | ||
} | ||
|
||
EmbarkJS.Messages.Providers.whisper.getWhisperVersion((err, _version) => { | ||
if (err) { | ||
return console.log(err); | ||
} | ||
this.setState({whisperEnabled: true}); | ||
}); | ||
|
||
EmbarkJS.Storage.isAvailable().then((result) => { | ||
this.setState({storageEnabled: result}); | ||
}).catch(() => { | ||
this.setState({storageEnabled: false}); | ||
}); | ||
}); | ||
} | ||
|
||
_renderStatus(title, available) { | ||
let className = available ? 'pull-right status-online' : 'pull-right status-offline'; | ||
return <React.Fragment> | ||
{title} | ||
<span className={className}></span> | ||
</React.Fragment>; | ||
} | ||
|
||
handleSelect(key) { | ||
this.setState({ activeKey: key }); | ||
} | ||
|
||
render() { | ||
const ensEnabled = EmbarkJS.Names.currentNameSystems && EmbarkJS.Names.isAvailable(); | ||
if (this.state.error) { | ||
return (<div> | ||
<div>Something went wrong connecting to ethereum. Please make sure you have a node running or are using metamask to connect to the ethereum network:</div> | ||
<div>{this.state.error}</div> | ||
</div>); | ||
} | ||
return (<div> | ||
<h3>Embark - Usage Example</h3> | ||
<Tabs onSelect={this.handleSelect} activeKey={this.state.activeKey} id="uncontrolled-tab-example"> | ||
<Tab eventKey={1} title={this._renderStatus('Blockchain', this.state.blockchainEnabled)}> | ||
<Blockchain/> | ||
</Tab> | ||
<Tab eventKey={2} title={this._renderStatus('Decentralized Storage', this.state.storageEnabled)}> | ||
<Storage enabled={this.state.storageEnabled}/> | ||
</Tab> | ||
<Tab eventKey={3} title={this._renderStatus('P2P communication (Whisper)', this.state.whisperEnabled)}> | ||
<Whisper enabled={this.state.whisperEnabled}/> | ||
</Tab> | ||
<Tab eventKey={4} title={this._renderStatus('Naming (ENS)', ensEnabled)}> | ||
<ENS enabled={ensEnabled}/> | ||
</Tab> | ||
</Tabs> | ||
</div>); | ||
} | ||
} | ||
|
||
ReactDOM.render(<App></App>, document.getElementById('app')); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html> | ||
<head> | ||
<title>Embark - SimpleStorage Demo</title> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | ||
</head> | ||
<body class="container"> | ||
<div id="app"> | ||
</div> | ||
<script src="js/dapp.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"0x0399343ea5cbf9b93edc98e29ddf86d385c0997b8378ee60afc11cd14484edfb": { | ||
"contracts": { | ||
"0xb84d125645e94e6329e6494db63830d1c68a719c328036dce55337f79a512e27": { | ||
"name": "SimpleStorage", | ||
"address": "0x0139F5bD92760b0535A3BF503ff20755B56120Fe" | ||
}, | ||
"0x3043b04ad856d169c8f0b0509c0bc63192dc7edd92d6933c58708298a0e381be": { | ||
"name": "ENSRegistry", | ||
"address": "0x56c916c5229e7fc0dcc2b8dffa50A0BB7C1803D0" | ||
}, | ||
"0x4b412c3f4bab69e90e9938e89bf0b74320f421fc0725592bf465068b26201402": { | ||
"name": "Resolver", | ||
"address": "0x545CFAC6f642b8752BE942a8f4e6cD41fFd3AeEe" | ||
}, | ||
"0xe6d2b6a71cbbd055e47b30467a9d898344c3fad1485e895eded0244453841cfe": { | ||
"name": "FIFSRegistrar", | ||
"address": "0x988E079CC0D04Ed01c2c5dDca09B25DDD1F4aFE4" | ||
}, | ||
"0xc920172104d0372dfa1375d4c9ef05ae15569b94b88fd4b0d5a834965dc7420b": { | ||
"name": "SimpleStorage", | ||
"address": "0x38a6Bb08E64c2EceB89aC0d0635bD543AD4e60B8" | ||
}, | ||
"0xfb4295b67b9ca6e0992ff331dbd64c98b6cdb4bd896e033995691356b504077c": { | ||
"name": "ERC20Receiver", | ||
"address": "0xd3C99B684b4ff3E9eC0eEb8AC046Dfe1e1b309a4" | ||
}, | ||
"0x6ef111d7ff114790dccb0eb991ffc66c0717516aa3cebfd356736581b75b0402": { | ||
"name": "MiniMeTokenFactory", | ||
"address": "0x5022174e5cC5264FBD67BC3AB055ab6109158D62" | ||
} | ||
} | ||
}, | ||
"0xc855132a1ab94dc31b77189ca76fe861dede5013d46445d9b5ad8a6da5ffb508": { | ||
"contracts": { | ||
"0xfb4295b67b9ca6e0992ff331dbd64c98b6cdb4bd896e033995691356b504077c": { | ||
"name": "ERC20Receiver", | ||
"address": "0x44bbA839B4b9B4f80Bfe016E9f9BAF7e3266c48b" | ||
}, | ||
"0x6ef111d7ff114790dccb0eb991ffc66c0717516aa3cebfd356736581b75b0402": { | ||
"name": "MiniMeTokenFactory", | ||
"address": "0x4D155a4c68196092907E6C1CD06F08D4F8D0A4e4" | ||
}, | ||
"0xc6744ff8ae4483600e95a4f52780424cbf1719b99009b3ed3397c42ab683350d": { | ||
"name": "SNT", | ||
"address": "0x32dbB8258C4F19c72770C8f926d169e0Dff656f7" | ||
}, | ||
"0xfd7ba1d8638b477661cbd597414b0b4a5b6e277d2fc2947e08e417fc2453becb": { | ||
"name": "Meritocracy", | ||
"address": "0x868C59B9FF6361Fe66d47a907BbF670F86efE455" | ||
}, | ||
"0x91a7635ace87d0dd04a63f8cd62203bd1da3258132f899dcc9e26ab3012f616d": { | ||
"name": "Meritocracy", | ||
"address": "0x82F6d95A2CbbaCe7CE7BD37e036443276Cc1c3A3" | ||
} | ||
} | ||
}, | ||
"0x9ed7a625c779501885ef8376379ed5492745c30cfcd919bed3cc3cc4e01d522f": { | ||
"contracts": { | ||
"0xfb4295b67b9ca6e0992ff331dbd64c98b6cdb4bd896e033995691356b504077c": { | ||
"name": "ERC20Receiver", | ||
"address": "0x135d5ec78e34F71451594a5755513fA440A361DB" | ||
}, | ||
"0x6ef111d7ff114790dccb0eb991ffc66c0717516aa3cebfd356736581b75b0402": { | ||
"name": "MiniMeTokenFactory", | ||
"address": "0x000F6f673b33Be7d4Ce7256654205C7482686fBf" | ||
}, | ||
"0x7a531eedff91102db0ffd706a0021b770fba77517d5ab6cc4ae19c6d22c287e7": { | ||
"name": "SNT", | ||
"address": "0x97b991b76Eb93D52808715C52F5bF0a6EA81167B" | ||
}, | ||
"0x380d1fdd01cac4effd59d4a2b82246f9971f65ce4b0abbd0c8158a84375cc36a": { | ||
"name": "Meritocracy", | ||
"address": "0x755f52Afe8166011B978aE142465c25b9D3F9ab3" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.