Files
proxmox/config/README-CONTRACTS-MASTER.md
defiQUG bea1903ac9
Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
Sync all local changes: docs, config, scripts, submodule refs, verification evidence
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-21 15:46:06 -08:00

3.4 KiB

Master Smart Contracts (JSON)

Single source of truth for contract addresses: config/smart-contracts-master.json

  • Safe to publish — no secrets (no keys, no RPC URLs with credentials).
  • Used by: Bash scripts (via scripts/lib/load-contract-addresses.sh), Node/JS (via config/contracts-loader.cjs), and docs.

Layout

  • smart-contracts-master.json — Chains keyed by chain id (138, 1). Each chain has:
    • contracts: map of contract name → address.
    • envVarMap: map of env var name (e.g. CCIP_ROUTER) → contract key (for backward compatibility with .env).

Bash

Contract addresses are loaded automatically when you source project env:

source scripts/lib/load-project-env.sh
# Addresses from .env are used first; any missing are filled from smart-contracts-master.json
echo $CCIP_ROUTER
echo $CONTRACTS_138_CCIP_Router

Or source the contract loader only (after setting PROJECT_ROOT):

source scripts/lib/load-contract-addresses.sh

Node / JavaScript

From repo root or any app that can resolve config/contracts-loader.cjs:

const {
  getContractAddress,
  getChainContracts,
  loadContractsIntoProcessEnv
} = require('./config/contracts-loader.cjs');

// By contract key
getContractAddress(138, 'CCIP_Router');        // => '0x8078...'
getContractAddress(138, 'CCIPWETH9_Bridge');
getContractAddress(1, 'CCIP_Relay_Router');

// By env var name (resolved via envVarMap)
getContractAddress(138, 'CCIP_ROUTER');
getContractAddress(138, 'CCIPWETH9_BRIDGE_CHAIN138');

// All contracts for a chain
getChainContracts(138);

// Fill process.env for chain 138 and 1 (only where not already set)
loadContractsIntoProcessEnv();

Overrides

  • .env (e.g. smom-dbis-138/.env, services/relay/.env): Values set there take precedence over the master JSON. Use .env for local or per-service overrides.
  • Publishing: Commit smart-contracts-master.json; do not commit .env or any file containing PRIVATE_KEY or API secrets.

Updating addresses

  1. Edit config/smart-contracts-master.json (add/change under chains.<id>.contracts and, if needed, envVarMap).
  2. Keep docs/11-references/CONTRACT_ADDRESSES_REFERENCE.md in sync for human-readable tables.
  3. Re-run scripts or restart Node services to pick up changes; no rebuild required for JSON.

Token mapping (Chain 138 ↔ Mainnet)

  • token-mapping.json — Single source of truth for cross-chain token addresses (Chain 138 → Ethereum Mainnet). Lists which tokens have a Mainnet address and whether the relay bridge supports them (currently only WETH9).
  • token-mapping-loader.cjs — Node API: getRelayTokenMapping() returns { chain138Address: mainnetAddress }; getTokenList() returns full token list with relaySupported and notes. Used by the relay service (smom-dbis-138/services/relay).

See TOKEN_MAPPING_AND_MAINNET_ADDRESSES.md for the full table and recommendations.

  • CONTRACT_ADDRESSES_REFERENCE.md — Human-readable address list and service config.
  • contract-addresses.conf — Legacy shell config for Blockscout verification; still sourced by load-contract-addresses.sh. Keep Oracle (and other) addresses aligned with smart-contracts-master.json (chains.138.contracts).