Skip to content
Snippets Groups Projects

Distillery

Merged Robert Martin-Legene requested to merge distillery into master
2 files
+ 54
33
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 13
1
#!/usr/bin/node
#!/usr/bin/node
 
"use strict"
 
const Libbfa = require( process.env.BFAHOME + '/bin/libbfa.js');
const Libbfa = require( process.env.BFAHOME + '/bin/libbfa.js');
const rl = require('readline').createInterface(
const rl = require('readline').createInterface(
{ input: process.stdin, output: process.stdout }
{ input: process.stdin, output: process.stdout }
@@ -25,6 +27,8 @@ function init()
@@ -25,6 +27,8 @@ function init()
bfa = new Libbfa();
bfa = new Libbfa();
web3 = bfa.newweb3();
web3 = bfa.newweb3();
Distillery = bfa.contract( web3, 'Distillery' );
Distillery = bfa.contract( web3, 'Distillery' );
 
if ( undefined == Distillery )
 
fatal('Can not initialise Distillery contact.');
web3.eth.getBalance( Distillery.contractaddress ).then(
web3.eth.getBalance( Distillery.contractaddress ).then(
function receivedOwnBalance(val) {
function receivedOwnBalance(val) {
Distillery.contractbalance = val;
Distillery.contractbalance = val;
@@ -128,7 +132,7 @@ function editAccount( entry, pallet )
@@ -128,7 +132,7 @@ function editAccount( entry, pallet )
if ( entry == "x" )
if ( entry == "x" )
{
{
// trigger distribution
// trigger distribution
Distillery.methods.distribute().send( {"from": bfa.account, "gas": 1000000 } )
Distillery.methods.distribute().send( {"from": bfa.account, "gas": 4000000 } )
.then(
.then(
function distOK(x) {
function distOK(x) {
console.log(
console.log(
@@ -155,7 +159,15 @@ function editAccount( entry, pallet )
@@ -155,7 +159,15 @@ function editAccount( entry, pallet )
return;
return;
}
}
else
else
 
if ( entry == "" )
 
{
 
// Do nothing, basically just update the display
 
return;
 
}
 
else
 
{
bfa.fatal("I don't know what to do with \""+entry+"\"." );
bfa.fatal("I don't know what to do with \""+entry+"\"." );
 
}
rl.question(
rl.question(
"Adjust the "
"Adjust the "
+ notation[2]
+ notation[2]
Loading