From 41982121359336bb5a0734a1f1c7b82d6e5010cd Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 2 Dec 2016 14:17:13 +0000 Subject: [PATCH] Display metadata hash if found --- src/app/renderer.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/app/renderer.js b/src/app/renderer.js index 54942a4f17..468af29619 100644 --- a/src/app/renderer.js +++ b/src/app/renderer.js @@ -91,6 +91,13 @@ Renderer.prototype.contracts = function (data, source) { }) } + var retrieveMetadataHash = function (bytecode) { + var match = /a165627a7a72305820([0-9a-f]{64})0029$/.exec(bytecode) + if (match) { + return match[1] + } + } + var renderOutputModifier = function (contractName, $contractOutput) { var contract = data.contracts[contractName] if (contract.bytecode) { @@ -101,6 +108,12 @@ Renderer.prototype.contracts = function (data, source) { if (contract.bytecode) { $contractOutput.append(uiHelper.preRow('Web3 deploy', uiHelper.gethDeploy(contractName.toLowerCase(), contract['interface'], contract.bytecode), 'deploy')) + + // check if there's a metadata hash appended + var metadataHash = retrieveMetadataHash(contract.bytecode) + if (metadataHash) { + $contractOutput.append(uiHelper.tableRow('Metadata location', 'bzzr://' + metadataHash)) + } } var ctrSource = getSource(contractName, source, data)