|
| 1 | +// Copyright (c) Immutable Pty Ltd 2018 - 2025 |
| 2 | +// SPDX-License-Identifier: Apache-2 |
| 3 | +pragma solidity 0.8.24; |
| 4 | + |
| 5 | +import {console} from "forge-std/console.sol"; |
| 6 | +import {Script} from "forge-std/Script.sol"; |
| 7 | +import {ImmutableSeaport} from "../../../contracts/trading/seaport16/ImmutableSeaport.sol"; |
| 8 | +import {ImmutableSignedZoneV3} from "../../../contracts/trading/seaport16/zones/immutable-signed-zone/v3/ImmutableSignedZoneV3.sol"; |
| 9 | +import {AccessControlledDeployer} from "../../../contracts/deployer/AccessControlledDeployer.sol"; |
| 10 | +import {IDeployer} from "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IDeployer.sol"; |
| 11 | + |
| 12 | +/** |
| 13 | + * @title DeployImmutableSignedZoneV3 |
| 14 | + * @notice This script deploys the ImmutableSignedZoneV3 contract via CREATE2. |
| 15 | + * @dev This script assumes that the ImmutableSeaport contract has already been deployed. |
| 16 | + */ |
| 17 | +contract DeployImmutableSignedZoneV3 is Script { |
| 18 | + address private constant accessControlledDeployerAddress = 0x0B5B1d92259b13D516cCd5a6E63d7D94Ea2A4836; |
| 19 | + address private constant create2DeployerAddress = 0x9df760a54b3B00cC8B3d70A37d45fa97cCfdb4Db; |
| 20 | + address private constant conduitControllerAddress = 0x00000000F9490004C11Cef243f5400493c00Ad63; |
| 21 | + address private constant immutableSeaportAddress = 0xbE737Cf2C122F83d1610C1224f7B99ca9d0E09f6; |
| 22 | + bytes32 private constant immutableSeaportDeploymentSalt = keccak256(abi.encodePacked("immutable-seaport16")); |
| 23 | + address private constant zoneAddress = 0x18C12fb9c4f6165196c895aDF84230828A85B247; |
| 24 | + bytes32 private constant zoneDeploymentSalt = keccak256(abi.encodePacked("immutable-signed-zone-v3")); |
| 25 | + address private constant seaportInitialOwner = 0xdDA0d9448Ebe3eA43aFecE5Fa6401F5795c19333; // Immutable Deployer |
| 26 | + address private constant zoneInitialOwner = 0xdDA0d9448Ebe3eA43aFecE5Fa6401F5795c19333; // Immutable Deployer |
| 27 | + |
| 28 | + function run() external { |
| 29 | + AccessControlledDeployer deployer = AccessControlledDeployer(accessControlledDeployerAddress); |
| 30 | + IDeployer create2Deployer = IDeployer(create2DeployerAddress); |
| 31 | + |
| 32 | + // Check supplied immutableSeaportAddress matches the expected address based on current creationCode |
| 33 | + bytes memory immutableSeaportDeploymentBytecode = abi.encodePacked( |
| 34 | + type(ImmutableSeaport).creationCode, |
| 35 | + abi.encode(conduitControllerAddress, seaportInitialOwner) |
| 36 | + ); |
| 37 | + address expectedImmutableSeaportAddress = create2Deployer.deployedAddress(immutableSeaportDeploymentBytecode, accessControlledDeployerAddress, immutableSeaportDeploymentSalt); |
| 38 | + console.log("Expected ImmutableSeaport address: %s", expectedImmutableSeaportAddress); |
| 39 | + require(expectedImmutableSeaportAddress == immutableSeaportAddress, "Expected ImmutableSeaport address mismatch"); |
| 40 | + |
| 41 | + // Check supplied zoneAddress matches the expected address based on current creationCode |
| 42 | + bytes memory zoneDeploymentBytecode = abi.encodePacked( |
| 43 | + type(ImmutableSignedZoneV3).creationCode, |
| 44 | + abi.encode("ImmutableSignedZone", immutableSeaportAddress, "", "", zoneInitialOwner) |
| 45 | + ); |
| 46 | + address expectedZoneAddress = create2Deployer.deployedAddress(zoneDeploymentBytecode, accessControlledDeployerAddress, zoneDeploymentSalt); |
| 47 | + console.log("Expected ImmutableSignedZoneV3 address: %s", expectedZoneAddress); |
| 48 | + require(expectedZoneAddress == zoneAddress, "Expected ImmutableSignedZoneV3 address mismatch"); |
| 49 | + |
| 50 | + vm.startBroadcast(); |
| 51 | + |
| 52 | + // Deploy zone if it doesn't already exist |
| 53 | + if (zoneAddress.code.length == 0) { |
| 54 | + console.log("Deploying ImmutableSignedZoneV3"); |
| 55 | + address deployedZoneAddress = deployer.deploy(create2Deployer, zoneDeploymentBytecode, zoneDeploymentSalt); |
| 56 | + require(deployedZoneAddress == zoneAddress, "Deployed ImmutableSignedZoneV3 address mismatch"); |
| 57 | + } else { |
| 58 | + console.log("Skipping ImmutableSignedZoneV3, already exists"); |
| 59 | + } |
| 60 | + |
| 61 | + vm.stopBroadcast(); |
| 62 | + } |
| 63 | +} |
| 64 | + |
| 65 | +// forge script script/trading/seaport16/DeployImmutableSignedZoneV3.s.sol --rpc-url "https://rpc.testnet.immutable.com" -vvvv --priority-gas-price 10000000000 --with-gas-price 11000000000 --private-key=xx |
0 commit comments