Add some contract logic

This commit is contained in:
2017-02-02 18:13:06 +08:00
parent 5f108557cc
commit 1771a63dfe
3 changed files with 19 additions and 10 deletions
+12 -6
View File
@@ -1,5 +1,6 @@
import Ember from 'ember';
import Web3 from 'npm:web3';
import config from 'kredits-web/config/environment';
export default Ember.Service.extend({
@@ -26,15 +27,20 @@ export default Ember.Service.extend({
return web3Instance;
}.property('web3Instance'),
contract: function() {
// let web3 = this.get('web3');
let contract = null;
kreditsContract: function() {
// TODO cache this
let contract = this.get('web3')
.eth.contract(config.kreditsContract.ABI)
.at(config.kreditsContract.address);
return contract;
}.property('web3'),
totalSupply: function() {
return 23000;
}.property()
return this.get('kreditsContract').totalSupply();
}.property('kreditsContract'),
logKreditsContract: function() {
Ember.Logger.debug('kreditsContract', this.get('kreditsContract'));
}.on('init')
});