Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Report the gas used during initial truffle migration too :
const networkDeployment = contract.networks[networkId]
if (networkDeployment && networkDeployment.transactionHash) {
const code = sync.getCode(networkDeployment.address);
const hash = sha1(code);
contractNameFromCodeHash[hash] = name;
const receipt = sync.getTransactionReceipt(networkDeployment.transactionHash);
contractInfo.gasData.push(parseInt(receipt.gasUsed, 16));
}
abis.push(contract._json.abi)
// Decode, getMethodIDs
abiDecoder.addABI(contract._json.abi)
const methodIDs = abiDecoder.getMethodIDs()
// Create Method Map;
Object.keys(methodIDs).forEach(key => {
const isInterface = contract.unlinked_binary === '0x';
const isConstant = methodIDs[key].constant
const isEvent = methodIDs[key].type === 'event'
const hasName = methodIDs[key].name
if (hasName && !isConstant && !isEvent && !isInterface) {
methodMap[name + '_' + key] = {
key: key,
contract: name,
method: methodIDs[key].name,
gasData: [],
numberOfCalls: 0
}