magmo/apps

Improve smart contract dev experience

andrewgordstewart opened this issue · 0 comments

I'll describe my experience just now:

  1. I checked out the ag-redux-storage branch in order to test Alex' local-storage work
  2. It required that I run yarn install
  3. Then, I needed to re-start the server.
  4. The yarn start script removes the built artifacts. It then compiles the contracts, creating new artifacts, and deploys these artifacts to the ganache network. Compiling the contracts takes about 20-30s for me.
  5. Once I did this, the server and the client are no longer using the same deployed nitro adjudicator. Therefore, I have to remember copy the compiled artifacts from the wallet package to the server package.
  6. I then have to re-start the server

This experience is quite bad! I think that steps 4-6 can be completely removed with something like the following approach:

A1: Create a package in the apps repository. For the sake of this discussion, call it the contracts package.
A2: In the contracts package, create a yarn script called, for the sake of this discussion, nitro:build:dev
cd ${CONTRACTS_DIR}; yarn nitro:build:dev should

  • deploy artifacts to ganache according to environment variables defined in ${APPS_ROOT}/.env.development.local.
  • Add the deployed address to the networks property of the artifact that's stored in build/artifacts
    A3: The contracts package is responsible for managing pre-built contracts and their deployed addresses on various networks
    A4: During development, packages that use a nitro adjudicator do not build the contract, but instead, refer to the contracts package to get the built artifacts.
    A5: When being built, packages that use the nitro adjudicator use the pre-built contracts from the contracts package

This type of approach would eliminate steps 4-6 above.