Skip to content

Commit 5935c1d

Browse files
committed
standard output path for build - forge
1 parent 9e19455 commit 5935c1d

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

target_chains/ethereum/contracts/deploy.sh

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,34 @@ shift
2121

2222
if [ "$version" = "latest" ]; then
2323
echo "Deploying latest version"
24-
stdoutputdir="../target_chains/ethereum/contracts/build/contracts"
24+
# Create a temporary directory for flattened contract artifacts
25+
contracts_dir="out/contracts"
26+
mkdir -p "$contracts_dir"
27+
28+
echo "Copying contract artifacts from Foundry output structure..."
29+
30+
# List of required contracts for EVM deployment
31+
contracts=(
32+
"PythUpgradable"
33+
"ERC1967Proxy"
34+
"ReceiverSetup"
35+
"WormholeReceiver"
36+
"ReceiverImplementation"
37+
)
38+
39+
# Copy each contract artifact
40+
for contract in "${contracts[@]}"; do
41+
source_file="./out/${contract}.sol/${contract}.json"
42+
dest_file="$contracts_dir/${contract}.json"
43+
44+
if [ -f "$source_file" ]; then
45+
cp "$source_file" "$dest_file"
46+
echo "✓ Copied ${contract}.json"
47+
else
48+
echo "Warning: ${contract}.json not found at $source_file"
49+
fi
50+
done
51+
stdoutputdir="$(pwd)/$contracts_dir"
2552
else
2653
# make sure version has format of vX.Y.Z
2754
if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
@@ -47,7 +74,15 @@ echo "=========== Deploying the contracts ==========="
4774
pnpm --filter=@pythnetwork/contract-manager exec ts-node scripts/deploy_evm_pricefeed_contracts.ts --std-output-dir $stdoutputdir --private-key $PK --chain "$@"
4875

4976
echo "=========== Cleaning up ==========="
50-
rm -rf $tmpdir
77+
if [ -n "${tmpdir:-}" ]; then
78+
rm -rf $tmpdir
79+
fi
80+
81+
# Clean up the contracts directory if we created it for the latest version
82+
if [ "$version" = "latest" ]; then
83+
rm -rf "out/contracts"
84+
echo "Cleaned up contracts directory"
85+
fi
5186

5287
if [ "$version" != "latest" ]; then
5388
echo "Verify the contracts by using the std-input artifacts of the contracts in https://github.com/pyth-network/pyth-crosschain/releases/tag/pyth-evm-contract-$version"

target_chains/ethereum/contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"test": "forge test",
1818
"deploy": "forge script script/Deploy.s.sol --rpc-url testnet --broadcast",
1919
"deploy-and-verify": "forge script script/Deploy.s.sol --rpc-url testnet --broadcast --verify",
20-
"deploy-local": "ETHERSCAN_API_KEY= forge script script/Deploy.s.sol --rpc-url local --broadcast",
20+
"deploy-local": "ETHERSCAN_API_KEY= forge script script/Deploy.s.sol --slow --rpc-url local --broadcast -vvvv",
2121
"receiver-submit-guardian-sets": "forge script script/ReceiverSubmitGuardianSetUpgrades.s.sol --rpc-url $RPC_URL --broadcast",
2222
"create-governance-vaa": "forge script script/CreateLocalnetGovernanceVaa.s.sol",
2323
"install-forge-deps": "forge install foundry-rs/[email protected] --no-git",

0 commit comments

Comments
 (0)