Development
Last updated
Last updated
TODO: update links from old monorepo
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 . 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 typescript/nomad-deploy/config/testnets
.
Copy the contents of one of the existing network's files into a new file titled <new_network_name>.ts
.
Rename the process.env
variables (deployer key and RPC URL) such that they pull from the .env
variables for your new network.
Set the chainJson
fields appropriately. For dev, this usually just means updating the following fields: name
, domain
, timelag
.
Set the devConfig
and stagingConfig
object fields appropriately. In practice, for dev, you leave devConfig
the same and only update stagingConfig.optimisticSeconds
.
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 typescript/nomad-deploy/scripts
(core.ts
and bridge.ts
) and put them in a new folder for your new deploy script.
In core.ts
and bridge.ts
adjust any import paths to pull in your new network config from typescript/nomad-deploy/config/testnets
.
Add or remove any other existing networks in core.ts
and bridge.ts
and ensure that the CoreDeploy
objects for the desired networks are used in the deployTwoChains
or deployNChains
calls at the bottom of the files.
Add new npm scripts to typescript/nomad-deploy/package.json
that execute your new core.ts
and bridge.ts
files. The scripts will look like the following:
The following section walks through the steps for deploying a new set of contracts to dev.
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
Execute a Deploy Script
Note: See below for more details about the available deployment scripts.
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.
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 NomadDomain
object:
Update the indexing parameters (blocks
and from
) with the chunk
and from
fields from rust/config/development/<network>_config.json
.
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 NomadDomain
object and fill it with the correct fields.
Clone the monorepo and take a look at .
Populate .env.example
with the required RPC endpoints and funded deployer keys -- place it at typescript/nomad-deploy/.env
,