Skip to content
Snippets Groups Projects
Commit d68dd374 authored by Robert Martin-Legene's avatar Robert Martin-Legene
Browse files

Mejorando solc

parent 508c41d1
No related branches found
No related tags found
No related merge requests found
......@@ -4,24 +4,68 @@
# See if PATH is set up incorrectly (look for another install of this binary).
mypath=$( realpath $0 )
myname=${mypath##*/}
for p in ${PATH//:/ }
do
checkfile=${p}/${myname}
if [ -x ${checkfile} ]
printf -v newline '\n'
function find_evm_version()
{
# Remember to set the evm version to be compatible with
# the blockchain. BFA is still at Byzantium (as per 2021).
# The current version is listed in lib/versions with
# keyword chain_evm_version
unset evmvers
local keyword
keyword=chain_evm_version
while read -r
do
if [[ "$REPLY" =~ ^${keyword}= ]]
then
evmvers=${REPLY#${keyword}=}
break
fi
done < "${BFAHOME:-/home/bfa/bfa}/lib/versions"
if [ -z "$evmvers" ]
then
if [ $( realpath ${checkfile} ) = $mypath ]
printf -v errortxt '%s\n%s' "$errortxt" "Can not find the keyword ${keyword} in lib/versions"
errortxt=${errortxt#${newline}}
fi
}
function find_first_solc
{
local mypath myname p
mypath=$( realpath "$0" )
myname=${mypath##*/}
unset first_solc
for p in ${PATH//:/ }
do
local checkfile=${p}/${myname}
if [ ! -x "${checkfile}" ]
then
continue
fi
if [ "$(realpath "${checkfile}")" = "$mypath" ]
then
continue
fi
# we found another one, yay!
evmvers=$( grep '^chain_evm_version=' ${BFAHOME:-/home/bfa/bfa}/lib/versions | head -1 )
exec ${checkfile} ${evmvers/*=/--evm-version=} --combined-json abi,asm,ast,bin,bin-runtime,compact-format,devdoc,generated-sources,generated-sources-runtime,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,storage-layout,userdoc "$@"
exit 1
first_solc=${checkfile}
break
done
if [ -z "$first_solc" ]
then
printf -v errortxt '%s\n%s' "$errortxt" "solc: command not found."
errortxt=${errortxt#${newline}}
fi
done
}
errortxt=
find_first_solc
find_evm_version
if [ -n "$errortxt" ]
then
echo "$errortxt" >&2
exit 1
fi
# not found
echo "solc: command not found." >&2
exec "${first_solc}" --evm-version="$evmvers" --combined-json abi,asm,ast,bin,bin-runtime,compact-format,devdoc,generated-sources,generated-sources-runtime,hashes,interface,metadata,opcodes,srcmap,srcmap-runtime,storage-layout,userdoc "$@"
exit 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment