Ejemplo n.º 1
0
    def _execute_code(self, code, parameter=None, storage=None) -> None:
        micheline = michelson_to_micheline(code)
        sequence = MichelineSequence.match(micheline)

        program = MichelsonProgram.create(sequence)(
            'default', parameter or ParameterSection(UnitType()), storage or StorageSection(UnitType())
        )
        program.execute(self.stack, self.stdout, self.context)
Ejemplo n.º 2
0
 def match(expr) -> Type['MichelsonProgram']:
     seq = cast(Type[MichelineSequence], MichelineSequence.match(expr))
     if not issubclass(seq, MichelineSequence):
         raise Exception(f'Expected sequence, got {seq.prim}')
     return MichelsonProgram.create(seq)
Ejemplo n.º 3
0
 def match(expr) -> Type['MichelsonProgram']:
     seq = cast(Type[MichelineSequence], MichelineSequence.match(expr))
     assert issubclass(seq, MichelineSequence), f'expected sequence, got {seq.prim}'
     return MichelsonProgram.create(seq)