Skip to content
Snippets Groups Projects

Distillery

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