stack-orchestrator/app/data/config/contract-sushiswap/deploy-periphery-contracts.sh
prathamesh0 ddaddd2a8c
Add a sushiswap-subgraph stack (#496)
* Add a sushiswap-graph stack

* Fix shared volume name in fixturenet-lotus

* Export Lotus miner node multiaddr after initialization

* Add deployment scripts for sushiswap contracts

* Skip contracts deployment if already exists

* Rename stack to sushiswap-subgraph

* Fix postgres and use Lotus fixturenet in graph-node stack

* Add sushiswap v3 subgraph stack

* Fixes to deploy sushiswap subgraph to graph-node

* Add graph-node container in sushiswap subgraph stack

---------

Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
2023-08-14 14:17:21 +05:30

47 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
set -e
# Chain config
ETH_RPC_ENDPOINT="${ETH_RPC_ENDPOINT:-${DEFAULT_ETH_RPC_ENDPOINT}}"
CHAIN_ID="${CHAIN_ID:-${DEFAULT_CHAIN_ID}}"
ACCOUNT_PRIVATE_KEY="${ACCOUNT_PRIVATE_KEY:-${DEFAULT_ACCOUNT_PRIVATE_KEY}}"
# Option
DEPLOY="${DEPLOY:-${DEFAULT_DEPLOY}}"
# Create a .env file
echo "ETH_RPC_ENDPOINT=$ETH_RPC_ENDPOINT" > .env
echo "CHAIN_ID=$CHAIN_ID" >> .env
echo "ACCOUNT_PRIVATE_KEY=$ACCOUNT_PRIVATE_KEY" >> .env
echo "Using RPC endpoint $ETH_RPC_ENDPOINT"
# Wait for the RPC endpoint to be up
endpoint=${ETH_RPC_ENDPOINT#http://}
endpoint=${endpoint#https://}
RPC_HOST=$(echo "$endpoint" | awk -F'[:/]' '{print $1}')
RPC_PORT=$(echo "$endpoint" | awk -F'[:/]' '{print $2}')
./wait-for-it.sh -h "${RPC_HOST}" -p "${RPC_PORT}" -s -t 0
if [ "$DEPLOY" = true ] && [ ! -e "/app/deployments/docker/NonfungiblePositionManager.json" ]; then
# Loop until the factory deployment is detected
echo "Waiting for core deployments to occur"
while [ ! -f /app/core-deployments/docker/UniswapV3Factory.json ]; do
sleep 5
done
echo "Reading factory address from core deployments"
FACTORY_ADDRESS=$(jq -r '.address' /app/core-deployments/docker/UniswapV3Factory.json)
echo "Using UniswapV3Factory at $FACTORY_ADDRESS"
echo "FACTORY_ADDRESS=$FACTORY_ADDRESS" >> .env
echo "Performing periphery contract deployments..."
yarn hardhat --network docker deploy --tags NonfungiblePositionManager
else
echo "Skipping contract deployments"
fi
echo "Done"