Skip to content

Commit

Permalink
chore: rename compile contract file name
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed Oct 18, 2024
1 parent 74e58db commit eaa79f1
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 221 deletions.
202 changes: 0 additions & 202 deletions contract/IRefundCallback.go

This file was deleted.

28 changes: 9 additions & 19 deletions contract/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,24 @@ echo "===> Compiling contracts"

[[ ! -d "$project_dir/contract/artifacts" ]] && mkdir -p "$project_dir/contract/artifacts"

# add core contracts
contracts=(WFXUpgradable FIP20Upgradable ICrosschain IStaking IFxBridgeLogic IBridgeCallback IError IBridgeFeeQuote)
contracts_test=(CrosschainTest StakingTest)
# add 3rd party contracts
contracts+=(ERC1967Proxy)
contracts_test+=(ERC721TokenTest)
contracts=(WFXUpgradable FIP20Upgradable IStaking IError ERC1967Proxy)
contracts+=(IFxBridgeLogic IBridgeCallback IBridgeFeeQuote ICrosschain)
contracts+=(CrosschainTest StakingTest ERC721TokenTest)

for contract in "${contracts[@]}"; do
echo "===> Ethereum ABI wrapper code generator: $contract"
file_path=$(find "$project_dir/solidity/artifacts" -name "${contract}.json" -type f)
jq -c '.abi' "$file_path" >"$project_dir/contract/artifacts/${contract}.abi"
jq -r '.bytecode' "$file_path" >"$project_dir/contract/artifacts/${contract}.bin"
go_filename=$(echo "${contract}" | sed -r 's/([a-z])([A-Z])/\1_\2/g' | tr '[:upper:]' '[:lower:]')
out="contract/${go_filename}.sol.go"
if [[ $contract =~ Test$ ]]; then
out="tests/contract/${go_filename}.sol.go"
fi
abigen --abi "$project_dir/contract/artifacts/${contract}.abi" \
--bin "$project_dir/contract/artifacts/${contract}.bin" \
--type "${contract}" --pkg contract \
--out "$project_dir/contract/${contract}.go"
done

# test contracts
for contract_test in "${contracts_test[@]}"; do
echo "===> Ethereum ABI wrapper code generator: $contract_test"
file_path=$(find "$project_dir/solidity/artifacts" -name "${contract_test}.json" -type f)
jq -c '.abi' "$file_path" >"$project_dir/contract/artifacts/${contract_test}.abi"
jq -r '.bytecode' "$file_path" >"$project_dir/contract/artifacts/${contract_test}.bin"
abigen --abi "$project_dir/contract/artifacts/${contract_test}.abi" \
--bin "$project_dir/contract/artifacts/${contract_test}.bin" \
--type "${contract_test}" --pkg contract \
--out "$project_dir/tests/contract/${contract_test}.go"
--out "$project_dir/$out"
done

rm -rf "$project_dir/contract/artifacts"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit eaa79f1

Please sign in to comment.