-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ac51750
commit 3f93cec
Showing
6 changed files
with
67 additions
and
36 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,28 @@ | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
pragma solidity >=0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
|
||
interface Deployer { | ||
event ContractCreation(address indexed newContract, bytes32 indexed salt); | ||
|
||
function deployCreate3( | ||
bytes32 salt, | ||
bytes memory initCode | ||
) external payable returns (address newContract); | ||
|
||
function deployCreate2( | ||
bytes32 salt, | ||
bytes memory initCode | ||
) external payable returns (address newContract); | ||
} | ||
|
||
// Deploy a contract to a deterministic address with create2 | ||
contract BaseScript is Script { | ||
|
||
Deployer public deployer = Deployer(0xba5Ed099633D3B313e4D5F7bdc1305d3c28ba5Ed); | ||
|
||
address public v3Safe = 0x33333333D5eFb92f19a5F94a43456b3cec2797AE; | ||
|
||
address public initGov; | ||
} |
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
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,24 @@ | ||
// SPDX-License-Identifier: AGPL-3.0 | ||
pragma solidity >=0.8.18; | ||
|
||
import "./BaseScript.sol"; | ||
|
||
// Deploy a contract to a deterministic address with create2 | ||
contract DeployAuctionFactory is BaseScript { | ||
|
||
function run() external { | ||
vm.startBroadcast(); | ||
|
||
// Get the bytecode | ||
bytes memory bytecode = abi.encodePacked(vm.getCode("InitGov.sol:InitGov")); | ||
|
||
// Pick an unique salt | ||
bytes32 salt = keccak256("Init Gov"); | ||
|
||
address contractAddress = deployer.deployCreate2(salt, bytecode); | ||
|
||
console.log("Address is ", contractAddress); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |