hardhat-tracer
Version:
Hardhat Tracer plugin
33 lines • 1.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../utils");
function parse(step) {
const offset = (0, utils_1.parseNumber)(step.stack[step.stack.length - 1].toString(16));
const size = (0, utils_1.parseNumber)(step.stack[step.stack.length - 2].toString(16));
// const data = Buffer.from(step.memory.slice(offset, offset + size)).toString(
// "hex"
// );
const data = ""; // TODO fix this once memory support is added
const next = 1; // get stack just after this opcode
return {
isAwaitedItem: true,
next,
parse: (stepNext) => ({
opcode: "SHA3",
params: {
offset,
size,
data,
hash: (0, utils_1.parseBytes32)(stepNext.stack[step.stack.length - 1].toString(16)),
},
format() {
return format(this);
},
}),
};
}
function format(item) {
return `${(0, utils_1.colorLabel)("[SHA3]")} ${(0, utils_1.colorKey)(item.params.data)} → ${(0, utils_1.colorValue)(item.params.hash)}`;
}
exports.default = { parse, format };
//# sourceMappingURL=sha3.js.map