Skip to content

Commit

Permalink
Moved parameter validation to the _saveContractForVerification function
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrylR committed Feb 8, 2024
1 parent 1522abf commit 514e26e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/deployer/MinimalContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ export class MinimalContract {
private async _createDeployTransaction(args: any[], txOverrides: Overrides): Promise<ContractDeployTxWithName> {
const factory = new ethers.ContractFactory(this._interface, this._bytecode);

const coder = new ethers.AbiCoder();
// Try to encode the arguments before sending the deployment transaction
factory.interface.deploy.inputs.forEach((input, idx) => {
coder.encode([input], [args[idx]]);
});

return {
contractName: this._contractName,
chainId: await getChainId(),
Expand Down Expand Up @@ -145,6 +139,14 @@ export class MinimalContract {
return;
}

const factory = new ethers.ContractFactory(this._interface, this._bytecode);

const coder = new ethers.AbiCoder();
// Try to encode the arguments before sending the deployment transaction
factory.interface.deploy.inputs.forEach((input, idx) => {
coder.encode([input], [args[idx]]);
});

VerificationProcessor.saveVerificationFunction({
contractAddress,
contractName: contractName,
Expand Down

0 comments on commit 514e26e

Please sign in to comment.