// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "../UsdtLotteryRound.sol"; import "./ImmutableVrfAdapter.sol"; /// @notice Constructor-only atomic deployment. No operator can rebind an adapter or round. contract UsdtRoundBootstrapper { address public immutable adapter; address public immutable round; error InvalidConfig(); constructor(UsdtLotteryRound.Config memory c, ImmutableVrfAdapter.Config memory oracle) { if (c.randomness != address(0)) revert InvalidConfig(); // New contract nonce starts at 1. Adapter is the first CREATE, round the second. address expectedRound = address(uint160(uint256(keccak256(abi.encodePacked(hex"d694", address(this), hex"02"))))); adapter = address(new ImmutableVrfAdapter(expectedRound, oracle)); c.randomness = adapter; address deployed = address(new UsdtLotteryRound(c)); if (deployed != expectedRound) revert InvalidConfig(); round = deployed; } }