ghost-dao-contracts/deployer.sh
Uncle Fatso 4c41037fa8
hoodi testnet added
Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
2025-05-11 16:31:40 +03:00

100 lines
2.2 KiB
Bash

set -e
AVAILIABLE_NETWORKS=(anvil-localnet sepolia-testnet hoodi-testnet)
NETWORK="${AVAILIABLE_NETWORKS[0]}"
START=1
END=12
VERIFY_NEEDED="--verify"
while [[ $# -gt 0 ]];
do
case "${1}" in
-s|--start)
START="$2"
shift
shift
;;
-e|--end)
END="$2"
shift
shift
;;
-n|--network)
NETWORK="$2"
shift
shift
;;
esac
done
if [ "$NETWORK" == "anvil-localnet" ]; then
VERIFY_NEEDED=""
fi
found=false
for i in "${AVAILIABLE_NETWORKS[@]}"
do
if [ "$i" == "$NETWORK" ] ; then
found=true
fi
done
if [ $found == false ] ; then
echo "ERROR: '${NETWORK}' is incorrect network for deployment, valid networks are:"
for i in "${AVAILIABLE_NETWORKS[@]}"
do
echo -e "\t${i}"
done
exit
fi
for i in $(seq $START $END); do
if [ "0" == "$i" ]; then
CONTRACT="Reserve"
elif [ "1" == "$i" ] ; then
CONTRACT="Authority"
elif [ "2" == "$i" ]; then
CONTRACT="Fatso"
elif [ "3" == "$i" ]; then
CONTRACT="Stinky"
elif [ "4" == "$i" ]; then
CONTRACT="Ghost"
elif [ "5" == "$i" ]; then
CONTRACT="Staking"
elif [ "6" == "$i" ]; then
CONTRACT="Treasury"
elif [ "7" == "$i" ]; then
CONTRACT="BondDepository"
elif [ "8" == "$i" ]; then
CONTRACT="StakingDistributor"
elif [ "9" == "$i" ]; then
CONTRACT="BondingCalculator"
elif [ "10" == "$i" ]; then
CONTRACT="AfterPartyFirst"
elif [ "11" == "$i" ]; then
CONTRACT="AfterPartySecond"
elif [ "12" == "$i" ]; then
CONTRACT="AfterPartyThird"
else
echo "No contract found for index $i"
exit
fi
forge script script/${CONTRACT}.s.sol:Ghost${CONTRACT}Script --rpc-url $NETWORK
if [ "$NETWORK" == "anvil-localnet" ]; then
answer="y"
else
read -p "Do you want to broadcast '${CONTRACT}' to ${NETWORK} (y/N)? " answer
fi
if [ "$answer" != "${answer#[Yy]}" ] ; then
forge script script/${CONTRACT}.s.sol:Ghost${CONTRACT}Script \
--rpc-url $NETWORK \
--broadcast \
${VERIFY_NEEDED} \
-vvv
else
exit
fi
done