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 3158c5cd36
commit 7a7ce770c2
12 changed files with 170 additions and 97 deletions

View File

@@ -6,11 +6,13 @@ set -uo pipefail # Remove -e to allow error handling
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "$PROJECT_ROOT/scripts/lib/address-inventory.sh"
source "$PROJECT_ROOT/.env" 2>/dev/null || source "$PROJECT_ROOT/../.env" 2>/dev/null || true
load_explorer_runtime_env
RPC_URL="${RPC_URL_138:-http://192.168.11.250:8545}"
CHAIN_ID=138
LINK_TOKEN="${LINK_TOKEN:-$(resolve_address_value LINK_TOKEN LINK_TOKEN "")}"
echo "╔══════════════════════════════════════════════════════════════╗"
echo "║ LINK TOKEN DEPLOYMENT TEST SUITE ║"
@@ -51,7 +53,7 @@ echo "════════════════════════
echo ""
if [ -z "${PRIVATE_KEY:-}" ]; then
test_fail "PRIVATE_KEY not set in .env"
test_fail "PRIVATE_KEY not available in effective environment"
else
test_pass "PRIVATE_KEY is set"
DEPLOYER=$(cast wallet address "$PRIVATE_KEY" 2>/dev/null || echo "")
@@ -243,7 +245,7 @@ if [ -n "${LINK_TOKEN:-}" ] && [ "$LINK_TOKEN" != "" ]; then
test_warn "LINK token address configured but contract not found on-chain"
fi
else
test_warn "LINK_TOKEN not configured in .env"
test_warn "LINK_TOKEN not configured in address inventory"
fi
echo ""
@@ -320,4 +322,3 @@ else
echo -e "${RED}❌ Some critical tests failed. Please fix issues before deploying.${NC}"
exit 1
fi