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
cab694f9
Commit
cab694f9
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Contract support moving into libbfa.sh
parent
015f88a3
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/libbfa.sh
+45
-3
45 additions, 3 deletions
bin/libbfa.sh
with
45 additions
and
3 deletions
bin/libbfa.sh
+
45
−
3
View file @
cab694f9
...
@@ -35,19 +35,28 @@ function cleanup
...
@@ -35,19 +35,28 @@ function cleanup
function
geth_attach
function
geth_attach
{
{
bfaconfig node
bfaconfig node
geth
--cache
0
"
$@
"
attach ipc:
${
BFANODEDIR
}
/geth.ipc
local cat
=
cat
if
echo
$-
|
grep
-q
x
then
cat
=
"tee /dev/tty |"
fi
$cat
| geth
--cache
0
"
$@
"
attach ipc:
${
BFANODEDIR
}
/geth.ipc
}
}
function
geth_exec_js
function
geth_exec_js
{
{
test
-r
"
$1
"
test
-r
"
$1
"
geth_attach
--exec
"loadScript(
\"
$1
\"
)"
if
echo
$-
|
grep
-q
x
then
sed
"s//input: /"
"
$1
"
fi
geth_attach
--exec
"loadScript(
\"
$1
\"
)"
</dev/null
}
}
function
geth_exec
function
geth_exec
{
{
test
-n
"
$1
"
test
-n
"
$1
"
geth_attach
--exec
"
$1
"
geth_attach
--exec
"
$1
"
</dev/null
}
}
function
geth_rpc
function
geth_rpc
...
@@ -288,3 +297,36 @@ function gen_genesis
...
@@ -288,3 +297,36 @@ function gen_genesis
}
}
EOCONF
EOCONF
}
}
function
contract
{
bfaconfig network
local
contract
=
"
${
BFANETWORKDIR
}
/contracts/
${
1
}
"
local
realdir
=
$(
realpath
"
${
contract
}
"
)
test
-r
"
${
realdir
}
"
local
address
=
$(
basename
"
${
realdir
}
"
)
test
-n
"
${
address
}
"
abi
=
$(
cat
${
contract
}
/abi
)
test
-n
"
${
abi
}
"
echo
"eth.contract(
${
abi
}
).at(
\"
${
address
}
\"
)"
}
function
contractCall
{
local
name
=
$1
local
func
=
$2
shift
2
echo
"var contract =
$(
contract
"
${
name
}
"
)
;"
local
args
=
for
x
in
$*
do
args
=
"
${
args
}
,
${
x
}
"
done
args
=
"
${
args
:1
}
,"
if
[
"
$args
"
=
","
]
then
args
=
fi
echo
"contract.
${
func
}
.sendTransaction(
${
args
}
{from: eth.accounts[0], gas: 1000000} )"
}
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