1

Given an arbitrary smart contract address or Michelson code, for example:

parameter (or
            (contract %push (big_map string
                                    (pair timestamp
                                          (pair timestamp
                                                (pair nat (pair nat (pair nat (pair nat nat))))))))
            (or (signature %revoke)
                (map %update string
                             (pair signature
                                   (pair timestamp
                                         (pair timestamp
                                               (pair nat (pair nat (pair nat (pair nat nat))))))))));
storage (pair
          (big_map %oracleData string
                               (pair timestamp
                                     (pair timestamp (pair nat (pair nat (pair nat (pair nat nat)))))))
          (option %publicKey key));
view "getPrice" string
      (pair timestamp (pair timestamp (pair nat (pair nat (pair nat (pair nat nat))))))
      { UNPAIR ;
        SWAP ;
        DUP ;
        DUG 2 ;
        CAR ;
        SWAP ;
        DUP ;
        DUG 2 ;
        MEM ;
        IF {} { PUSH string "bad request" ; FAILWITH } ;
        SWAP ;
        CAR ;
        SWAP ;
        GET ;
        IF_NONE { PUSH int 163 ; FAILWITH } {} };
code { UNPAIR ;
       IF_LEFT
         { NIL operation ; SWAP ; PUSH mutez 0 ; DUP 4 ; CAR ; TRANSFER_TOKENS ; CONS }
         { IF_LEFT
             { NONE key ;
               PACK ;
               SWAP ;
               DUP 3 ;
               CDR ;
               IF_NONE { PUSH int 117 ; FAILWITH } {} ;
               CHECK_SIGNATURE ;
               IF
                 {}
                 { PUSH string "WrongCondition: sp.check_signature(self.data.publicKey.open_some(), params, sp.pack(sp.set_type_expr(sp.none, sp.TOption(sp.TKey))))" ;
                   FAILWITH } ;
               NONE key ;
               UPDATE 2 ;
               EMPTY_BIG_MAP string
                              (pair timestamp
                                    (pair timestamp (pair nat (pair nat (pair nat (pair nat nat)))))) ;
               UPDATE 1 }
             { SWAP ;
               DUP ;
               DUG 2 ;
               CDR ;
               IF_NONE { PUSH string "revoked" ; FAILWITH } { DROP } ;
               DUP ;
               ITER { DUP ;
                      GET 3 ;
                      SWAP ;
                      DUP ;
                      DUG 2 ;
                      GET 4 ;
                      DUP 5 ;
                      CAR ;
                      DUP 4 ;
                      CAR ;
                      MEM ;
                      IF
                        { DUP 5 ;
                          CAR ;
                          DUP 4 ;
                          CAR ;
                          GET ;
                          IF_NONE { PUSH int 85 ; FAILWITH } {} ;
                          CAR ;
                          SWAP ;
                          DUP ;
                          DUG 2 ;
                          CAR ;
                          COMPARE ;
                          GT ;
                          IF
                            { DUP ;
                              DUP 4 ;
                              CAR ;
                              PAIR ;
                              PACK ;
                              DIG 2 ;
                              DUP 6 ;
                              CDR ;
                              IF_NONE { PUSH int 117 ; FAILWITH } {} ;
                              CHECK_SIGNATURE ;
                              IF {} { PUSH string "bad sig" ; FAILWITH } ;
                              DIG 3 ;
                              DUP ;
                              CAR ;
                              DIG 2 ;
                              SOME ;
                              DIG 3 ;
                              CAR ;
                              UPDATE ;
                              UPDATE 1 ;
                              SWAP }
                            { DROP 3 } }
                        { DROP 3 } } ;
               DROP } ;
           NIL operation } ;
       PAIR }

Is there an existing tool to create an Archetype, LIGO or SmartPy code which in turn compiles back to that exact Michelson code?

1 Answer 1

1

The closest thing I have found so far is decompiler from Michelson (Dune) to Liquidity: https://liquidity-lang.org/edit/.

The Dune part I think is a fork of the real Tezos blockchain, I am not sure. But it is okay for some POCs.

Cheers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.