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 , memoryLength , value ) { 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 , state ) : void => { const value = state . stack . pop ( ) ; const memoryStart = state . stack . pop ( ) ; const memoryLength = state . stack . pop ( ) ; state . stack . push ( new CREATE ( memoryStart , memoryLength , value ) ) ; } ;