Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
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
Miguel Montes
nucleo
Commits
996b109d
Commit
996b109d
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Renaming create.contract
parent
4ed50c99
Branches
sealers
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
bin/create.contract
+0
-70
0 additions, 70 deletions
bin/create.contract
with
2 additions
and
72 deletions
README.md
+
2
−
2
View file @
996b109d
...
...
@@ -47,14 +47,14 @@ request: **geth**
Connects you to your running local geth.
## c
reate
.contract
## c
ompile.and.deploy
.contract
requires:
**geth**
,
**solc**
,
**jq**
Compiles and deploys a contract to the blockchain. A local "node1" must already be running and synchronized.
Argument 1 is the filename of the contract to compile.
Example:
`c
reate
.contract src/TimestampAuthority.sol`
Example:
`c
ompile.and.deploy
.contract src/TimestampAuthority.sol`
## tsa-insert.sh
requires:
**geth**
...
...
This diff is collapsed.
Click to expand it.
bin/create.contract
deleted
100755 → 0
+
0
−
70
View file @
4ed50c99
#!/bin/bash
# 20180618 Robert Martin-Legene <robert@nic.ar>
if
[
-z
"
${
BFAHOME
}
"
]
;
then
echo
"
\$
BFAHOME not set. Did you source bfa/bin/env ?"
>
&2
;
exit
1
;
fi
source
${
BFAHOME
}
/bin/libbfa.sh
||
exit
1
function
create
{
workdir
=
$(
mktemp
-p
.
-d
)
cleanup
"
$workdir
"
json
=
$(
solc
--optimize
--combined-json
abi,bin
$filename
)
;
test
$?
=
0
prefix
=
$(
echo
"
$json
"
| jq
-M
'.contracts | keys | .[0]'
)
;
abi
=
$(
echo
"
$json
"
| jq
-rM
".contracts.
${
prefix
}
.abi"
)
;
test
$?
=
0
bin
=
$(
echo
"
$json
"
| jq
-rM
".contracts.
${
prefix
}
.bin"
)
;
test
$?
=
0
# Save abi for future use
echo
$abi
>
${
workdir
}
/abi
# We could save the bin, but we don't actually use it later, plus
# it gets stored in the blockchain
#echo $bin > ${workdir}/bin
js
=
$(
mktemp
)
cleanup
"
$js
"
cat
>
$js
<<
EOT
var mycontract = eth.contract(
$abi
)
var transaction = mycontract.new( { from: eth.accounts[0], data: "0x
${
bin
}
", gas: 1000000 } )
var rcpt
while ( !rcpt )
{
admin.sleepBlocks( 1 )
rcpt = eth.getTransactionReceipt( transaction.transactionHash )
}
var address = rcpt.contractAddress
var pubcontract = mycontract.at(address)
console.log( pubcontract.address )
EOT
echo
'*** Creating contract. This will take at least 16 seconds.'
outfile
=
$(
mktemp
)
cleanup
"
$outfile
"
geth_exec_file
$js
>
$outfile
if
[
`
wc
-l
<
$outfile
`
=
2
-a
`
tail
-1
<
$outfile
`
=
"true"
]
then
addr
=
`
head
-1
<
$outfile
`
mkdir
-p
${
BFANETWORKDIR
}
/contracts
mv
${
workdir
}
${
BFANETWORKDIR
}
/contracts/
${
addr
}
echo
Your new contract can be found
in
${
BFANETWORKDIR
}
/contracts/
${
addr
}
ln
-snf
${
addr
}
${
BFANETWORKDIR
}
/contracts/
${
contractname
}
else
echo
echo
' *** INPUT ***'
echo
cat
$js
echo
echo
' *** OUTPUT ***'
echo
cat
$outfile
fi
}
filename
=
"
$1
"
if
[
-z
"
$filename
"
-o
!
-r
"
$filename
"
]
then
echo
"Specify a filename of a contract you wish to compile."
false
fi
contractname
=
${
filename
%%.sol
}
contractname
=
${
contractname
##*/
}
contractname
=
${
contractname
##contract.
}
contractname
=
${
contractname
%.*
}
bfaconfig max
prereq jq solc geth
create
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