From 2d3acf1545b713ef3bf99c36f7994f4f0f453259 Mon Sep 17 00:00:00 2001 From: Faisal Usmani Date: Tue, 7 Oct 2025 14:48:13 -0400 Subject: [PATCH 1/5] feat: Added OP foundry deploy script --- script/025DeployOPSpokePool.s.sol | 72 +++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 script/025DeployOPSpokePool.s.sol diff --git a/script/025DeployOPSpokePool.s.sol b/script/025DeployOPSpokePool.s.sol new file mode 100644 index 000000000..b7385d717 --- /dev/null +++ b/script/025DeployOPSpokePool.s.sol @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: BUSL-1.1 +pragma solidity ^0.8.0; + +import { Script } from "forge-std/Script.sol"; +import { Test } from "forge-std/Test.sol"; +import { console } from "forge-std/console.sol"; +import { OP_SpokePool } from "../contracts/OP_SpokePool.sol"; +import { DeploymentUtils } from "./utils/DeploymentUtils.sol"; + +// How to run: +// 1. `source .env` where `.env` has MNEMONIC="x x x ... x" +// 2. forge script script/039DeployModeSpokePool.s.sol:DeployModeSpokePool --rpc-url $NODE_URL_1 -vvvv +// 3. Verify the above works in simulation mode. +// 4. Deploy with: +// forge script script/039DeployModeSpokePool.s.sol:DeployModeSpokePool --rpc-url \ +// $NODE_URL_1 --broadcast --verify --verifier blockscout --verifier-url https://explorer.mode.network/api + +contract DeployModeSpokePool is Script, Test, DeploymentUtils { + function run() external { + string memory deployerMnemonic = vm.envString("MNEMONIC"); + uint256 deployerPrivateKey = vm.deriveKey(deployerMnemonic, 0); + + // Get deployment information + DeploymentInfo memory info = getSpokePoolDeploymentInfo(address(0)); + + // Get the appropriate addresses for this chain + address weth = getWrappedNativeToken(info.spokeChainId); + address cctpTokenMessenger = getL2Address(info.spokeChainId, "cctpV2TokenMessenger"); + address l2Usdc = getUSDCAddress(info.spokeChainId); + + vm.startBroadcast(deployerPrivateKey); + + // Prepare constructor arguments for OP_SpokePool + bytes memory constructorArgs = abi.encode( + weth, // _wrappedNativeTokenAddress + QUOTE_TIME_BUFFER(), // _depositQuoteTimeBuffer + FILL_DEADLINE_BUFFER(), // _fillDeadlineBuffer + l2Usdc, // _l2Usdc + cctpTokenMessenger // _cctpTokenMessenger + ); + + // Initialize deposit counter to 1 + // Set hub pool as cross domain admin since it delegatecalls the Adapter logic. + bytes memory initArgs = abi.encodeWithSelector( + OP_SpokePool.initialize.selector, + 1, // _initialDepositId + info.hubPool, // _crossDomainAdmin + info.hubPool // _withdrawalRecipient + ); + + // Deploy the proxy + DeploymentResult memory result = deployNewProxy( + "OP_SpokePool", + constructorArgs, + initArgs, + true // implementationOnly + ); + + // Log the deployed addresses + console.log("Chain ID:", info.spokeChainId); + console.log("Hub Chain ID:", info.hubChainId); + console.log("HubPool address:", info.hubPool); + console.log("WETH address:", weth); + console.log("OP_SpokePool proxy deployed to:", result.proxy); + console.log("OP_SpokePool implementation deployed to:", result.implementation); + + console.log("QUOTE_TIME_BUFFER()", QUOTE_TIME_BUFFER()); + console.log("FILL_DEADLINE_BUFFER()", FILL_DEADLINE_BUFFER()); + + vm.stopBroadcast(); + } +} From 8bb0b15ff86ff2f1e22747bace5a299b185d9d34 Mon Sep 17 00:00:00 2001 From: Faisal Usmani Date: Tue, 7 Oct 2025 14:49:28 -0400 Subject: [PATCH 2/5] udpate contract name --- script/025DeployOPSpokePool.s.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/025DeployOPSpokePool.s.sol b/script/025DeployOPSpokePool.s.sol index b7385d717..2c79bb2f7 100644 --- a/script/025DeployOPSpokePool.s.sol +++ b/script/025DeployOPSpokePool.s.sol @@ -9,13 +9,13 @@ import { DeploymentUtils } from "./utils/DeploymentUtils.sol"; // How to run: // 1. `source .env` where `.env` has MNEMONIC="x x x ... x" -// 2. forge script script/039DeployModeSpokePool.s.sol:DeployModeSpokePool --rpc-url $NODE_URL_1 -vvvv +// 2. forge script script/039DeployOPSpokePool.s.sol:DeployOPSpokePool --rpc-url $NODE_URL_1 -vvvv // 3. Verify the above works in simulation mode. // 4. Deploy with: -// forge script script/039DeployModeSpokePool.s.sol:DeployModeSpokePool --rpc-url \ +// forge script script/039DeployOPSpokePool.s.sol:DeployOPSpokePool --rpc-url \ // $NODE_URL_1 --broadcast --verify --verifier blockscout --verifier-url https://explorer.mode.network/api -contract DeployModeSpokePool is Script, Test, DeploymentUtils { +contract DeployOPSpokePool is Script, Test, DeploymentUtils { function run() external { string memory deployerMnemonic = vm.envString("MNEMONIC"); uint256 deployerPrivateKey = vm.deriveKey(deployerMnemonic, 0); From 0625b2f24f0496804e33a02ca987a978fcf062b2 Mon Sep 17 00:00:00 2001 From: Faisal Usmani Date: Wed, 8 Oct 2025 07:54:02 -0400 Subject: [PATCH 3/5] feedback Signed-off-by: Faisal Usmani --- script/025DeployOPSpokePool.s.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/script/025DeployOPSpokePool.s.sol b/script/025DeployOPSpokePool.s.sol index 2c79bb2f7..6fd10d420 100644 --- a/script/025DeployOPSpokePool.s.sol +++ b/script/025DeployOPSpokePool.s.sol @@ -9,10 +9,10 @@ import { DeploymentUtils } from "./utils/DeploymentUtils.sol"; // How to run: // 1. `source .env` where `.env` has MNEMONIC="x x x ... x" -// 2. forge script script/039DeployOPSpokePool.s.sol:DeployOPSpokePool --rpc-url $NODE_URL_1 -vvvv +// 2. forge script script/025DeployOPSpokePool.s.sol:DeployOPSpokePool --rpc-url $NODE_URL_1 -vvvv // 3. Verify the above works in simulation mode. // 4. Deploy with: -// forge script script/039DeployOPSpokePool.s.sol:DeployOPSpokePool --rpc-url \ +// forge script script/025DeployOPSpokePool.s.sol:DeployOPSpokePool --rpc-url \ // $NODE_URL_1 --broadcast --verify --verifier blockscout --verifier-url https://explorer.mode.network/api contract DeployOPSpokePool is Script, Test, DeploymentUtils { @@ -53,7 +53,7 @@ contract DeployOPSpokePool is Script, Test, DeploymentUtils { "OP_SpokePool", constructorArgs, initArgs, - true // implementationOnly + false // implementationOnly ); // Log the deployed addresses From d545e26cd581570504d16b3a6c0f49f363b2a68a Mon Sep 17 00:00:00 2001 From: Faisal Usmani Date: Mon, 27 Oct 2025 10:22:14 -0400 Subject: [PATCH 4/5] Added a comment on deposit id Signed-off-by: Faisal Usmani --- script/025DeployOPSpokePool.s.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script/025DeployOPSpokePool.s.sol b/script/025DeployOPSpokePool.s.sol index 6fd10d420..713be4916 100644 --- a/script/025DeployOPSpokePool.s.sol +++ b/script/025DeployOPSpokePool.s.sol @@ -43,7 +43,9 @@ contract DeployOPSpokePool is Script, Test, DeploymentUtils { // Set hub pool as cross domain admin since it delegatecalls the Adapter logic. bytes memory initArgs = abi.encodeWithSelector( OP_SpokePool.initialize.selector, - 1, // _initialDepositId + // Note: Ensure that this is very high number of deposits to avoid duplicate deposit ID's + // with deprecated spoke pool. + 1_000_000, // _initialDepositId info.hubPool, // _crossDomainAdmin info.hubPool // _withdrawalRecipient ); From af12fd6fca70e1dc8928b5dbfb86fa2ddfe31d1c Mon Sep 17 00:00:00 2001 From: Faisal Usmani Date: Mon, 27 Oct 2025 10:30:55 -0400 Subject: [PATCH 5/5] updated comment Signed-off-by: Faisal Usmani --- script/025DeployOPSpokePool.s.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/025DeployOPSpokePool.s.sol b/script/025DeployOPSpokePool.s.sol index 713be4916..495052263 100644 --- a/script/025DeployOPSpokePool.s.sol +++ b/script/025DeployOPSpokePool.s.sol @@ -43,8 +43,8 @@ contract DeployOPSpokePool is Script, Test, DeploymentUtils { // Set hub pool as cross domain admin since it delegatecalls the Adapter logic. bytes memory initArgs = abi.encodeWithSelector( OP_SpokePool.initialize.selector, - // Note: Ensure that this is very high number of deposits to avoid duplicate deposit ID's - // with deprecated spoke pool. + // Note: If this is a re-deployment of the spoke pool proxy, set this to a very high number of + // deposits to avoid duplicate deposit IDs with deprecated spoke pool. Should be set to 1 otherwise. 1_000_000, // _initialDepositId info.hubPool, // _crossDomainAdmin info.hubPool // _withdrawalRecipient