# Truth Network scripts Scripts for deploying and registering Truth Network (TRUU) with Chain 138’s ChainRegistry and for fetching chain constants/ABIs. ## Environment Set in `smom-dbis-138/.env` or repo `.env`: - `RPC_URL_138` – Chain 138 RPC URL - `PRIVATE_KEY` – deployer key (no `0x` prefix) - `CHAIN_REGISTRY_ADDRESS_138` – ChainRegistry proxy on Chain 138 (set by one-shot deploy) - `TRUTH_ADAPTER_ADDRESS_138` – TruthNetworkAdapter on Chain 138 (set after deploying adapter) ## One-shot deploy and register From repo root: ```bash ./scripts/truth-network/deploy-chain-registry-and-truth.sh ``` This will: 1. Deploy `ChainRegistry` on Chain 138 if `CHAIN_REGISTRY_ADDRESS_138` is not set, and append it to `smom-dbis-138/.env`. 2. Deploy `TruthNetworkAdapter` and register Truth Network in ChainRegistry. If the TruthNetworkAdapter step fails with “Could not parse deployed address”, Forge is running in dry-run (e.g. in CI/sandbox). Run the broadcast from your own terminal: ```bash cd smom-dbis-138 && forge create contracts/registry/TruthNetworkAdapter.sol:TruthNetworkAdapter \ --rpc-url "$RPC_URL_138" --private-key "$PRIVATE_KEY" \ --constructor-args 0x50c02710b06d6AdDb864D6b038010eF6fA1BCd92 \ --with-gas-price 1000000000 --legacy --broadcast ``` Then set `TRUTH_ADAPTER_ADDRESS_138` in `smom-dbis-138/.env` to the “Deployed to: 0x…” address and run only the register step: ```bash ./scripts/truth-network/deploy-and-register-truth-on-chain138.sh --register-only ``` ## Other scripts - **`deploy-and-register-truth-on-chain138.sh`** – Deploy TruthNetworkAdapter (if needed) and register Truth in ChainRegistry. Use `--register-only` to skip deploy. - **`register-truth-in-chain-registry.sh`** – Register Truth in ChainRegistry only (requires `TRUTH_ADAPTER_ADDRESS_138`). - **`fetch-truth-chain-constants.sh`** – Fetch Truth Network chain constants (WSS) into `config/truth-chain-constants.json`. - **`fetch-etherscan-abi.sh`** – Fetch verified ABIs for Truth Bridge and TRUU token from Etherscan. ## References - `docs/07-ccip/TRUTH_NETWORK_BRIDGE_SPEC.md` – Bridge and integration spec.