Skip to content
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
205 changes: 90 additions & 115 deletions docs/guides/04-custom-deployments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,20 @@ section is not relevant to you.

### Prerequisites

- Check [here](/guides/lockup/deployments) if the deployment is not already made
- Follow the contributing guides for [Lockup](https://github.com/sablier-labs/lockup/blob/main/CONTRIBUTING.md),
[Airdrops](https://github.com/sablier-labs/airdrops/blob/main/CONTRIBUTING.md) and
[Flow](https://github.com/sablier-labs/flow/blob/main/CONTRIBUTING.md).
- Install the [Just](https://github.com/casey/just) CLI tool.
- Check if the deployments are not already made: [Airdrops](/guides/airdrops/deployments), [Flow](/guides/flow/deployments), [Lockup](/guides/lockup/deployments)
- Follow the contributing guides for <Link href={`${Links.GitHub.AIRDROPS}/blob/main/CONTRIBUTING.md`}>Airdrops</Link>, <Link href={`${Links.GitHub.FLOW}/blob/main/CONTRIBUTING.md`}>Flow</Link> and <Link href={`${Links.GitHub.LOCKUP}/blob/main/CONTRIBUTING.md`}>Lockup</Link>.
- RPC endpoint, e.g., a paid [Infura](https://www.infura.io/) or [Alchemy](https://www.alchemy.com/) account
- Have enough ETH in your deployer account
- Have enough gas tokens (e.g., ETH) in your deployer account
- Have an Etherscan API key (for source code verification)

### Lockup Deployment
### Comptroller Deployment

#### Step 1: Clone the [Lockup repo](https://github.com/sablier-labs/lockup) and checkout to the `v2.0.0` tag
#### Step 1: Clone the <Link href={Links.GitHub.EVMUTILS}>EVM Utils repo</Link> and checkout to the `v1.0.0` tag

```bash
git checkout v2.0.0
git clone -b v1.0.0 git@github.com:sablier-labs/evm-utils.git
cd evm-utils
bun install --frozen-lockfile
```

#### Step 2: Create an `.env` file
Expand All @@ -71,7 +70,7 @@ touch .env
Add the following variables to `.env` file:

```
EOA="DEPLOYER ADDRESS"
ETH_FROM="DEPLOYER ADDRESS"
ETHERSCAN_API_KEY="EXPLORER API KEY"
PRIVATE_KEY="PRIVATE KEY OF DEPLOYER ADDRESS"
RPC_URL="RPC ENDPOINT URL"
Expand All @@ -84,57 +83,37 @@ Load the environment variables into your shell:
source .env
```

#### Step 3: Build the contracts

```bash
bun install --frozen-lockfile
```

```bash
bun run build-optimized
```

#### Step 4: Run the following deployment command

For **deterministic** deployment:
#### Step 3: Run the following deployment command

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployDeterministicProtocol.s.sol \
forge script scripts/solidity/DeployDeterministicComptrollerProxy.s.sol:DeployDeterministicComptrollerProxy \
--broadcast \
--etherscan-api-key $ETHERSCAN_API_KEY \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--sig "run()" \
--verifier-url $VERIFIER_URL \
--etherscan-api-key $ETHERSCAN_API_KEY \
--verifier "etherscan" \
--verify \
-vvv
```

For **non-deterministic** deployment:
The above command works for etherscan equivalent explorers. If the chain uses a custom explorer,
modify the verifier arguments according to [forge script documentation](https://getfoundry.sh/forge/reference/script/#forge-script). You should
also refer to the forge script documentation for different wallet options such as mnemonic or hardware device.

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployProtocol.s.sol \
--broadcast \
--etherscan-api-key $ETHERSCAN_API_KEY \
--private-key $PRIVATE_KEY \
--rpc-url $RPC_URL \
--sig "run()" \
--verifier-url $VERIFIER_URL \
--verify \
-vvv
```
#### Step 4: Update the EVM Utils repository

If you are using a mnemonic or a hardware device for your deployer address, refer to `forge-script` page from
[foundry book](https://book.getfoundry.sh/reference/forge/forge-script#forge-script) for different wallet options.
Add the chain ID of your newly deployed chain to the `ChainId` library in the [EVM Utils repo](https://github.com/sablier-labs/evm-utils/blob/d7d6c051a39cbacadef672e92ed9d57628c80dc4/src/tests/ChainId.sol). Then, bump the EVM Utils version in each protocol repository's `package.json` file (e.g., [Lockup](https://github.com/sablier-labs/lockup/blob/58eaac45c20c57a93b73d887c714e68f061ec3e6/package.json#L16), [Flow](https://github.com/sablier-labs/flow/blob/a4143de45478f508bca8305fec2bd81b7ad25fe9/package.json#L16), [Airdrops](https://github.com/sablier-labs/airdrops/blob/077c6b9766ef7693ba9e82a9e001dc0097709c01/package.json#L16)).

### Merkle Airdrops Deployment
### Lockup Deployment

#### Step 1: Clone the [Merkle Airdrops repo](https://github.com/sablier-labs/airdrops) and checkout to `v1.3.0` tag
#### Step 1: Clone the <Link href={Links.GitHub.LOCKUP}>Lockup repo</Link> and checkout to the `v3.0.1` tag

```bash
git checkout v1.3.0
git clone -b v3.0.1 git@github.com:sablier-labs/lockup.git
cd lockup
bun install --frozen-lockfile
```

#### Step 2: Create an `.env` file
Expand All @@ -146,70 +125,97 @@ touch .env
Add the following variables to `.env` file:

```
EOA="DEPLOYER ADDRESS"
ETH_FROM="DEPLOYER ADDRESS"
ETHERSCAN_API_KEY="EXPLORER API KEY"
PRIVATE_KEY="PRIVATE KEY OF DEPLOYER ADDRESS"
RPC_URL="RPC ENDPOINT URL"
VERIFIER_URL="EXPLORER VERIFICATION URL"
```

Load the environment variables into shell:
Load the environment variables into your shell:

```bash
source .env
```

#### Step 3: Build the contracts
#### Step 3: Run the following deployment command

```bash
FOUNDRY_PROFILE=optimized \
forge script scripts/solidity/DeployDeterministicProtocol.s.sol:DeployDeterministicProtocol \
--broadcast \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--sig "run()" \
--etherscan-api-key $ETHERSCAN_API_KEY \
--verifier "etherscan" \
--verify \
-vvv
```

The above command works for etherscan equivalent explorers. If the chain uses a custom explorer,
modify the verifier arguments according to [forge script documentation](https://getfoundry.sh/forge/reference/script/#forge-script). You should
also refer to the forge script documentation for different wallet options such as mnemonic or hardware device.

### Merkle Airdrops Deployment

#### Step 1: Clone the <Link href={Links.GitHub.AIRDROPS}>Merkle Airdrops repo</Link> and checkout to `v2.0.1` tag

```bash
git clone -b v2.0.1 git@github.com:sablier-labs/airdrops.git
cd airdrops
bun install --frozen-lockfile
```

#### Step 2: Create an `.env` file

```bash
bun run build-optimized
touch .env
```

#### Step 4: Run the following command to deploy all merkle airdrop contracts
Add the following variables to `.env` file:

```
ETH_FROM="DEPLOYER ADDRESS"
ETHERSCAN_API_KEY="EXPLORER API KEY"
PRIVATE_KEY="PRIVATE KEY OF DEPLOYER ADDRESS"
RPC_URL="RPC ENDPOINT URL"
VERIFIER_URL="EXPLORER VERIFICATION URL"
```

For **deterministic** deployments, meaning that CREATE2 is used:
Load the environment variables into shell:

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployDeterministicMerkleFactory.s.sol \
--broadcast \
--etherscan-api-key $ETHERSCAN_API_KEY \
--private-key $PRIVATE_KEY \
--rpc-url $RPC_URL \
--sig "run()" \
--verifier-url $VERIFIER_URL \
--verify \
-vvv
source .env
```

For **non-deterministic** deployments:
#### Step 3: Run the following command to deploy all merkle airdrop contracts

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployMerkleFactory.s.sol \
forge script scripts/solidity/DeployDeterministicFactories.s.sol:DeployDeterministicFactories \
--broadcast \
--etherscan-api-key $ETHERSCAN_API_KEY \
--private-key $PRIVATE_KEY \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--sig "run()" \
--verifier-url $VERIFIER_URL \
--etherscan-api-key $ETHERSCAN_API_KEY \
--verifier "etherscan" \
--verify \
-vvv
```

If you are using a mnemonic or a hardware device for your deployer address, refer to `forge-script` page from the
[Foundry Book](https://book.getfoundry.sh/reference/forge/forge-script#forge-script).
The above command works for etherscan equivalent explorers. If the chain uses a custom explorer,
modify the verifier arguments according to [forge script documentation](https://getfoundry.sh/forge/reference/script/#forge-script). You should
also refer to the forge script documentation for different wallet options such as mnemonic or hardware device.

### Flow Deployment

#### Step 1: Clone the [Flow repo](https://github.com/sablier-labs/flow) and checkout to `v1.1.0` tag
#### Step 1: Clone the <Link href={Links.GitHub.FLOW}>Flow repo</Link> and checkout to `v2.0.0` tag

```bash
git checkout v1.1.0
git clone -b v2.0.0 git@github.com:sablier-labs/flow.git
cd flow
bun install --frozen-lockfile
```

#### Step 2: Create an `.env` file
Expand All @@ -234,64 +240,33 @@ Load the environment variables into your shell:
source .env
```

#### Step 3: Build the contracts

```bash
bun install --frozen-lockfile
```

```bash
bun run build-optimized
```

#### Step 4: Run the following deployment command

For **deterministic** deployment:
#### Step 3: Run the following deployment command

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployDeterministicFlow.s.sol \
forge script scripts/solidity/DeployDeterministicProtocol.s.sol:DeployDeterministicProtocol \
--broadcast \
--etherscan-api-key $ETHERSCAN_API_KEY \
--rpc-url $RPC_URL \
--private-key $PRIVATE_KEY \
--sig "run()" \
--verifier-url $VERIFIER_URL \
--verify \
-vvv
```

For **non-deterministic** deployment:

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployFlow.s.sol \
--broadcast \
--etherscan-api-key $ETHERSCAN_API_KEY \
--private-key $PRIVATE_KEY \
--rpc-url $RPC_URL \
--sig "run()" \
--verifier-url $VERIFIER_URL \
--verifier "etherscan" \
--verify \
-vvv
```

If you are using a mnemonic or a hardware device for your deployer address, refer to `forge-script` page from
[foundry book](https://book.getfoundry.sh/reference/forge/forge-script#forge-script) for different wallet options.

### List your deployment

After the contracts are deployed, you can submit your deployment like so:

1. Open a PR in the [docs repo](https://github.com/sablier-labs/docs) by following the listing instructions below.
2. Open a PR in the [deployments repo](https://github.com/sablier-labs/deployments) to add the broadcast file (JSON).
You can find it in the `broadcast` directory.
The above command works for etherscan equivalent explorers. If the chain uses a custom explorer,
modify the verifier arguments according to [forge script documentation](https://getfoundry.sh/forge/reference/script/#forge-script). You should
also refer to the forge script documentation for different wallet options such as mnemonic or hardware device.

#### Listing instructions
### List your deployments

When listing a new chain, you need to update the following sections of this documentation site:
After the contracts are deployed, you can submit a PR in the <Link href={Links.GitHub.SDK}>SDK
repo</Link> by including the following details:

- Contract Deployments, e.g. for [Lockup](/guides/lockup/deployments)
- Indexers, e.g. for [Lockup](/api/lockup/indexers)
- [Governance](/concepts/governance)
- [Fees](/concepts/fees)
- Add the broadcast files (JSON) to <Link href={`${Links.GitHub.SDK}/tree/main/deployments`}>deployments</Link> directory.
- Add the deployment addresses to the following files:
- <Link href={`${Links.GitHub.SDK}/blob/main/src/comptroller.ts`}>Comptroller Deployments</Link>
- <Link href={`${Links.GitHub.SDK}/blob/main/src/releases/airdrops/v2.0/deployments.ts`}>Airdrops Deployments</Link>
- <Link href={`${Links.GitHub.SDK}/blob/main/src/releases/flow/v2.0/deployments.ts`}>Flow Deployments</Link>
- <Link href={`${Links.GitHub.SDK}/blob/main/src/releases/lockup/v3.0/deployments.ts`}>Lockup Deployments</Link>
4 changes: 4 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ export const Links = {
CHAINS: "https://forms.gle/9EaRarDie98Fw1mw6",
},
GitHub: {
AIRDROPS: `https://github.com/${GITHUB_ORG}/airdrops`,
BENCHMARKS: `https://github.com/${GITHUB_ORG}/benchmarks`,
DEPLOYMENTS: `https://github.com/${GITHUB_ORG}/deployments`,
EVMUTILS: `https://github.com/${GITHUB_ORG}/evm-utils`,
FLOW: `https://github.com/${GITHUB_ORG}/flow`,
INDEXERS: `https://github.com/${GITHUB_ORG}/indexers`,
LOCKUP: `https://github.com/${GITHUB_ORG}/lockup`,
ORG: `https://github.com/${GITHUB_ORG}`,
SDK: `https://github.com/${GITHUB_ORG}/sdk`,
},
Expand Down