Revert "load data from ethereum contract"
This reverts commit 26ae9b033f.
This commit is contained in:
@@ -11,4 +11,15 @@ export default Ember.Controller.extend({
|
||||
|
||||
kredits: service(),
|
||||
|
||||
contributorsCount: computed('model.contributors.[]', function() {
|
||||
return this.get('model.contributors').length;
|
||||
}),
|
||||
|
||||
kreditsSum: computed('model.contributors.[]', function() {
|
||||
let kredits = this.get('model.contributors').mapBy('kredits');
|
||||
return kredits.reduce(function(previousValue, currentValue) {
|
||||
return currentValue + previousValue;
|
||||
});
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
+1
-3
@@ -15,11 +15,9 @@ let fixtures = [
|
||||
|
||||
export default Ember.Route.extend({
|
||||
|
||||
kredits: Ember.inject.service(),
|
||||
|
||||
model() {
|
||||
let contributors = [];
|
||||
this.get('kredits.contributors').forEach(obj => {
|
||||
fixtures.forEach(obj => {
|
||||
contributors.pushObject(Contributor.create(obj));
|
||||
});
|
||||
|
||||
|
||||
+1
-20
@@ -23,6 +23,7 @@ export default Ember.Service.extend({
|
||||
}
|
||||
|
||||
this.set('web3Instance', web3Instance);
|
||||
|
||||
return web3Instance;
|
||||
}.property('web3Instance'),
|
||||
|
||||
@@ -38,26 +39,6 @@ export default Ember.Service.extend({
|
||||
return this.get('kreditsContract').totalSupply();
|
||||
}.property('kreditsContract'),
|
||||
|
||||
contributorsCount: function() {
|
||||
return this.get('kreditsContract').contributorCount();
|
||||
}.property('kreditsContract'),
|
||||
|
||||
contributors: function() {
|
||||
var c = [];
|
||||
for(var i = 0; i < this.get('contributorsCount').toNumber(); i++) {
|
||||
var address = this.get('kreditsContract').contributorAddresses(i);
|
||||
var person = this.get('kreditsContract').contributors(address);
|
||||
var balance = this.get('kreditsContract').balanceOf(address);
|
||||
console.log(person);
|
||||
c.push({address: address, name: person[0], github_username: person[1], github_uid: person[2], ipfsHash: person[3], kredits: balance.toNumber()});
|
||||
};
|
||||
return c;
|
||||
}.property('kreditsContract', 'contributorCount'),
|
||||
|
||||
balanceOf: function(address) {
|
||||
return this.get('kreditsContract').balanceOf(address).toNumber();
|
||||
}.property('kreditsContract'),
|
||||
|
||||
logKreditsContract: function() {
|
||||
Ember.Logger.debug('kreditsContract', this.get('kreditsContract'));
|
||||
}.on('init')
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<p class="stats">
|
||||
<span class="number">{{kredits.totalSupply}}</span> kredits issued and distributed among
|
||||
<span class="number">{{kredits.contributorsCount}}</span> contributors.
|
||||
<span class="number">{{contributorsCount}}</span> contributors.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -24,12 +24,12 @@ module.exports = function(environment) {
|
||||
},
|
||||
|
||||
kreditsContract: {
|
||||
ABI: contracts['Kredits'].abi
|
||||
ABI: contracts['Kredits']
|
||||
}
|
||||
};
|
||||
|
||||
if (environment === 'development') {
|
||||
ENV.kreditsContract.address = '0xa624dc6c2539eed38273f03fc7c9fe05bfaddf66';
|
||||
ENV.kreditsContract.address = 'abcdef123456';
|
||||
// ENV.APP.LOG_RESOLVER = true;
|
||||
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||
// ENV.APP.LOG_TRANSITIONS = true;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user