0xweb
Version:
Contract package manager and other web3 tools
43 lines (38 loc) • 1.21 kB
text/typescript
import { EvmBytecode } from '../EvmBytecode';
import Opcode from '../interfaces/IOpcode';
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: EvmBytecode): void => {
const value = state.stack.pop();
const memoryStart = state.stack.pop();
const memoryLength = state.stack.pop();
state.stack.push(new CREATE(memoryStart, memoryLength, value));
};