TODO: update links from old monorepo
This section goes through the steps of adding a new development network to
nomad-deployand 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.
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
- 1.Copy the contents of one of the existing network's files into a new file titled
- 2.Rename the
process.envvariables (deployer key and RPC URL) such that they pull from the
.envvariables for your new network.
- 3.Set the
chainJsonfields appropriately. For dev, this usually just means updating the following fields:
- 4.Set the
stagingConfigobject fields appropriately. In practice, for dev, you leave
devConfigthe same and only update
Now that you've added a new network config, you must write a new deploy script that includes your new network.
- 1.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
- 3.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.
- 4.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
The following section walks through the steps for deploying a new set of contracts to dev.
.env.examplewith the required RPC endpoints and funded deployer keys -- place it at
typescript/nomad-deploy/.env, see the example
- 3.Prepare Local Dependencies
nomad-deployis 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
- 1.Install Dependencies
$ cd typescript/nomad-deploy
$ npm i
# Links local modules to nomad-deploy
$ npm run relink-all
- 1.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
- 1.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 (
developmentif 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.
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
- 1.Update the indexing parameters (
from) with the
- 2.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.
- 3.If you deployed a new network that has not been seen before, add a new
NomadDomainobject and fill it with the correct fields.