Exemplo n.º 1
0
 def op_tuck(engine):
     x2 = PushData.pop_stack_item(engine)
     x1 = PushData.pop_stack_item(engine)
     PushData.push(engine, x2)
     PushData.push(engine, x1)
     PushData.push(engine, x2)
     return VMState.NONE
Exemplo n.º 2
0
    def op_append(engine):
        new_item = PushData.pop_stack_item(engine)
        if type(new_item) == StructItem:
            new_item = new_item.clone()
        items = PushData.pop_stack_item(engine)

        return VMState.NONE
Exemplo n.º 3
0
 def op_rot(engine):
     x3 = PushData.pop_stack_item(engine)
     x2 = PushData.pop_stack_item(engine)
     x1 = PushData.pop_stack_item(engine)
     PushData.push(engine, x2)
     PushData.push(engine, x3)
     PushData.push(engine, x1)
     return VMState.NONE
Exemplo n.º 4
0
 def op_pick_item(engine):
     index = PushData.pop_stack_item(engine)
     items = PushData.pop_stack_item(engine)
     if type(items) is ArrayItem:
         i = index.get_biginteger()
         print("i:", i)
         arr = items.get_array()
         PushData.push_data(engine, arr[i])
     elif type(items) is MapItem:
         t = items.try_get_value(index)
         PushData.push_data(engine, t)
     return VMState.NONE
Exemplo n.º 5
0
 def op_set_item(engine):
     new_item = PushData.pop_stack_item(engine)
     index = PushData.pop_stack_item(engine)
     item = PushData.pop_stack_item(engine)
     if type(item) is ArrayItem:
         i = index.get_biginteger()
         items = item.get_array()
         items[i] = new_item
     elif type(item) is MapItem:
         item.add(index, new_item)
     elif type(item) is StructItem:
         i = index.get_biginteger()
         item.stack_items.set(i, new_item)
     return VMState.NONE
Exemplo n.º 6
0
 def op_over(engine):
     x2 = PushData.pop_stack_item(engine)
     x1 = PushData.peek_stack_item(engine)
     PushData.peek_stack_item(engine)
     PushData.push(engine, x2)
     PushData.push(engine, x1)
     return VMState.NONE
Exemplo n.º 7
0
 def op_pack(engine):
     size = PushData.pop_int(engine)
     items = list()
     for i in range(size):
         x = PushData.pop_stack_item(engine)
         items.append(x)
     PushData.push_data(engine, items)
     return VMState.NONE
Exemplo n.º 8
0
 def op_array_size(engine):
     item = PushData.pop_stack_item(engine)
     if type(item) is ArrayItem:
         bys = item.get_array()
         PushData.push_data(engine, len(bys))
     else:
         bys = item.get_bytearray()
         PushData.push_data(engine, len(bys))
     return VMState.NONE
Exemplo n.º 9
0
 def op_remove(engine):
     index = PushData.pop_stack_item(engine)
     item = PushData.pop_stack_item(engine)
     item.remove(index)
     return VMState.NONE
Exemplo n.º 10
0
 def op_equal(engine):
     b1 = PushData.pop_stack_item(engine)
     b2 = PushData.pop_stack_item(engine)
     PushData.push_data(engine, b1.equals(b2))
     return VMState.NONE
Exemplo n.º 11
0
 def runtime_serialize(self, config: Config, engine: ExecutionEngine):
     t = PushData.pop_stack_item(engine)
     stream = StreamManager.GetStream()
     writer = BinaryWriter(stream)
     self.__serialize_stack_item(t, writer)
     PushData.push_data(engine, stream.ToArray())
Exemplo n.º 12
0
 def runtime_notify(self, config: Config, engine: ExecutionEngine):
     item = PushData.pop_stack_item(engine)
     print("RuntimeNotify:", self.__convert_neovm_type_hex_str(item))
Exemplo n.º 13
0
 def op_nip(engine):
     x2 = PushData.pop_stack_item(engine)
     PushData.peek_stack_item(engine)
     PushData.push(engine, x2)
     return VMState.NONE
Exemplo n.º 14
0
 def op_drop(engine):
     PushData.pop_stack_item(engine)
     return VMState.NONE
Exemplo n.º 15
0
 def op_to_alt_stack(engine):
     engine.alt_stack.push(PushData.pop_stack_item(engine))
     return VMState.NONE