Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish deploy-multi-chain script #744

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ export MNEMONIC="YOUR_MNEMONIC"
export ARBITRUM_RPC_URL="YOUR_RPC_URL"
export AVALANCHE_RPC_URL="YOUR_RPC_URL"
export BASE_RPC_URL="YOUR_RPC_URL"
export BINANCE_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"
Expand All @@ -37,4 +38,7 @@ export MAINNET_ADMIN="YOUR_ADMIN_ADDRESS"
export OPTIMISM_ADMIN="YOUR_ADMIN_ADDRESS"
export POLYGON_ADMIN="YOUR_ADMIN_ADDRESS"
export SCROLL_ADMIN="YOUR_ADMIN_ADDRESS"
export SEPOLIA_ADMIN="YOUR_ADMIN_ADDRESS"

# The maximum number of segments allowed in a stream
export MAX_SEGMENTS_COUNT="THE_MAX_SEGMENT_COUNT"
18 changes: 9 additions & 9 deletions .github/workflows/ci-deep.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "CI Deep"
env:
API_KEY_ETHERSCAN: ${{ secrets.API_KEY_ETHERSCAN }}
API_KEY_INFURA: ${{ secrets.API_KEY_INFURA }}
RPC_URL_MAINNET: ${{ secrets.RPC_URL_MAINNET }}
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}

on:
schedule:
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
run: "FOUNDRY_PROFILE=optimized forge build"

- name: "Build the test contracts"
run: "FOUNDRY_PROFILE=test-optimized forge build"
run: "FOUNDRY_PROFILE=test-optimized forge build"

- name: "Cache the build so that it can be re-used by the other jobs"
uses: "actions/cache/save@v3"
Expand All @@ -103,7 +103,7 @@ jobs:
cache
out
out-optimized

- name: "Add build summary"
run: |
echo "## Build result" >> $GITHUB_STEP_SUMMARY
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "pnpm install"

- name: "Restore the cached build"
uses: "actions/cache/restore@v3"
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
cache
out
out-optimized

- name: "Run the integration tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test --match-path \"test/integration/**/*.sol\""

Expand Down Expand Up @@ -222,8 +222,8 @@ jobs:
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "pnpm install"


- name: "Restore the cached build"
uses: "actions/cache/restore@v3"
Expand All @@ -234,7 +234,7 @@ jobs:
cache
out
out-optimized

- name: "Run the invariant tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test --match-path \"test/invariant/**/*.sol\""

Expand Down Expand Up @@ -285,4 +285,4 @@ jobs:
- name: "Add test summary"
run: |
echo "## Fork tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ concurrency:
env:
API_KEY_ETHERSCAN: ${{ secrets.API_KEY_ETHERSCAN }}
API_KEY_INFURA: ${{ secrets.API_KEY_INFURA }}
RPC_URL_MAINNET: ${{ secrets.RPC_URL_MAINNET }}
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}

on:
workflow_dispatch:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:

- name: "Generate and prepare the contract artifacts"
run: "./shell/prepare-artifacts.sh"

- name: "Build the test contracts"
run: "FOUNDRY_PROFILE=test-optimized forge build"

Expand All @@ -91,7 +91,7 @@ jobs:

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Store the contract artifacts in CI"
uses: "actions/upload-artifact@v3"
with:
Expand Down Expand Up @@ -126,8 +126,8 @@ jobs:
node-version: "lts/*"

- name: "Install the Node.js dependencies"
run: "pnpm install"
run: "pnpm install"

- name: "Restore the cached build"
uses: "actions/cache/restore@v3"
with:
Expand Down Expand Up @@ -255,7 +255,7 @@ jobs:

- name: "Install the Node.js dependencies"
run: "pnpm install"

- name: "Restore the cached build"
uses: "actions/cache/restore@v3"
with:
Expand All @@ -265,7 +265,7 @@ jobs:
cache
out
out-optimized

- name: "Run the invariant tests against the optimized build"
run: "FOUNDRY_PROFILE=test-optimized forge test --match-path \"test/invariant/**/*.sol\""

Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
cache
out
out-optimized

- name: "Generate fuzz seed that changes weekly to avoid burning through RPC allowance"
run: |
echo "FOUNDRY_FUZZ_SEED=$(echo $(($EPOCHSECONDS / 604800)))" >> $GITHUB_ENV
Expand Down
35 changes: 35 additions & 0 deletions script/DeployCore3.s.sol
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 all V2 Core contract 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);
}
}
43 changes: 43 additions & 0 deletions script/DeployDeterministicCore3.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// 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 all V2 Core contracts at deterministic addresses across chains, in the following order:
///
/// 1. {SablierV2Comptroller}
/// 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 }();
// forgefmt: disable-next-line
lockupDynamic =
new SablierV2LockupDynamic{ salt: salt }(initialAdmin, comptroller, nftDescriptor, maxSegmentCount);
lockupLinear = new SablierV2LockupLinear{ salt: salt }(initialAdmin, comptroller, nftDescriptor);
}
}
Loading