Skip to content

Commit 43333f7

Browse files
authored
Add seaport 1.6 deployment scripts (#286)
1 parent 434bb18 commit 43333f7

File tree

5 files changed

+299
-0
lines changed

5 files changed

+299
-0
lines changed

script/trading/seaport16/DeployConduitController.s.sol

Lines changed: 58 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 {AccessControlledDeployer} from "../../../contracts/deployer/AccessControlledDeployer.sol";
9+
import {IDeployer} from "@axelar-network/axelar-gmp-sdk-solidity/contracts/interfaces/IDeployer.sol";
10+
11+
/**
12+
* @title DeployImmutableSeaport
13+
* @notice This script deploys the ImmutableSeaport contract via CREATE2.
14+
* @dev This script assumes that the ConduitController contract has already been deployed.
15+
*/
16+
contract DeployImmutableSeaport is Script {
17+
address private constant accessControlledDeployerAddress = 0x0B5B1d92259b13D516cCd5a6E63d7D94Ea2A4836;
18+
address private constant create2DeployerAddress = 0x9df760a54b3B00cC8B3d70A37d45fa97cCfdb4Db;
19+
address private constant conduitControllerAddress = 0x00000000F9490004C11Cef243f5400493c00Ad63;
20+
address private constant immutableSeaportAddress = 0xbE737Cf2C122F83d1610C1224f7B99ca9d0E09f6;
21+
bytes32 private constant immutableSeaportDeploymentSalt = keccak256(abi.encodePacked("immutable-seaport16"));
22+
address private constant seaportInitialOwner = 0xdDA0d9448Ebe3eA43aFecE5Fa6401F5795c19333; // Immutable Deployer
23+
24+
function run() external {
25+
AccessControlledDeployer deployer = AccessControlledDeployer(accessControlledDeployerAddress);
26+
IDeployer create2Deployer = IDeployer(create2DeployerAddress);
27+
28+
// Check supplied immutableSeaportAddress matches the expected address based on current creationCode
29+
bytes memory immutableSeaportDeploymentBytecode = abi.encodePacked(
30+
type(ImmutableSeaport).creationCode,
31+
abi.encode(conduitControllerAddress, seaportInitialOwner)
32+
);
33+
address expectedImmutableSeaportAddress = create2Deployer.deployedAddress(immutableSeaportDeploymentBytecode, accessControlledDeployerAddress, immutableSeaportDeploymentSalt);
34+
console.log("Expected ImmutableSeaport address: %s", expectedImmutableSeaportAddress);
35+
require(expectedImmutableSeaportAddress == immutableSeaportAddress, "Expected ImmutableSeaport address mismatch");
36+
37+
vm.startBroadcast();
38+
39+
// Deploy ImmutableSeaport if it doesn't already exist
40+
if (immutableSeaportAddress.code.length == 0) {
41+
console.log("Deploying ImmutableSeaport");
42+
address deployedImmutableSeaportAddress = deployer.deploy(create2Deployer, immutableSeaportDeploymentBytecode, immutableSeaportDeploymentSalt);
43+
require(deployedImmutableSeaportAddress == immutableSeaportAddress, "Deployed ImmutableSeaport address mismatch");
44+
} else {
45+
console.log("Skipping ImmutableSeaport, already exists");
46+
}
47+
48+
vm.stopBroadcast();
49+
}
50+
}
51+
52+
// forge script script/trading/seaport16/DeployImmutableSeaport.s.sol --rpc-url "https://rpc.testnet.immutable.com" -vvvv --priority-gas-price 10000000000 --with-gas-price 11000000000 --private-key=xx
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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

script/trading/seaport16/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Seaport Deployment Scripts
2+
3+
This directory contains scripts for deploying a set of contracts required to support a Seaport 1.6 trading system. It assumes a ledger wallet is used.
4+
5+
## Environment Variables
6+
7+
The following environment variables must be specified for all scripts. They can be supplied vai the environment or a `.env` file.
8+
9+
* `DRY_RUN`: `true` or `false`.
10+
* `IMMUTABLE_NETWORK`: Must be `mainnet` for Immutable zkEVM Mainnet or `testnet` for Testnet.
11+
* `HD_PATH`: Hierarchical Deterministic path for the ledger wallet. Should of the form `HD_PATH="m/44'/60'/0'/0/0"`.
12+
* `BLOCKSCOUT_APIKEY`: API key for verifying contracts on Blockscout. The key for use with Immutable zkEVM Mainnet will be different to the one used for Testnet. API keys for Immtuable zkEVM Mainnet can be obtained in the [block explorer](https://explorer.immutable.com/account/api-key).
13+
14+
## Deployment
15+
16+
Deploy via the following command:
17+
18+
`./script/trading/seaport16/deploy.sh <CONTRACT_TO_DEPLOY>`
19+
20+
where `CONTRACT_TO_DEPLOY` is one of `ConduitController`, `ImmutableSeaport` or `ImmutableSignedZoneV3`.

script/trading/seaport16/deploy.sh

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/bin/bash
2+
3+
# Load the .env file if it exists
4+
if [ -f .env ]
5+
then
6+
set -a; source .env; set +a
7+
fi
8+
9+
if [ -z "${DRY_RUN}" ]; then
10+
echo "Error: DRY_RUN variable is not set"
11+
exit 1
12+
fi
13+
14+
if [[ "$DRY_RUN" == "true" ]]; then
15+
echo "Dry run mode"
16+
elif [[ "$DRY_RUN" == "false" ]]; then
17+
echo "Broadcast mode"
18+
else
19+
echo "Error: DRY_RUN must be either true or false"
20+
exit 1
21+
fi
22+
23+
if [ -z "${IMMUTABLE_NETWORK}" ]; then
24+
echo "Error: IMMUTABLE_NETWORK variable is not set"
25+
exit 1
26+
fi
27+
28+
if [[ "$IMMUTABLE_NETWORK" == "mainnet" ]]; then
29+
echo Immutable zkEVM Mainnet Configuration
30+
IMMUTABLE_RPC=https://rpc.immutable.com
31+
BLOCKSCOUT_URI=https://explorer.immutable.com/api?
32+
elif [[ "$IMMUTABLE_NETWORK" == "testnet" ]]; then
33+
echo Immutable zkEVM Testnet Configuration
34+
IMMUTABLE_RPC=https://rpc.testnet.immutable.com
35+
BLOCKSCOUT_URI=https://explorer.testnet.immutable.com/api?
36+
else
37+
echo "Error: IMMUTABLE_NETWORK must be either mainnet or testnet"
38+
exit 1
39+
fi
40+
41+
if [ -z "${HD_PATH}" ]; then
42+
echo "Error: HD_PATH environment variable is not set"
43+
exit 1
44+
fi
45+
46+
if [ -z "${BLOCKSCOUT_APIKEY}" ]; then
47+
echo "Error: BLOCKSCOUT_APIKEY environment variable is not set"
48+
exit 1
49+
fi
50+
51+
# Check if an argument was provided
52+
if [ -z "$1" ]; then
53+
echo "Error: No argument provided."
54+
echo "Usage: $0 <ConduitController|ImmutableSeaport|ImmutableSignedZoneV3>"
55+
exit 1
56+
fi
57+
58+
contract_to_deploy="$1"
59+
if [[ "$contract_to_deploy" == "ConduitController" ]]; then
60+
script=script/trading/seaport16/DeployConduitController.s.sol
61+
elif [[ "$contract_to_deploy" == "ImmutableSeaport" ]]; then
62+
script=script/trading/seaport16/DeployImmutableSeaport.s.sol
63+
elif [[ "$contract_to_deploy" == "ImmutableSignedZoneV3" ]]; then
64+
script=script/trading/seaport16/DeployImmutableSignedZoneV3.s.sol
65+
else
66+
echo "Error: contract to deploy must be either ConduitController, ImmutableSeaport or ImmutableSignedZoneV3"
67+
exit 1
68+
fi
69+
70+
echo "Configuration"
71+
echo " DRY_RUN: $DRY_RUN"
72+
echo " IMMUTABLE_RPC: $IMMUTABLE_RPC"
73+
echo " BLOCKSCOUT_URI: $BLOCKSCOUT_URI"
74+
echo " BLOCKSCOUT_APIKEY: $BLOCKSCOUT_APIKEY"
75+
echo " Script to execute: $script"
76+
77+
# NOTE WELL ---------------------------------------------
78+
# Add resume option if the script fails part way through:
79+
# --resume \
80+
# To record the transactions but not execute them, remove the --broadcast line.
81+
# NOTE WELL ---------------------------------------------
82+
if [[ "$DRY_RUN" == "true" ]]; then
83+
forge script \
84+
--rpc-url $IMMUTABLE_RPC \
85+
--priority-gas-price 10000000000 \
86+
--with-gas-price 10000000100 \
87+
-vvvv \
88+
--ledger \
89+
--hd-paths "$HD_PATH" \
90+
$script
91+
else
92+
forge script \
93+
--rpc-url $IMMUTABLE_RPC \
94+
--priority-gas-price 10000000000 \
95+
--with-gas-price 10000000100 \
96+
-vvvv \
97+
--broadcast \
98+
--verify \
99+
--verifier blockscout \
100+
--verifier-url $BLOCKSCOUT_URI$BLOCKSCOUT_APIKEY \
101+
--ledger \
102+
--hd-paths "$HD_PATH" \
103+
$script
104+
fi

0 commit comments

Comments
 (0)