-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add deployer script for factory and implementation
- Loading branch information
Showing
2 changed files
with
55 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 |
---|---|---|
|
@@ -3,6 +3,8 @@ node_modules/ | |
.env | ||
cairo_project.toml | ||
|
||
ethereum/broadcast/ | ||
|
||
build/ | ||
cache/ | ||
out/ | ||
|
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,53 @@ | ||
pragma solidity ^0.8.19; | ||
|
||
import { Script } from "forge-std/Script.sol"; | ||
import {L1AvatarExecutionStrategy} from "../src/execution-strategies/L1AvatarExecutionStrategy.sol"; | ||
import {L1AvatarExecutionStrategyFactory} from "../src/execution-strategies/L1AvatarExecutionStrategyFactory.sol"; | ||
import { stdJson } from "forge-std/StdJson.sol"; | ||
|
||
contract Deployer is Script { | ||
string internal deployments; | ||
string internal deploymentsPath; | ||
|
||
error ImplementationInitializationFailed(); | ||
|
||
function run() public { | ||
|
||
vm.startBroadcast(); | ||
L1AvatarExecutionStrategy implementation = new L1AvatarExecutionStrategy(); | ||
address owner = vm.addr(vm.envUint("PRIVATE_KEY")); | ||
|
||
|
||
// If the master space is not initialized, initialize it | ||
address target = address(1); | ||
address starknetCore = address(2); | ||
uint256 executionRelayer = 3; | ||
uint256 quorum = 5; | ||
if (implementation.owner() == address(0x0)) { | ||
uint256[] memory starknetSpaces = new uint256[](1); | ||
starknetSpaces[0] = 4; | ||
implementation.setUp( | ||
owner, | ||
target, | ||
starknetCore, | ||
executionRelayer, | ||
starknetSpaces, | ||
quorum | ||
); | ||
} | ||
|
||
if (implementation.owner() != owner | ||
|| implementation.target() != address(0x1) | ||
|| implementation.starknetCore() != address(2) | ||
|| implementation.executionRelayer() != 3 | ||
|| implementation.quorum() != 5) { | ||
// Initialization failed (e.g. got frontran) | ||
revert ImplementationInitializationFailed(); | ||
} | ||
|
||
implementation.renounceOwnership(); | ||
|
||
L1AvatarExecutionStrategyFactory factory = new L1AvatarExecutionStrategyFactory(address(implementation)); | ||
vm.stopBroadcast(); | ||
} | ||
} |