sanguine

Solidity Development Operations

This package provides a set of tools and scripts to help with the development of Solidity smart contracts:

Disclaimer

This package is still under development and should be used with caution. It is not recommended to use it in a production environment.

Docs

Forge docs are automatically deployed here.

Setup

In order to use this package, it needs to be installed as a dependency in your project. It is recommended to install it as a dev dependency.

npm install --save-dev @synapsecns/solidity-devops
# Or, if you are using yarn
yarn add --dev @synapsecns/solidity-devops

Following files are necessary to be present in the root of your project:

.env

Note: This file must be added to .gitignore to avoid sharing sensitive information.

See the example .env file. Following structure is required:

devops.json

See the example devops.json file. Following values are required:

foundry.toml

See the example foundry.toml file. Following values are required:

See the Foundry Book for more information.

Usage

Writing scripts

Running scripts

Your main point of entry for running the scripts should be the npx fsr command.

Note: fsr is a shorthand for forge script run.

# npx fsr <path-to-script> <chain-name> <wallet-name> [<options>]
# To simulate the script without broadcasting, using wallet named "chad"
npx fsr script/DeployBasicContract.s.sol eth_sepolia chad
# To broadcast the script using wallet named "chad"
# NOTE: there is no need to add --verify option, as it is automatically added for the broadcasted scripts.
npx fsr script/DeployBasicContract.s.sol eth_sepolia chad --broadcast

This command is responsible for the following:

You can also utilize the npx fsr-str command to provide a single string argument for the running script:

# npx fsr-str <path-to-script> <chain-name> <wallet-name> <string-arg> [<options>]
# To simulate the script without broadcasting, using wallet named "chad"
npx fsr-str script/DeployBasicContract.s.sol eth_sepolia chad "AAAAAAAA"
# To broadcast the script using wallet named "chad"
# NOTE: there is no need to add --verify option, as it is automatically added for the broadcasted scripts.
npx fsr-str script/DeployBasicContract.s.sol eth_sepolia chad "AAAAAAAA" --broadcast

Managing deployments

If for whatever reason the deployment script was interrupted, you can use npx sd command to save the deployment artifacts.

Note: sd is a shorthand for save deployment.

# npx sd <chain-name> <contract-alias>
npx sd eth_sepolia BasicContract
# Or, if the contract alias is used
npx sd eth_sepolia BasicContract.Alias

Contract verification

You can verify the contracts with the saved deployment artifacts using the npx fvc command.

Note: fvc is a shorthand for forge verify contract.

# npx fvc <chain-name> <contract-alias>
npx fvc eth_sepolia BasicContract
# Or, if the contract alias is used
npx fvc eth_sepolia BasicContract.Alias

Proxy verification

You can verify the proxy’s implementation in Etherscan-alike explorers using the npx vp command.

Note: vp is a shorthand for verify proxy.

# npx vp <chain-name> <contract-alias>
npx vp eth_sepolia BasicContract
# Or, if the contract alias is used
npx vp eth_sepolia TransparentUpgradeableProxy.BasicContract