Skip to content

Commit 984cf70

Browse files
committed
Fix contract name uniqueness check
1 parent f5af161 commit 984cf70

File tree

1 file changed

+9
-9
lines changed
  • packages/cli/src/commands

1 file changed

+9
-9
lines changed

packages/cli/src/commands/add.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,6 @@ export default class AddCommand extends Command {
8484
let startBlock = parseInt(startBlockFlag ?? '').toString();
8585
let contractName = contractNameFlag;
8686

87-
const entities = getEntities(manifest);
88-
const contractNames = getContractNames(manifest);
89-
if (contractNames.includes(contractName)) {
90-
this.error(
91-
`Datasource or template with name ${contractName} already exists, please choose a different name.`,
92-
{ exit: 1 },
93-
);
94-
}
95-
9687
let ethabi = null;
9788
if (abi) {
9889
ethabi = EthereumABI.load(contractName, abi);
@@ -179,6 +170,15 @@ export default class AddCommand extends Command {
179170
}
180171
}
181172

173+
const entities = getEntities(manifest);
174+
const contractNames = getContractNames(manifest);
175+
if (contractNames.includes(contractName)) {
176+
this.error(
177+
`Datasource or template with name ${contractName} already exists, please choose a different name.`,
178+
{ exit: 1 },
179+
);
180+
}
181+
182182
await writeABI(ethabi, contractName);
183183

184184
const { collisionEntities, onlyCollisions, abiData } = updateEventNamesOnCollision(

0 commit comments

Comments
 (0)