Ver código fonte

standard output path for build - forge

nidhi-singh02 2 meses atrás
pai
commit
5935c1d74b

+ 37 - 2
target_chains/ethereum/contracts/deploy.sh

@@ -21,7 +21,34 @@ shift
 
 if [ "$version" = "latest" ]; then
   echo "Deploying latest version"
-  stdoutputdir="../target_chains/ethereum/contracts/build/contracts"
+  # Create a temporary directory for flattened contract artifacts
+  contracts_dir="out/contracts"
+  mkdir -p "$contracts_dir"
+  
+  echo "Copying contract artifacts from Foundry output structure..."
+  
+  # List of required contracts for EVM deployment
+  contracts=(
+    "PythUpgradable"
+    "ERC1967Proxy" 
+    "ReceiverSetup"
+    "WormholeReceiver"
+    "ReceiverImplementation"
+  )
+  
+  # Copy each contract artifact
+  for contract in "${contracts[@]}"; do
+    source_file="./out/${contract}.sol/${contract}.json"
+    dest_file="$contracts_dir/${contract}.json"
+    
+    if [ -f "$source_file" ]; then
+      cp "$source_file" "$dest_file"
+      echo "✓ Copied ${contract}.json"
+    else
+      echo "Warning: ${contract}.json not found at $source_file"
+    fi
+  done
+  stdoutputdir="$(pwd)/$contracts_dir"
 else
   # make sure version has format of vX.Y.Z
   if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
@@ -47,7 +74,15 @@ echo "=========== Deploying the contracts ==========="
 pnpm --filter=@pythnetwork/contract-manager exec ts-node scripts/deploy_evm_pricefeed_contracts.ts --std-output-dir $stdoutputdir --private-key $PK --chain "$@"
 
 echo "=========== Cleaning up ==========="
-rm -rf $tmpdir
+if [ -n "${tmpdir:-}" ]; then
+  rm -rf $tmpdir
+fi
+
+# Clean up the contracts directory if we created it for the latest version
+if [ "$version" = "latest" ]; then
+  rm -rf "out/contracts"
+  echo "Cleaned up contracts directory"
+fi
 
 if [ "$version" != "latest" ]; then
     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"

+ 1 - 1
target_chains/ethereum/contracts/package.json

@@ -17,7 +17,7 @@
     "test": "forge test",
     "deploy": "forge script script/Deploy.s.sol --rpc-url testnet --broadcast",
     "deploy-and-verify": "forge script script/Deploy.s.sol --rpc-url testnet --broadcast --verify",
-    "deploy-local": "ETHERSCAN_API_KEY= forge script script/Deploy.s.sol --rpc-url local --broadcast",
+    "deploy-local": "ETHERSCAN_API_KEY= forge script script/Deploy.s.sol --slow  --rpc-url local --broadcast -vvvv",
     "receiver-submit-guardian-sets": "forge script script/ReceiverSubmitGuardianSetUpgrades.s.sol --rpc-url $RPC_URL --broadcast",
     "create-governance-vaa": "forge script script/CreateLocalnetGovernanceVaa.s.sol",
     "install-forge-deps": "forge install foundry-rs/forge-std@v1.7.6 --no-git",