-
Notifications
You must be signed in to change notification settings - Fork 307
chore(target_chains/ethereum): use versioned artifacts for deployment #2714
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,34 +1,54 @@ | ||
| #!/bin/bash | ||
| # | ||
| # This script deploys changes to given networks. Usage: | ||
| # $ ./deploy.sh <network_a> <network_a> <...> | ||
| # Network names are defined in `truffle-config.js`. | ||
| # $ ./deploy.sh <version:vX.Y.Z|latest> <network_a> <network_a> <...> | ||
| # | ||
| # 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 ===========" | ||
| pushd ../../../ | ||
| pnpm turbo build --filter @pythnetwork/pyth-evm-contract | ||
| popd | ||
| echo "=========== Preparing contracts ===========" | ||
|
|
||
| PK=$PK | ||
|
|
||
| version="$1" | ||
| shift | ||
|
|
||
| echo "=========== Compiling ===========" | ||
| 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 <version> <network_a> <network_b> ..." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ -e contracts/pyth/PythUpgradable_merged.sol ]]; then | ||
| echo "Flattened contract PythUpgradable_merged.sol exists. Removing before compiling." | ||
| rm contracts/pyth/PythUpgradable_merged.sol | ||
| 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 | ||
|
|
||
| echo "Building the contracts..." | ||
| # Ensure that we deploy a fresh build with up-to-date dependencies. | ||
| rm -rf build && pnpm exec truffle compile --all | ||
| 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..." | ||
| echo "=========== Deploying the contracts ===========" | ||
|
|
||
| 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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. I believe we have consistent releases of our contracts. But, we won't be needed many versions here.