Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rename compile contract file name #754

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.