// SPDX-License-Identifier: MIT pragma solidity ^0.8.11; import "forge-std/Script.sol"; import "forge-std/console2.sol"; import { Forwarder } from "tw/infra/forwarder/Forwarder.sol"; import { TWRegistry } from "tw/infra/TWRegistry.sol"; import { TWFactory } from "tw/infra/TWFactory.sol"; import { ContractPublisher } from "tw/infra/ContractPublisher.sol"; import { IContractPublisher } from "tw/infra/interface/IContractPublisher.sol"; /// @notice Deploys Thirdweb on-chain infra: Forwarder → TWRegistry → TWFactory → ContractPublisher. /// @dev Intended RPC: VMID 2103 — http://192.168.11.217:8545 (chain 138). Use `--legacy --with-gas-price 1000000000`. contract DeployThirdwebCore is Script { function run() external { // Use `forge script ... --private-key ... --broadcast`; tx.origin is the broadcaster. vm.startBroadcast(); address deployer = tx.origin; Forwarder forwarder = new Forwarder(); address tf = address(forwarder); TWRegistry registry = new TWRegistry(tf); TWFactory factory = new TWFactory(tf, address(registry)); ContractPublisher publisher = new ContractPublisher(deployer, tf, IContractPublisher(address(0))); vm.stopBroadcast(); console2.log("Forwarder", address(forwarder)); console2.log("TWRegistry", address(registry)); console2.log("TWFactory", address(factory)); console2.log("ContractPublisher", address(publisher)); } }