Ejemplo n.º 1
0
    def execute(cls, stack: MichelsonStack, stdout: List[str],
                context: AbstractContext):
        literal: Type[MichelineLiteral]
        literal = cls.args[0]  # type: ignore

        shell = literal.get_string()
        if shell not in nodes:
            raise Exception(f'Expected one of {nodes}, got {shell}')

        if shell.endswith('.pool'):
            shell = shell.split('.')[0]
            assert shell in nodes, f'unknown network {shell}'
            context.shell = ShellQuery(RpcMultiNode(
                nodes[shell]))  # type: ignore
        elif shell in nodes:
            context.shell = ShellQuery(RpcNode(
                nodes[shell][0]))  # type: ignore
        else:
            context.shell = ShellQuery(RpcNode(shell))  # type: ignore

        context.network = shell  # type: ignore
        context.chain_id = context.shell.chains.main.chain_id()  # type: ignore
        context.big_maps = {}  # type: ignore
        stack.items = []
        return cls()
Ejemplo n.º 2
0
    def execute(cls, stack: MichelsonStack, stdout: List[str],
                context: AbstractContext):
        # FIXME: MichelsonProgram copypaste
        parameter_literal, storage_literal = cls.args  # type: ignore

        parameter_type_expr = context.get_parameter_expr()
        storage_type_expr = context.get_storage_expr()
        if parameter_type_expr is None:
            raise Exception('parameter type is not initialized')
        if storage_type_expr is None:
            raise Exception('storage type is not initialized')

        parameter_type = ParameterSection.match(parameter_type_expr)
        storage_type = StorageSection.match(storage_type_expr)
        parameter = parameter_type.from_micheline_value(
            parameter_literal.as_micheline_expr())
        storage = storage_type.from_micheline_value(
            storage_literal.as_micheline_expr())

        parameter.attach_context(context)
        storage.attach_context(context)
        res = PairType.from_comb([parameter.item, storage.item])
        stack.items = []
        stack.push(res)
        stdout.append(format_stdout(f'BEGIN %default', [], [res]))
        return cls(stack_items_added=1)
Ejemplo n.º 3
0
 def execute(cls, stack: MichelsonStack, stdout: List[str],
             context: AbstractContext):
     context.shell = None  # type: ignore
     context.network = None  # type: ignore
     context.chain_id = None  # type: ignore
     context.big_maps = {}  # type: ignore
     stack.items = []
     return cls()
Ejemplo n.º 4
0
    def execute(cls, stack: MichelsonStack, stdout: List[str], context: AbstractContext):
        literal: Type[MichelineLiteral]
        literal = cls.args[0]  # type: ignore

        network = literal.get_string()
        if network not in nodes:
            raise Exception(f'Expected one of {nodes}, got {network}')

        context.network = network  # type: ignore
        context.chain_id = context.shell.chains.main.chain_id()  # type: ignore
        context.big_maps = {}  # type: ignore
        stack.items = []
        return cls()
Ejemplo n.º 5
0
 def execute(cls, stack: MichelsonStack, stdout: List[str], context: AbstractContext):
     stack.items = []
     return cls()