Improve smart contract dev experience
andrewgordstewart opened this issue · 0 comments
andrewgordstewart commented
I'll describe my experience just now:
- I checked out the ag-redux-storage branch in order to test Alex' local-storage work
- It required that I run
yarn install
- Then, I needed to re-start the server.
- 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. - 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 theserver
package. - 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 inbuild/artifacts
A3: Thecontracts
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 thecontracts
package to get the built artifacts.
A5: When being built, packages that use the nitro adjudicator use the pre-built contracts from thecontracts
package
This type of approach would eliminate steps 4-6 above.