dop-stick
Version:
Source control tooling for versionable-upgradeable smart contracts
61 lines • 1.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.upgradeCommand = void 0;
const index_1 = require("../../index");
const config_1 = require("../utils/config");
const logger_1 = require("../../utils/logsAndMetrics/core/logger");
/**
* Command to upgrade an existing diamond contract with new or modified facets.
*
* Usage:
* ```bash
* dopstick upgrade
* ```
*
* Configuration:
* Requires a valid dopstick.config.ts file with:
* - Contract paths
* - Upgrade specifications
* - Module changes
*
* Environment Variables:
* - `DIAMOND_ADDRESS`: Address of the diamond to upgrade
* - `RPC_URL`: Network RPC URL
*
* Example:
* ```bash
* dopstick upgrade
* ```
*
* Output:
* - Displays upgrade progress
* - Shows successful/failed function updates
*/
exports.upgradeCommand = {
register: (program) => {
program
.command('upgrade')
.description('Upgrade an existing diamond contract')
.option('--no-compile', 'Skip contract compilation')
.action(async (options) => {
try {
const config = (0, config_1.loadConfig)({ requireUpgrades: true });
// Skip compilation if --no-compile is used
if (options.compile === false) {
config.compiler = {
...config.compiler,
skip: true
};
logger_1.Logger.info('Compilation skipped via CLI option');
}
await (0, index_1.upgrade)(config);
process.exit(0);
}
catch (error) {
logger_1.Logger.error(error instanceof Error ? error.message : String(error));
process.exit(1);
}
});
}
};
//# sourceMappingURL=upgrade.js.map