Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions script/025DeployOPSpokePool.s.sol
Original file line number Diff line number Diff line change
@@ -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/025DeployOPSpokePool.s.sol:DeployOPSpokePool --rpc-url $NODE_URL_1 -vvvv
// 3. Verify the above works in simulation mode.
// 4. Deploy with:
// 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 {
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 1? Why not 1_000_000 as in the other spoke pool deploy scripts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the deploy scripts have 1 and others have 1_000_000. Changed it to 1_000_000 and added a comment

info.hubPool, // _crossDomainAdmin
info.hubPool // _withdrawalRecipient
);

// Deploy the proxy
DeploymentResult memory result = deployNewProxy(
"OP_SpokePool",
constructorArgs,
initArgs,
false // 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();
}
}
Loading