evm
Version:
An ethereum virtual machine (EVM) bytecode decompiler
43 lines (38 loc) • 1.25 kB
text/typescript
import EVM from '../classes/evm.class';
import Opcode from '../interfaces/opcode.interface';
import stringify from '../utils/stringify';
export class CREATE {
readonly name: string;
readonly type?: string;
readonly wrapped: boolean;
readonly memoryStart: any;
readonly memoryLength: any;
readonly value: any;
constructor(memoryStart: any, memoryLength: any, value: any) {
this.name = 'CREATE';
this.name = 'address';
this.wrapped = true;
this.memoryStart = memoryStart;
this.memoryLength = memoryLength;
this.value = value;
}
toString() {
return (
'(new Contract(memory[' +
stringify(this.memoryStart) +
':(' +
stringify(this.memoryStart) +
'+' +
stringify(this.memoryLength) +
')]).value(' +
stringify(this.value) +
')).address'
);
}
}
export default (opcode: Opcode, state: EVM): void => {
const value = state.stack.pop();
const memoryStart = state.stack.pop();
const memoryLength = state.stack.pop();
state.stack.push(new CREATE(memoryStart, memoryLength, value));
};