generated from hrkrshnn/tstore-template
-
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: add deployment and creation scripts
- Loading branch information
Showing
3 changed files
with
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.20; | ||
|
||
import "forge-std/Script.sol"; | ||
import {Create4Factory} from "src/Create4Factory.sol"; | ||
|
||
/** | ||
* @title Deploys the code present at `env.DEPLOYED_CODE_ADDRESS` with `env.DEPLOYED_CODE_SALT` through the canonical Create4Factory using the deployed code method from `addr(env.DEPLOYER_PRIVATE_KEY)` | ||
* @notice Only functional on networks with EIP-3855 support | ||
* @author dyedM1 | ||
*/ | ||
contract Create4Deployed is Script { | ||
function run() public { | ||
uint256 DEPLOYER_PRIVATE_KEY = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
bytes memory INIT_CODE = vm.envBytes("INIT_CODE"); | ||
bytes32 DEPLOYED_CODE_SALT = vm.envBytes32("DEPLOYED_CODE_SALT"); | ||
|
||
// Temporary Sepolia deployment; NOT FINAL! | ||
Create4Factory C4F = Create4Factory(payable(0x33A92AB4eBdf13D4D12E4bb0009c6CF7730e76d2)); | ||
|
||
vm.startBroadcast(DEPLOYER_PRIVATE_KEY); | ||
|
||
address deployedCode; | ||
assembly { | ||
deployedCode := create(0, add(INIT_CODE, 0x20), mload(INIT_CODE)) | ||
} | ||
|
||
C4F.create4(deployedCode, DEPLOYED_CODE_SALT); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
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,27 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.20; | ||
|
||
import "forge-std/Script.sol"; | ||
import {Create4Factory} from "src/Create4Factory.sol"; | ||
|
||
/** | ||
* @title Deploys `env.DEPLOYED_CODE` with `env.DEPLOYED_CODE_SALT` directly through the canonical Create4Factory using the transient storage method from `addr(env.DEPLOYER_PRIVATE_KEY)` | ||
* @notice Only functional on networks with EIP-1153 & EIP-3855 support | ||
* @author dyedM1 | ||
*/ | ||
contract Create4Transient is Script { | ||
function run() public { | ||
uint256 DEPLOYER_PRIVATE_KEY = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
bytes memory DEPLOYED_CODE = vm.envBytes("DEPLOYED_CODE"); | ||
bytes32 DEPLOYED_CODE_SALT = vm.envBytes32("DEPLOYED_CODE_SALT"); | ||
|
||
// Temporary Sepolia deployment; NOT FINAL! | ||
Create4Factory C4F = Create4Factory(payable(0x33A92AB4eBdf13D4D12E4bb0009c6CF7730e76d2)); | ||
|
||
vm.startBroadcast(DEPLOYER_PRIVATE_KEY); | ||
|
||
C4F.create4(DEPLOYED_CODE, DEPLOYED_CODE_SALT); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |
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,21 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.20; | ||
|
||
import "forge-std/Script.sol"; | ||
import {Create4Factory} from "src/Create4Factory.sol"; | ||
|
||
/** | ||
* @title Deploys an instance of Create4Factory | ||
* @author dyedM1 | ||
*/ | ||
contract DeployC4Factory is Script { | ||
function run() public { | ||
uint256 DEPLOYER_PRIVATE_KEY = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
|
||
vm.startBroadcast(DEPLOYER_PRIVATE_KEY); | ||
|
||
new Create4Factory(); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
} |