3

I have the following contract:

parameter (pair :doc (string %name) (string %sig));
storage (list (pair :doc (string %name) (string %sig)));
code { DUP ;
       DIP { CDR @storage_slash_1 } ;
       CAR @parameter_slash_2 ;
       SWAP ;
       SWAP ;
       CONS ;
       NIL operation ;
       PAIR };

How can I call this contract with an doc type as parameter? All the example I find use a single string or int as parameter.

I have been trying:

tezos-client transfer 0 from yolo to docs --arg '{ name = "test"; sig = "abcd" }'

But I guess that is how liquidity expresses parameters? 🤔

2 Answers 2

4

As per the Michelson spec you need to use the correct calling convention. You should use the following:

(Pair "this is a string" "a signature string")

One other obeservation - Why do you have SWAP repeated? This effectively returns the stack to how it was.

1
  • Thanks a bunch! The Micelson code was transpiled from ReasonML -> Liquidity -> Michelson, perhaps not optimal. I need to dig into the Michelson spec, and I'll be sure to look into why the code is adding that repeated SWAP 👍 Thanks again! Feb 12, 2019 at 8:10
5

If you use the next branch of Liquidity, you can use :

  • liquidity CONTRACT.liq --call-arg main '{ name = "test"; sig = "abcd" }' to print the argument to be used by tezos-client (where main is the entry point you want)

  • liquidity --re CONTRACT.liq to directly compile a file in ReasonML syntax (add the --re argument in the previous command also)

(the double SWAP is under-optimized generated code, we will add a pass of optimization on the Michelson code in a later version)

1
  • 1
    Nice! Thanks for great feedback here 👌 Will try the next branch 👍 Feb 12, 2019 at 11:31

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.