From 451421083fd1c9683cfef0199663762ffdae64b7 Mon Sep 17 00:00:00 2001 From: Ali Behjati Date: Wed, 21 May 2025 16:40:49 +0200 Subject: [PATCH 1/3] chore(target_chains/ethereum): use versioned artifacts for deployment --- target_chains/ethereum/contracts/deploy.sh | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/target_chains/ethereum/contracts/deploy.sh b/target_chains/ethereum/contracts/deploy.sh index e9a11aa321..9d02921fec 100755 --- a/target_chains/ethereum/contracts/deploy.sh +++ b/target_chains/ethereum/contracts/deploy.sh @@ -12,23 +12,38 @@ set -euo pipefail echo "=========== Building dependencies ===========" -pushd ../../../ + +# This command also compiles the contracts if latest version is used pnpm turbo build --filter @pythnetwork/pyth-evm-contract -popd -echo "=========== Compiling ===========" +echo "=========== Deploying the contracts ===========" -if [[ -e contracts/pyth/PythUpgradable_merged.sol ]]; then - echo "Flattened contract PythUpgradable_merged.sol exists. Removing before compiling." - rm contracts/pyth/PythUpgradable_merged.sol -fi +version="$1" +shift -echo "Building the contracts..." -# Ensure that we deploy a fresh build with up-to-date dependencies. -rm -rf build && pnpm exec truffle compile --all +if [ "$version" = "latest" ]; then + echo "Deploying latest version" + stdoutputdir="../target_chains/ethereum/contracts/build/contracts" +else + # make sure version has format of vX.Y.Z + if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Version must be in format vX.Y.Z" + echo "Usage: $0 ..." + exit 1 + fi -echo "Deploying the contracts..." + echo "Deploying version $version" + tmpdir=$(mktemp -d) + wget https://github.com/pyth-network/pyth-crosschain/releases/download/pyth-evm-contract-$version/contracts-stdoutput.zip -O $tmpdir/contracts-stdoutput.zip + unzip -q -o $tmpdir/contracts-stdoutput.zip -d $tmpdir + stdoutputdir="$tmpdir" +fi -pushd ../../../contract_manager/ +pnpm --filter=@pythnetwork/contract-manager exec ts-node scripts/deploy_evm_pricefeed_contracts.ts --std-output-dir $stdoutputdir --private-key $PK --chain "$@" -pnpm exec ts-node scripts/deploy_evm_pricefeed_contracts.ts --std-output-dir ../target_chains/ethereum/contracts/build/contracts --private-key $PK --chain "$@" +echo "=========== Cleaning up ===========" +rm -rf $tmpdir + +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" +fi From 8ac4b7fb955f8966b7b9da02db34f9ce9719ffa7 Mon Sep 17 00:00:00 2001 From: Ali Behjati Date: Wed, 21 May 2025 16:41:47 +0200 Subject: [PATCH 2/3] chore(target_chains/ethereum): add mezo testnet --- contract_manager/store/contracts/EvmPriceFeedContracts.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contract_manager/store/contracts/EvmPriceFeedContracts.yaml b/contract_manager/store/contracts/EvmPriceFeedContracts.yaml index 5ab44c0ea9..cff7d41a45 100644 --- a/contract_manager/store/contracts/EvmPriceFeedContracts.yaml +++ b/contract_manager/store/contracts/EvmPriceFeedContracts.yaml @@ -499,3 +499,6 @@ - chain: converge_testnet address: "0x87047526937246727E4869C5f76A347160e08672" type: EvmPriceFeedContract +- chain: mezo_testnet + address: "0x2880aB155794e7179c9eE2e38200202908C17B43" + type: EvmPriceFeedContract From c11a8c048cae584cf271231c195283bf40288828 Mon Sep 17 00:00:00 2001 From: Ali Behjati Date: Wed, 21 May 2025 16:46:28 +0200 Subject: [PATCH 3/3] chore(target_chains/ethereum): update deploy.sh --- target_chains/ethereum/contracts/deploy.sh | 23 +++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/target_chains/ethereum/contracts/deploy.sh b/target_chains/ethereum/contracts/deploy.sh index 9d02921fec..09fb6a47de 100755 --- a/target_chains/ethereum/contracts/deploy.sh +++ b/target_chains/ethereum/contracts/deploy.sh @@ -1,22 +1,20 @@ #!/bin/bash # # This script deploys changes to given networks. Usage: -# $ ./deploy.sh <...> -# Network names are defined in `truffle-config.js`. +# $ ./deploy.sh <...> +# +# You need to set the PK environment variable to your private key. # # Example: Deploying to some testnet networks -# $ ./deploy.sh bnb_testnet fantom_testnet mumbai +# $ ./deploy.sh latest bnb_testnet fantom_testnet mumbai # # Example: Deploying to some mainnet networks -# $ ./deploy.sh ethereum bnb avalanche +# $ ./deploy.sh v1.4.5 ethereum bnb avalanche set -euo pipefail -echo "=========== Building dependencies ===========" +echo "=========== Preparing contracts ===========" -# This command also compiles the contracts if latest version is used -pnpm turbo build --filter @pythnetwork/pyth-evm-contract - -echo "=========== Deploying the contracts ===========" +PK=$PK version="$1" shift @@ -39,6 +37,13 @@ else stdoutputdir="$tmpdir" fi +echo "=========== Building dependencies ===========" + +# This command also compiles the contracts if latest version is used +pnpm turbo build --filter @pythnetwork/pyth-evm-contract + +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 ==========="