From f49d21d49191821fe0f8196e2ee3d9362d26c709 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Thu, 12 Jul 2018 11:18:03 -0400 Subject: [PATCH] fix the indexOf instead by simulating what solc does --- lib/contracts/contract_deployer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/contracts/contract_deployer.js b/lib/contracts/contract_deployer.js index 51c661c75..a6efdc1a8 100644 --- a/lib/contracts/contract_deployer.js +++ b/lib/contracts/contract_deployer.js @@ -178,12 +178,12 @@ class ContractDeployer { deployedAddress = deployedAddress.substr(2); } let linkReference = '__' + filename + ":" + contractObj.className; + if (contractCode.indexOf(linkReference.substr(0, 38)) < 0) { // substr to simulate the cut that solc does + continue; + } if (linkReference.length > 40) { return next(new Error(__("{{linkReference}} is too long, try reducing the path of the contract ({{filename}}) and/or its name {{contractName}}", {linkReference: linkReference, filename: filename, contractName: contractObj.className}))); } - if (contractCode.indexOf(linkReference) < 0) { - continue; - } let toReplace = linkReference + "_".repeat(40 - linkReference.length); if (deployedAddress === undefined) { let libraryName = contractObj.className;