diff --git a/packages/cli/src/utils/release-gold-base.ts b/packages/cli/src/utils/release-gold-base.ts index 600ca7cce5f..7b022e2adeb 100644 --- a/packages/cli/src/utils/release-gold-base.ts +++ b/packages/cli/src/utils/release-gold-base.ts @@ -1,7 +1,9 @@ import { newReleaseGold } from '@celo/contractkit/lib/generated/ReleaseGold' import { ReleaseGoldWrapper } from '@celo/contractkit/lib/wrappers/ReleaseGold' -import ReleaseGoldArtifact from '@celo/protocol/build/core-contracts.v5/contracts/ReleaseGold.json' import { ParserOutput } from '@oclif/parser/lib/parse' +// import { flags } from '@oclif/command' +// import { readJsonSync } from 'fs-extra' +// import ReleaseGoldArtifactfrom '../../ReleaseGold.json' import { BaseCommand } from '../base' import { Flags } from './command' @@ -9,6 +11,8 @@ export abstract class ReleaseGoldBaseCommand extends BaseCommand { static flags = { ...BaseCommand.flags, contract: Flags.address({ required: true, description: 'Address of the ReleaseGold Contract' }), + // verifyBytecode: flags.boolean({ required: false, default: false, description: 'Verify bytecode of contract'}), + // verifyStorage: flags.string({ required: false, description: 'Path to json where grant is specified'}), } private _contractAddress: string | null = null @@ -17,7 +21,7 @@ export abstract class ReleaseGoldBaseCommand extends BaseCommand { get contractAddress() { if (!this._contractAddress) { const res: ParserOutput = this.parse() - this._contractAddress = String(res.flags.contract) + this._contractAddress = res.flags.contract as string } return this._contractAddress } @@ -32,16 +36,22 @@ export abstract class ReleaseGoldBaseCommand extends BaseCommand { async init() { await super.init() if (!this._releaseGoldWrapper) { - const runtimeBytecode = await this.web3.eth.getCode(this.contractAddress) - if (runtimeBytecode !== ReleaseGoldArtifact.deployedBytecode) { - throw new Error( - `Contract at ${this.contractAddress} does not match expected ReleaseGold bytecode` - ) - } + // const res: ParserOutput = this.parse() + // if (res.flags.verifyBytecode as boolean) { + // const runtimeBytecode = await this.web3.eth.getCode(this.contractAddress) + // if (runtimeBytecode !== ReleaseGoldArtifact.deployedBytecode) { + // throw new Error( + // `Contract at ${this.contractAddress} does not match expected ReleaseGold bytecode` + // ) + // } + // } this._releaseGoldWrapper = new ReleaseGoldWrapper( this.kit, newReleaseGold(this.kit.connection.web3, this.contractAddress) ) + // if (res.flags.verifyStorage) { + // const grant = readJsonSync(res.flags.verifyStorage, {}) + // } } } } diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 6af7123508d..c231fb9ff65 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -7,6 +7,6 @@ "target": "es6", "resolveJsonModule": true }, - "include": ["src", "../contractkit/types", "types/hw-transport-node-hid.d.ts"], + "include": ["src/**/*", "../contractkit/types", "types/hw-transport-node-hid.d.ts", ], "references": [{ "path": "../sdk/utils" }, { "path": "../sdk/contractkit" }] }