-
Notifications
You must be signed in to change notification settings - Fork 75
feat: Added OP foundry deploy script #1131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2d3acf1
feat: Added OP foundry deploy script
fusmanii 8bb0b15
udpate contract name
fusmanii 0625b2f
feedback
fusmanii 2e0616f
Merge branch 'master' of github.com:across-protocol/contracts into fa…
fusmanii d545e26
Added a comment on deposit id
fusmanii af12fd6
updated comment
fusmanii File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| 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(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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_000and added a comment