Skip to content

Deployments

Andrei Vlad Birgaoanu edited this page Mar 25, 2024 · 10 revisions

The contracts can be deployed with the deployment scripts available in the script directory. To run the scripts, you need to have your environment variables correctly set up, as explained in the CONTRIBUTING guide.

The examples below deploy to the Sepolia testnet, but you can pick any other chain defined under the [rpc_endpoints] section in foundry.toml.

To deploy to a local development chain, you can spin up an instance of Anvil.

Via IR

The contracts are deployed to production with --via-ir enabled.

Using the Via IR compilation pipeline enables a host of powerful optimizations, albeit at the expense of significantly slower compilation times, which can hinder local development efficiency. However, it is crucial to test our contracts against this optimized version, as this is what end users will ultimately interact with.

In order to strike a balance, we have come up with a setup that allows for efficient development and testing on local machines, while still ensuring compatibility with the IR-enabled version. Our approach involves building and testing the contracts normally on local machines, while leveraging the CI environment to build and test the IR-enabled contracts. This ensures rapid development and testing while providing confidence that the contracts function as intended when deployed (with tests passing both with and without IR enabled).

Scripts

Deploy All Contracts

FOUNDRY_PROFILE=optimized \
forge script script/DeployCore.s.sol \
  --broadcast \
  --rpc-url sepolia \
  --sig "run(address)" \
  --verify \
  --etherscan-api-key $API_KEY_ETHERSCAN \
  ADMIN_ADDRESS

Deploy SablierV2Comptroller

FOUNDRY_PROFILE=optimized \
forge script script/DeployComptroller.s.sol \
  --broadcast \
  --rpc-url sepolia \
  --sig "run(address)" \
  --verify \
  --etherscan-api-key $API_KEY_ETHERSCAN \
  ADMIN_ADDRESS

Deploy SablierV2LockupDynamic

You should replace the placeholders with the actual arguments you want to pass.

FOUNDRY_PROFILE=optimized \
forge script script/DeployLockupDynamic.s.sol \
  --broadcast \
  --rpc-url sepolia \
  --sig "run(address,address,address)" \
  --verify \
  --etherscan-api-key $API_KEY_ETHERSCAN \
  ADMIN_ADDRESS \
  COMPTROLLER_ADDRESS \
  NFT_DESCRIPTOR_ADDRESS

Deploy SablierV2LockupLinear

You should replace the placeholders with the actual arguments you want to pass.

FOUNDRY_PROFILE=optimized \
forge script script/DeployLockupLinear.s.sol \
  --broadcast \
  --rpc-url sepolia \
  --sig "run(address,address,address)" \
  --verify \
  --etherscan-api-key $API_KEY_ETHERSCAN \
  ADMIN_ADDRESS \
  COMPTROLLER_ADDRESS \
  NFT_DESCRIPTOR_ADDRESS