|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Deploy ExternalStakingDistributor |
| 4 | +#./scripts/deployment/deploy_l2_12_external_staking_distributor.sh $1 |
| 5 | + |
| 6 | +# Check if $1 is provided |
| 7 | +if [ -z "$1" ]; then |
| 8 | + echo "Usage: $0 <network>" |
| 9 | + echo "Example: $0 base_mainnet" |
| 10 | + exit 1 |
| 11 | +fi |
| 12 | + |
| 13 | +# check if the ETHERSCAN_API_KEY is set |
| 14 | +if [ -z "$ETHERSCAN_API_KEY" ]; then |
| 15 | + echo "Please set the ETHERSCAN_API_KEY environment variable." |
| 16 | + exit 1 |
| 17 | +fi |
| 18 | + |
| 19 | +red=$(tput setaf 1) |
| 20 | +green=$(tput setaf 2) |
| 21 | +reset=$(tput sgr0) |
| 22 | + |
| 23 | +# Get globals file |
| 24 | +globals="$(dirname "$0")/globals_$1.json" |
| 25 | +if [ ! -f $globals ]; then |
| 26 | + echo "${red}!!! $globals is not found${reset}" |
| 27 | + exit 0 |
| 28 | +fi |
| 29 | + |
| 30 | +# Read variables using jq |
| 31 | +useLedger=$(jq -r '.useLedger' $globals) |
| 32 | +derivationPath=$(jq -r '.derivationPath' $globals) |
| 33 | +chainId=$(jq -r '.chainId' $globals) |
| 34 | +networkURL=$(jq -r '.networkURL' $globals) |
| 35 | + |
| 36 | +externalStakingDistributorAddress=$(jq -r '.externalStakingDistributorAddress' $globals) |
| 37 | +externalStakingDistributorProxyAddress=$(jq -r '.externalStakingDistributorProxyAddress' $globals) |
| 38 | + |
| 39 | +# Check for Polygon keys only since on other networks those are not needed |
| 40 | +if [ $chainId == 137 ]; then |
| 41 | + API_KEY=$ALCHEMY_API_KEY_MATIC |
| 42 | + if [ "$API_KEY" == "" ]; then |
| 43 | + echo "set ALCHEMY_API_KEY_MATIC env variable" |
| 44 | + exit 0 |
| 45 | + fi |
| 46 | +elif [ $chainId == 80002 ]; then |
| 47 | + API_KEY=$ALCHEMY_API_KEY_AMOY |
| 48 | + if [ "$API_KEY" == "" ]; then |
| 49 | + echo "set ALCHEMY_API_KEY_AMOY env variable" |
| 50 | + exit 0 |
| 51 | + fi |
| 52 | +fi |
| 53 | + |
| 54 | +# Get deployer based on the ledger flag |
| 55 | +if [ "$useLedger" == "true" ]; then |
| 56 | + walletArgs="-l --mnemonic-derivation-path $derivationPath" |
| 57 | + deployer=$(cast wallet address $walletArgs) |
| 58 | +else |
| 59 | + echo "Using PRIVATE_KEY: ${PRIVATE_KEY:0:6}..." |
| 60 | + walletArgs="--private-key $PRIVATE_KEY" |
| 61 | + deployer=$(cast wallet address $walletArgs) |
| 62 | +fi |
| 63 | + |
| 64 | +echo "${green}Updating ExternalStakingDistributor implementation in ExternalStakingDistributorProxy${reset}" |
| 65 | +castSendHeader="cast send --rpc-url $networkURL$API_KEY $walletArgs" |
| 66 | +castArgs="$externalStakingDistributorProxyAddress changeImplementation(address) $externalStakingDistributorAddress" |
| 67 | +echo $castArgs |
| 68 | +castCmd="$castSendHeader $castArgs" |
| 69 | +result=$($castCmd) |
| 70 | +echo "$result" | grep "status" |
0 commit comments