Hi @xinya12,
One option could be to as follows:
From: How to upgrade contracts programmatically? - #8 by spalladino
You can use shelljs or child_process to call the CLI via your js code directly. You should set theOPENZEPPELIN_NON_INTERACTIVE
env flag to prevent the CLI from making any interactive prompts while running on a script.Also, when running non-interactively, you’ll have to manually call
oz compile
andoz push
before everyoz upgrade
. Thepush
command takes care of deploying your implementation contracts to the network. It is handled automatically for you when running the commands interactively, but not on a script.