Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blockchain
nucleo
Commits
38d4c753
Commit
38d4c753
authored
5 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Mejorando distiliera1
parent
c57e6963
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/MasterDistiller.js
+25
-6
25 additions, 6 deletions
bin/MasterDistiller.js
with
25 additions
and
6 deletions
bin/MasterDistiller.js
+
25
−
6
View file @
38d4c753
...
...
@@ -30,12 +30,13 @@ function init()
if
(
table
[
i
]
==
notation
.
potency
)
notation
.
name
=
table
[
i
+
1
]
if
(
undefined
==
notation
.
name
)
notation
=
{
'
potency
'
:
15
,
'
name
'
:
'
finney
'
};
notation
.
num
=
BigNumber
(
10
).
pow
(
notation
.
potency
);
notation
=
{
'
potency
'
:
15
,
'
name
'
:
'
finney
'
};
notation
.
num
=
BigNumber
(
10
).
pow
(
notation
.
potency
);
bfa
=
new
Libbfa
();
web3
=
bfa
.
newweb3
();
Distillery
=
bfa
.
contract
(
web3
,
'
Distillery
'
);
requestBalances
();
requestDistBalance
()
.
then
(
requestBalances
)
}
function
palletSort
(
a
,
b
)
...
...
@@ -58,13 +59,17 @@ function palletSort(a,b)
return
0
;
}
async
function
requestDistBalance
()
{
return
web3
.
eth
.
getBalance
(
Distillery
.
contractaddress
)
.
then
(
(
bal
)
=>
{
return
Distillery
.
contractbalance
=
new
BigNumber
(
bal
)
}
)
}
async
function
requestBalances
()
{
var
distbal
=
await
web3
.
eth
.
getBalance
(
Distillery
.
contractaddress
);
var
count
=
await
Distillery
.
methods
.
numberOfBeneficiaries
().
call
();
var
pallet
=
new
Array
;
var
i
;
Distillery
.
contractbalance
=
new
BigNumber
(
distbal
);
// Fetch addresses from the list in the contract.
for
(
i
=
0
;
i
<
count
;
i
++
)
{
...
...
@@ -126,7 +131,21 @@ function editAccount( entry, pallet )
+
rcpt
.
gasUsed
+
"
gas.
"
);
requestBalances
();
var
beforeBal
=
Distillery
.
contractbalance
;
requestDistBalance
()
.
then
(
function
()
{
console
.
log
(
"
Distributed
"
+
beforeBal
.
minus
(
Distillery
.
contractbalance
).
div
(
notation
.
num
).
toFixed
()
+
"
"
+
notation
.
name
+
"
.
"
);
requestBalances
();
}
)
}
}
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment