feat(scripts): resolve CCIP/LINK addresses via config inventory

- Add scripts/lib/address-inventory.sh (jq + JSON inventory fallback)
- Wire deployment helper scripts to load_explorer_runtime_env + resolve_address_value
- Persist new LINK to address-inventory.json via persist_inventory_value
- Document config/*.json in config/README.md

Made-with: Cursor
This commit is contained in:
defiQUG
2026-03-27 22:09:32 -07:00
parent ca24d6127c
commit ed0af8aaa0
12 changed files with 170 additions and 97 deletions

View File

@@ -5,9 +5,11 @@
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/.."
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "$PROJECT_ROOT/scripts/lib/address-inventory.sh"
cd "$PROJECT_ROOT"
source .env 2>/dev/null || true
load_explorer_runtime_env
RPC_URL="${RPC_URL_138:-http://192.168.11.250:8545}"
ACCOUNT=$(cast wallet address "$PRIVATE_KEY" 2>/dev/null || echo "")
@@ -45,8 +47,8 @@ echo "╚═══════════════════════
echo ""
if ./scripts/diagnose-link-deployment.sh 2>&1 | grep -q "Using Existing LINK Token"; then
echo "✓✓✓ Found existing LINK token!"
source .env 2>/dev/null || true
LINK_TOKEN="${LINK_TOKEN:-}"
load_explorer_runtime_env
LINK_TOKEN="$(resolve_address_value LINK_TOKEN LINK_TOKEN "")"
if [ -n "$LINK_TOKEN" ] && [ ${#LINK_TOKEN} -eq 42 ]; then
CODE=$(cast code "$LINK_TOKEN" --rpc-url "$RPC_URL" 2>/dev/null || echo "")
if [ -n "$CODE" ] && [ "$CODE" != "0x" ] && [ ${#CODE} -gt 100 ]; then
@@ -86,8 +88,8 @@ echo ""
echo "Waiting 45 seconds for network confirmation..."
sleep 45
source .env 2>/dev/null || true
LINK_TOKEN="${LINK_TOKEN:-}"
load_explorer_runtime_env
LINK_TOKEN="$(resolve_address_value LINK_TOKEN LINK_TOKEN "")"
if [ -n "$LINK_TOKEN" ] && [ ${#LINK_TOKEN} -eq 42 ]; then
CODE=$(cast code "$LINK_TOKEN" --rpc-url "$RPC_URL" 2>/dev/null || echo "")
if [ -n "$CODE" ] && [ "$CODE" != "0x" ] && [ ${#CODE} -gt 100 ]; then
@@ -128,4 +130,3 @@ echo " 1. Wait additional time (5-10 minutes)"
echo " 2. Use Remix IDE (instructions above)"
echo " 3. Check block explorer: https://explorer.d-bis.org/address/$ACCOUNT"
echo ""