Skip to content

Commit 2f1becd

Browse files
authored
chore(target_chains/ethereum): use versioned artifacts for deployment (#2714)
* chore(target_chains/ethereum): use versioned artifacts for deployment * chore(target_chains/ethereum): add mezo testnet * chore(target_chains/ethereum): update deploy.sh
1 parent 0b1a59f commit 2f1becd

File tree

2 files changed

+41
-18
lines changed

2 files changed

+41
-18
lines changed

contract_manager/store/contracts/EvmPriceFeedContracts.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,3 +499,6 @@
499499
- chain: converge_testnet
500500
address: "0x87047526937246727E4869C5f76A347160e08672"
501501
type: EvmPriceFeedContract
502+
- chain: mezo_testnet
503+
address: "0x2880aB155794e7179c9eE2e38200202908C17B43"
504+
type: EvmPriceFeedContract
Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,54 @@
11
#!/bin/bash
22
#
33
# This script deploys changes to given networks. Usage:
4-
# $ ./deploy.sh <network_a> <network_a> <...>
5-
# Network names are defined in `truffle-config.js`.
4+
# $ ./deploy.sh <version:vX.Y.Z|latest> <network_a> <network_a> <...>
5+
#
6+
# You need to set the PK environment variable to your private key.
67
#
78
# Example: Deploying to some testnet networks
8-
# $ ./deploy.sh bnb_testnet fantom_testnet mumbai
9+
# $ ./deploy.sh latest bnb_testnet fantom_testnet mumbai
910
#
1011
# Example: Deploying to some mainnet networks
11-
# $ ./deploy.sh ethereum bnb avalanche
12+
# $ ./deploy.sh v1.4.5 ethereum bnb avalanche
1213
set -euo pipefail
1314

14-
echo "=========== Building dependencies ==========="
15-
pushd ../../../
16-
pnpm turbo build --filter @pythnetwork/pyth-evm-contract
17-
popd
15+
echo "=========== Preparing contracts ==========="
16+
17+
PK=$PK
18+
19+
version="$1"
20+
shift
1821

19-
echo "=========== Compiling ==========="
22+
if [ "$version" = "latest" ]; then
23+
echo "Deploying latest version"
24+
stdoutputdir="../target_chains/ethereum/contracts/build/contracts"
25+
else
26+
# make sure version has format of vX.Y.Z
27+
if [[ ! "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
28+
echo "Version must be in format vX.Y.Z"
29+
echo "Usage: $0 <version> <network_a> <network_b> ..."
30+
exit 1
31+
fi
2032

21-
if [[ -e contracts/pyth/PythUpgradable_merged.sol ]]; then
22-
echo "Flattened contract PythUpgradable_merged.sol exists. Removing before compiling."
23-
rm contracts/pyth/PythUpgradable_merged.sol
33+
echo "Deploying version $version"
34+
tmpdir=$(mktemp -d)
35+
wget https://github.com/pyth-network/pyth-crosschain/releases/download/pyth-evm-contract-$version/contracts-stdoutput.zip -O $tmpdir/contracts-stdoutput.zip
36+
unzip -q -o $tmpdir/contracts-stdoutput.zip -d $tmpdir
37+
stdoutputdir="$tmpdir"
2438
fi
2539

26-
echo "Building the contracts..."
27-
# Ensure that we deploy a fresh build with up-to-date dependencies.
28-
rm -rf build && pnpm exec truffle compile --all
40+
echo "=========== Building dependencies ==========="
41+
42+
# This command also compiles the contracts if latest version is used
43+
pnpm turbo build --filter @pythnetwork/pyth-evm-contract
2944

30-
echo "Deploying the contracts..."
45+
echo "=========== Deploying the contracts ==========="
3146

32-
pushd ../../../contract_manager/
47+
pnpm --filter=@pythnetwork/contract-manager exec ts-node scripts/deploy_evm_pricefeed_contracts.ts --std-output-dir $stdoutputdir --private-key $PK --chain "$@"
3348

34-
pnpm exec ts-node scripts/deploy_evm_pricefeed_contracts.ts --std-output-dir ../target_chains/ethereum/contracts/build/contracts --private-key $PK --chain "$@"
49+
echo "=========== Cleaning up ==========="
50+
rm -rf $tmpdir
51+
52+
if [ "$version" != "latest" ]; then
53+
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"
54+
fi

0 commit comments

Comments
 (0)