-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: multi-chain deployment script (#748)
* build: add deploy multi chains script build: remove etherscan api keys in foundry.toml feat: add deploy core 3 scripts chore: improve .env.example file * build: add arbitrum sepolia chore: git ignore deployments dir * chore: update wording in scripts chore: remove forge fmt comment * refactor: separate base env from deployment env chore: improve multi-chain deployment script refactor: rename env var MAX_SEGMENT_COUNT * refactor: rename multi-chain script * chore: fix arbitrum config key * fix: use array to create deployment command * chore: create an array for deployment command * Powerful command line options for deployment script (#752) * build: add script to generate deployment command * feat: new command-line options for deploy-multi-chain command * chore: continue for warnings and throw for errors * perf: polish deployment script --------- Co-authored-by: Paul Razvan Berg <[email protected]> * refactor: hard code admin addresses --------- Co-authored-by: andreivladbrg <[email protected]> Co-authored-by: smol-ninja <[email protected]>
- Loading branch information
1 parent
b001643
commit 7819a3b
Showing
7 changed files
with
539 additions
and
2 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,30 @@ | ||
# Used by the multi-chain deployment script | ||
|
||
# General | ||
export MAX_SEGMENT_COUNT="THE_MAX_SEGMENT_COUNT" | ||
export MNEMONIC="YOUR_MNEMONIC" | ||
|
||
# RPC URLs | ||
export ARBITRUM_RPC_URL="YOUR_RPC_URL" | ||
export ARBITRUM_SEPOLIA_RPC_URL="YOUR_RPC_URL" | ||
export AVALANCHE_RPC_URL="YOUR_RPC_URL" | ||
export BASE_RPC_URL="YOUR_RPC_URL" | ||
export BSC_RPC_URL="YOUR_RPC_URL" | ||
export GNOSIS_RPC_URL="YOUR_RPC_URL" | ||
export MAINNET_RPC_URL="YOUR_RPC_URL" | ||
export OPTIMISM_RPC_URL="YOUR_RPC_URL" | ||
export POLYGON_RPC_URL="YOUR_RPC_URL" | ||
export SCROLL_RPC_URL="YOUR_RPC_URL" | ||
export SEPOLIA_RPC_URL="YOUR_RPC_URL" | ||
|
||
# Etherscan API keys | ||
export ARBISCAN_API_KEY="YOUR_API_KEY" | ||
export BASESCAN_API_KEY="YOUR_API_KEY" | ||
export BSCSCAN_API_KEY="YOUR_API_KEY" | ||
export ETHERSCAN_API_KEY="YOUR_API_KEY" | ||
export GNOSISSCAN_API_KEY="YOUR_API_KEY" | ||
export OPTIMISTIC_API_KEY="YOUR_API_KEY" | ||
export POLYGONSCAN_API_KEY="YOUR_API_KEY" | ||
export SCROLLSCAN_API_KEY="YOUR_API_KEY" | ||
export SNOWTRACE_API_KEY="YOUR_API_KEY" | ||
|
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,35 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity >=0.8.19 <0.9.0; | ||
|
||
import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol"; | ||
import { SablierV2NFTDescriptor } from "../src/SablierV2NFTDescriptor.sol"; | ||
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol"; | ||
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol"; | ||
|
||
import { BaseScript } from "./Base.s.sol"; | ||
|
||
/// @notice Deploys these contracts in the following order: | ||
/// | ||
/// 1. {SablierV2NFTDescriptor} | ||
/// 2. {SablierV2LockupDynamic} | ||
/// 3. {SablierV2LockupLinear} | ||
contract DeployCore3 is BaseScript { | ||
function run( | ||
address initialAdmin, | ||
ISablierV2Comptroller comptroller, | ||
uint256 maxSegmentCount | ||
) | ||
public | ||
virtual | ||
broadcast | ||
returns ( | ||
SablierV2NFTDescriptor nftDescriptor, | ||
SablierV2LockupDynamic lockupDynamic, | ||
SablierV2LockupLinear lockupLinear | ||
) | ||
{ | ||
nftDescriptor = new SablierV2NFTDescriptor(); | ||
lockupDynamic = new SablierV2LockupDynamic(initialAdmin, comptroller, nftDescriptor, maxSegmentCount); | ||
lockupLinear = new SablierV2LockupLinear(initialAdmin, comptroller, nftDescriptor); | ||
} | ||
} |
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,42 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity >=0.8.19 <0.9.0; | ||
|
||
import { ISablierV2Comptroller } from "../src/interfaces/ISablierV2Comptroller.sol"; | ||
import { SablierV2NFTDescriptor } from "../src/SablierV2NFTDescriptor.sol"; | ||
import { SablierV2LockupDynamic } from "../src/SablierV2LockupDynamic.sol"; | ||
import { SablierV2LockupLinear } from "../src/SablierV2LockupLinear.sol"; | ||
|
||
import { BaseScript } from "./Base.s.sol"; | ||
|
||
/// @notice Deploys these contracts at deterministic addresses across chains, in the following order: | ||
/// | ||
/// 1. {SablierV2NFTDescriptor} | ||
/// 2. {SablierV2LockupDynamic} | ||
/// 3. {SablierV2LockupLinear} | ||
/// | ||
/// @dev Reverts if any contract has already been deployed. | ||
contract DeployDeterministicCore3 is BaseScript { | ||
/// @dev The presence of the salt instructs Forge to deploy the contract via a deterministic CREATE2 factory. | ||
/// https://github.com/Arachnid/deterministic-deployment-proxy | ||
function run( | ||
string memory create2Salt, | ||
address initialAdmin, | ||
ISablierV2Comptroller comptroller, | ||
uint256 maxSegmentCount | ||
) | ||
public | ||
virtual | ||
broadcast | ||
returns ( | ||
SablierV2NFTDescriptor nftDescriptor, | ||
SablierV2LockupDynamic lockupDynamic, | ||
SablierV2LockupLinear lockupLinear | ||
) | ||
{ | ||
bytes32 salt = bytes32(abi.encodePacked(create2Salt)); | ||
nftDescriptor = new SablierV2NFTDescriptor{ salt: salt }(); | ||
lockupDynamic = | ||
new SablierV2LockupDynamic{ salt: salt }(initialAdmin, comptroller, nftDescriptor, maxSegmentCount); | ||
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, comptroller, nftDescriptor); | ||
} | ||
} |
Oops, something went wrong.