Deploying Dev Setup
This section goes through the steps of adding a new development network to
nomad-deploy and deploying a new set of dev contracts. If you will not be adding a new network, please skip to Deploying the Contracts to Dev. If you are looking to deploy a new network to the production setup, please refer to the separate page on deploying new contracts to production.
Add a New Network Config
If you are looking to add a new network to your dev setup, you will need to create a new config file for that network in
- Copy the contents of one of the existing network's files into a new file titled
- Rename the
process.variables (deployer key and RPC URL) such that they pull from the
.envvariables for your new network.
- Set the
chainJsonfields appropriately. For dev, this usually just means updating the following fields:
- Set the
stagingConfigobject fields appropriately. In practice, for dev, you leave
devConfigthe same and only update
Writing a New Deploy Script
Now that you've added a new network config, you must write a new deploy script that includes your new network.
- Duplicate the contents of an existing folder in
bridge.ts) and put them in a new folder for your new deploy script.
bridge.tsadjust any import paths to pull in your new network config from
- Add or remove any other existing networks in
bridge.tsand ensure that the
CoreDeployobjects for the desired networks are used in the
deployNChainscalls at the bottom of the files.
- Add new npm scripts to
typescript/nomad-deploy/package.jsonthat execute your new
bridge.tsfiles. The scripts will look like the following:
"deploy-<script_folder_name>-core": npx ts-node scripts/<script_folder_name>/core.ts,
"deploy-<script_folder_name>-bridge": npx ts-node scripts/<script_folder_name>/bridge.ts
Deploying the Contracts to Dev
The following section walks through the steps for deploying a new set of contracts to dev.
Clone the monorepo and take a look at nomad-deploy.
.env.examplewith the required RPC endpoints and funded deployer keys -- place it at
typescript/nomad-deploy/.env, see the example
Prepare Local Dependencies
nomad-deploy is configured to use the local versions of the Nomad typechain interface and the Nomad SDK, as such the local Node modules must be initialized.
# Install dependencies for typechain
$ cd typescript/typechain
$ npm i
# Install dependencies for nomad-sdk
$ cd typescript/nomad-sdk
$ npm i
- Install Dependencies
$ cd typescript/nomad-deploy
$ npm i
# Links local modules to nomad-deploy
$ npm run relink-all
- Execute a Deploy Script
Note: See below for more details about the available deployment scripts.
# Deploy core contracts first
$ npm run deploy-<your_script_folder_name>-core
# Then deploy bridge contracts
$ npm run deploy-<your_script_folder_name>-bridge
- Commit Outputted Configs
If all goes according to plan, you will have a new folder at
rust/config/<timestamp> containing JSON files that are used by the Off-Chain Agents. Please rename this folder appropriately (
development if this will become the new dev setup). When committed to the monorepo, the config files are automatically bundled into the resultant Agent docker image in CI.
Note: Deployment environments may be overridden by replacing the environment's config folder with the contents of your new timestamped configuration.
Updating Nomad SDK Dev Addresses
If your newly deployed setup will become the new dev setup, you will need to adjust the hardcoded domains, indexing parameters, and addresses in the Nomad SDK. Go to
typescript/nomad-sdk/src/nomad/domains/dev.ts. For each
- Update the indexing parameters (
from) with the
- Replace all addresses with those in the the newly outputted config file
rust/config/development/<network>_contracts.json. For the home and replica addresses, use the proxy addresses.
- If you deployed a new network that has not been seen before, add a new
NomadDomainobject and fill it with the correct fields.