Skip to content

Commit

Permalink
docs: custom deployment guide (#174)
Browse files Browse the repository at this point in the history
* docs: deployment guide pre-requisities

* docs: deployment guide for contracts

* refactor: polish deployment guide

---------

Co-authored-by: smol-ninja <[email protected]>
  • Loading branch information
PaulRBerg and smol-ninja authored Sep 16, 2024
1 parent 44fb766 commit ad15c2b
Showing 1 changed file with 158 additions and 3 deletions.
161 changes: 158 additions & 3 deletions docs/contracts/v2/guides/10-custom-deployments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ title: "Custom Deployments"
import Link from "@docusaurus/Link";
import { links } from "@site/src/constants";

:::info
:::info[Reach Out]

Due to limited bandwidth, we are not able to deploy the Sablier Protocol on every EVM chain. However, we are happy to
consider your project if you fill out this <Link href={links.forms.chain}>form</Link> and meet the requirements below.
Due to budget constraints, we are not able to deploy the Sablier Protocol on every EVM chain. However, we would be happy
to consider your project if you fill out this <Link href={links.forms.chains}>form</Link> and meet the requirements
below.

:::

Expand All @@ -21,3 +22,157 @@ consider your project if you fill out this <Link href={links.forms.chain}>form</
- Bridge, with step-by-step instructions for how to bridge ETH and ERC-20 tokens to the target chain
- GraphQL solution, e.g., a deployment of [The Graph](https://thegraph.com/)
- Functional JSON-RPC endpoint, ideally listed on [ChainList](https://chainlist.org/)

## Deployment Guide

The following guidelines apply to you only if you have you been granted a
[BUSL license](https://app.ens.domains/lockup-license-grants.sablier.eth?tab=records) to deploy the Sablier Protocol.

### Pre Requisities

- Check if the deployment is not already made on [your chain](/contracts/v2/deployments)
- Follow the [contributing guide](https://github.com/sablier-labs/v2-core/blob/main/CONTRIBUTING.md)
- RPC endpoint, e.g., a paid Infura account
- Enough ETH in your deployer account
- Etherscan API key (for source code verification)

### Steps for deploying Core contracts

#### Step 1: Clone the [v2-core repo](https://github.com/sablier-labs/v2-core) and checkout to the latest release tag

At the time of writing, the latest release tag is `v1.2.0`:

```bash
git checkout v1.2.0
```

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

```bash
touch .env
```

Add the following variables to `.env` file:

```
EOA="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 your shell:

```bash
source .env
```

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

:::warning[Important]

You must set the protocol admin to the Sablier-controlled address 0xD427d37B5F6d33f7D42C4125979361E011FFbfD9. Failure to
do so will result in your deployment not being acknowledged as official.

:::

For **deterministic** deployment:

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

For **non-deterministic** deployment:

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployCore.s.sol \
--broadcast \
--etherscan-api-key $ETHERSCAN_API_KEY \
--private-key $PRIVATE_KEY \
--rpc-url $RPC_URL \
--sig "run(address)" 0xD427d37B5F6d33f7D42C4125979361E011FFbfD9 \
--verifier-url $VERIFIER_URL \
--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.

### Steps for deploying Periphery contracts

#### Step 1: Clone the [v2-periphery](https://github.com/sablier-labs/v2-periphery) and checkout to the latest release tag

At the time of writing, the latest release tag is `v1.2.0`:

```bash
git checkout v1.2.0
```

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

```bash
touch .env
```

Add the following variables to `.env` file:

```
EOA="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:

```bash
source .env
```

#### Step 3: Run the following command to deploy all periphery contracts

For **deterministic** deployments, meaning that CREATE2 is used:

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployDeterministicPeriphery.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
```

For **non-deterministic** deployments:

```bash
FOUNDRY_PROFILE=optimized \
forge script script/DeployPeriphery.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
```

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) for different wallet options.

0 comments on commit ad15c2b

Please sign in to comment.