@nomiclabs/buidler
Version:
Buidler is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
32 lines (26 loc) • 911 B
text/typescript
import { getUserConfigPath } from "../../core/project-structure";
import { ContractsIdentifier } from "./contracts-identifier";
import { isEvmStep, isPrecompileTrace, MessageTrace } from "./message-trace";
import { Bytecode } from "./model";
export class VmTraceDecoder {
constructor(private readonly _contractsIdentifier: ContractsIdentifier) {
const config = getUserConfigPath();
}
public tryToDecodeMessageTrace(messageTrace: MessageTrace): MessageTrace {
if (isPrecompileTrace(messageTrace)) {
return messageTrace;
}
return {
...messageTrace,
bytecode: this._contractsIdentifier.getBytecodeFromMessageTrace(
messageTrace
),
steps: messageTrace.steps.map((s) =>
isEvmStep(s) ? s : this.tryToDecodeMessageTrace(s)
),
};
}
public addBytecode(bytecode: Bytecode) {
this._contractsIdentifier.addBytecode(bytecode);
}
}