예제 #1
0
def execute_dip(prim: str, stack: MichelsonStack, stdout: List[str],
                count: int, body: Type[MichelsonInstruction], context: AbstractContext) -> MichelsonInstruction:
    stdout.append(format_stdout(prim, [*Wildcard.n(count)], []))
    stack.protect(count=count)
    item = body.execute(stack, stdout, context=context)
    stack.restore(count=count)
    stdout.append(format_stdout(prim, [], [*Wildcard.n(count)], count))
    return item
예제 #2
0
 def execute(cls, stack: MichelsonStack, stdout: List[str], context: AbstractContext):
     depth = cls.args[0].get_int()  # type: ignore
     res = stack.pop1()
     stack.protect(count=depth)
     stack.push(res)
     stack.restore(count=depth)
     stdout.append(format_stdout(cls.prim, [res, *Wildcard.n(depth)], [*Wildcard.n(depth), res], depth))  # type: ignore
     return cls(stack_items_added=1)
예제 #3
0
 def execute(cls, stack: MichelsonStack, stdout: List[str],
             context: AbstractContext):
     depth = cls.args[0].get_int() - 1
     stack.protect(count=depth)
     res = stack.peek().duplicate()
     stack.restore(count=depth)
     stack.push(res)
     stdout.append(
         format_stdout(cls.prim, [*Wildcard.n(depth), res],
                       [res, *Wildcard.n(depth), res], depth))
     return cls()