deploy.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. #
  3. # This script deploys changes to given networks. Usage:
  4. # $ ./deploy.sh <network_a> <network_a> <...>
  5. # Network names are defined in `truffle-config.js`.
  6. #
  7. # Example: Deploying to some testnet networks
  8. # $ ./deploy.sh bnb_testnet fantom_testnet mumbai
  9. #
  10. # Example: Deploying to some mainnet networks
  11. # $ ./deploy.sh ethereum bnb avalanche
  12. set -euo pipefail
  13. echo "=========== Building dependencies ==========="
  14. pushd ../../../
  15. pnpm exec lerna run build --scope="@pythnetwork/pyth-evm-contract" --include-dependencies
  16. popd
  17. echo "=========== Compiling ==========="
  18. if [[ -e contracts/pyth/PythUpgradable_merged.sol ]]; then
  19. echo "Flattened contract PythUpgradable_merged.sol exists. Removing before compiling."
  20. rm contracts/pyth/PythUpgradable_merged.sol
  21. fi
  22. echo "Building the contracts..."
  23. # Ensure that we deploy a fresh build with up-to-date dependencies.
  24. rm -rf build && pnpm exec truffle compile --all
  25. echo "Deploying the contracts..."
  26. pushd ../../../contract_manager/
  27. pnpm exec ts-node scripts/deploy_evm_pricefeed_contracts.ts --std-output-dir ../target_chains/ethereum/contracts/build/contracts --private-key $PK --chain "$@"