-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dock-registry): add deterministic deployment and Makefile shortcut
- Loading branch information
1 parent
b3cd6bd
commit 24dbde2
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,23 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.26; | ||
|
||
import { BaseScript } from "./Base.s.sol"; | ||
import { DockRegistry } from "./../src/DockRegistry.sol"; | ||
import { ModuleKeeper } from "./../src/ModuleKeeper.sol"; | ||
|
||
/// @notice Deploys at deterministic addresses across chains an instance of {DockRegistry} | ||
/// @dev Reverts if any contract has already been deployed | ||
contract DeployDeterministicDockRegistry is BaseScript { | ||
/// @dev By using a salt, Forge will deploy the contract via a deterministic CREATE2 factory | ||
/// https://book.getfoundry.sh/tutorials/create2-tutorial?highlight=deter#deterministic-deployment-using-create2 | ||
function run( | ||
string memory create2Salt, | ||
address initialOwner, | ||
ModuleKeeper moduleKeeper | ||
) public virtual broadcast returns (DockRegistry dockRegistry) { | ||
bytes32 salt = bytes32(abi.encodePacked(create2Salt)); | ||
|
||
// Deterministically deploy a {DockRegistry} contract | ||
dockRegistry = new DockRegistry{ salt: salt }(initialOwner, moduleKeeper); | ||
} | ||
} |