Files
smom-dbis-138/scripts/deployment/create-uniswap-v3-gas-pool.sh
defiQUG f3d2961b97
Some checks failed
CI/CD Pipeline / Lint and Format (push) Failing after 46s
CI/CD Pipeline / Terraform Validation (push) Failing after 35s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 37s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 1m50s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 2m19s
Validation / validate-genesis (push) Successful in 51s
Validation / validate-terraform (push) Failing after 39s
Validation / validate-kubernetes (push) Failing after 10s
CI/CD Pipeline / Solidity Contracts (push) Failing after 12m56s
Validation / validate-smart-contracts (push) Failing after 12s
CI/CD Pipeline / Security Scanning (push) Failing after 15m52s
Validation / validate-security (push) Failing after 10m59s
Validation / validate-documentation (push) Failing after 17s
Validate Token List / validate (push) Failing after 30s
OMNL reconcile anchor / Run omnl:reconcile and upload artifacts (push) Failing after 26s
Verify Deployment / Verify Deployment (push) Failing after 56s
feat: add hybx omnl stack and gas pmm tooling
2026-04-24 12:56:40 -07:00

82 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
if [[ -f "$SCRIPT_DIR/../lib/deployment/dotenv.sh" ]]; then
# shellcheck disable=SC1090
source "$SCRIPT_DIR/../lib/deployment/dotenv.sh"
load_deployment_env --repo-root "$REPO_ROOT"
fi
FACTORY="${FACTORY:-${UNISWAP_V3_FACTORY:-}}"
RPC_URL="${RPC_URL:-}"
TOKEN_A="${TOKEN_A:-}"
TOKEN_B="${TOKEN_B:-}"
FEE="${FEE:-500}"
EXECUTE="${EXECUTE:-0}"
SQRT_PRICE_X96="${SQRT_PRICE_X96:-79228162514264337593543950336}"
PRIVATE_KEY="${PRIVATE_KEY:-}"
if [[ -z "$FACTORY" || -z "$RPC_URL" || -z "$TOKEN_A" || -z "$TOKEN_B" ]]; then
echo "Required: FACTORY RPC_URL TOKEN_A TOKEN_B" >&2
exit 1
fi
get_pool() {
cast call "$FACTORY" \
"getPool(address,address,uint24)(address)" \
"$TOKEN_A" "$TOKEN_B" "$FEE" \
--rpc-url "$RPC_URL" 2>/dev/null || true
}
pool="$(get_pool)"
pool="${pool//$'\n'/}"
if [[ -z "$pool" || "$pool" == "0x0000000000000000000000000000000000000000" ]]; then
echo "Pool does not exist yet for $TOKEN_A / $TOKEN_B fee $FEE"
if [[ "$EXECUTE" != "1" ]]; then
echo "Dry run: set EXECUTE=1 to call createPool on $FACTORY"
exit 0
fi
if [[ -z "$PRIVATE_KEY" ]]; then
echo "PRIVATE_KEY is required when EXECUTE=1" >&2
exit 1
fi
cast send "$FACTORY" \
"createPool(address,address,uint24)" \
"$TOKEN_A" "$TOKEN_B" "$FEE" \
--rpc-url "$RPC_URL" \
--private-key "$PRIVATE_KEY" \
-vv
pool="$(get_pool)"
pool="${pool//$'\n'/}"
fi
echo "Pool address: $pool"
slot0="$(cast call "$pool" "slot0()((uint160,int24,uint16,uint16,uint16,uint8,bool))" --rpc-url "$RPC_URL" 2>/dev/null || true)"
slot0_no_ws="$(printf '%s' "$slot0" | tr -d '[:space:]')"
if [[ "$slot0_no_ws" == "(0,0,0,0,0,0,false)" || -z "$slot0_no_ws" ]]; then
echo "Pool is not initialized"
if [[ "$EXECUTE" != "1" ]]; then
echo "Dry run: set EXECUTE=1 to initialize at sqrtPriceX96=$SQRT_PRICE_X96"
exit 0
fi
if [[ -z "$PRIVATE_KEY" ]]; then
echo "PRIVATE_KEY is required when EXECUTE=1" >&2
exit 1
fi
cast send "$pool" \
"initialize(uint160)" \
"$SQRT_PRICE_X96" \
--rpc-url "$RPC_URL" \
--private-key "$PRIVATE_KEY" \
-vv
echo "Initialized pool at sqrtPriceX96=$SQRT_PRICE_X96"
else
echo "Pool already initialized: $slot0"
fi