Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions examples/truffle-migrate/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# Sample ZeppelinOS project with truffle migrations

This is a sample ZeppelinOS project that runs `zos` from truffle migrations, using the CLI javascript interface. This allows any project that currently relies on truffle migrations to switch over to `zos`, thus deploying upgradeable instances instead of regular ones. Also, by using the CLI interface, `zos` keeps track of all deployed logic contracts and all upgradeable instances, and also tracks them in truffle build artifacts.
This is a sample ZeppelinOS project that runs `zos` from truffle migrations, using the CLI javascript interface.
This allows any project that currently relies on truffle migrations to switch over to `zos`, thus deploying
upgradeable instances instead of regular ones. Also, by using the CLI interface, `zos` keeps track of all deployed
logic contracts and all upgradeable instances, and also tracks them in truffle build artifacts.

## Running this project

To run this project locally, first install all dependencies with `npm install`, and then start a ganache instance by running `ganache-cli -p 9545`. Next, run all migrations via `npx truffle migrate --network local`. Finally, check the state of the deployment via `npm run check`.
To run this project locally, first install all dependencies with `npm install`, and then start a ganache instance by
running `npx ganache-cli -p 9545`. Next, run all migrations via `npx truffle migrate --network local`. Finally, check
the state of the deployment via `npm run check`.

## The code

All relevant code is in the two `deploy` scripts in the `migrations` folder. These scripts will each register a different version of a contract `MyContract`, push the logic contract to the network, and then either create a new instance, or upgrade the existing one. The script in `index.js` then checks the deployment state, retrieving the deployed instance via truffle's `MyContract.deployed()`.
All relevant code is in the two `deploy` scripts in the `migrations` folder. These scripts will each register a
different version of a contract `MyContract`, push the logic contract to the network, and then either create a new
instance, or upgrade the existing one. The script in `index.js` then checks the deployment state, retrieving the
deployed instance via truffle's `MyContract.deployed()`.

### Initial deployment

Expand Down Expand Up @@ -38,4 +46,6 @@ await update(Object.assign({ contractAlias: 'MyContract', initMethod: 'add', ini

### Boilerplate

Due to limitations on how global variables are managed within truffle scripts, both deployment functions need to be wrapped in a `runWithTruffle` helper function exported by `zos` CLI. We have ongoing efforts to remove this restriction in the near future.
Due to limitations on how global variables are managed within truffle scripts, both deployment functions need to be
wrapped in a `runWithTruffle` helper function exported by `zos` CLI. We have ongoing efforts to remove this restriction
in the near future.
Loading