2

I have a contract of type:

pair (pair (list nat) (pair mutez (map address (list nat))))
   (pair address (pair address bool))

What is an example of a valid initial storage that can be passed to tezos-client originate contract.... --init?

3
  • 1
    This is not an error, this is a type.
    – FFF
    Dec 28, 2019 at 19:24
  • Yes sorry, i used the wrong term. I tried 'pair (pair (list 0) (pair 0 (map { Elt "tz1amgADBK3LLGxgqPK8VAxHj7fmxX3FvWRp" (list 0)))) ; (pair "tz1amgADBK3LLGxgqPK8VAxHj7fmxX3FvWRp" ; (pair "tz1amgADBK3LLGxgqPK8VAxHj7fmxX3FvWRp"} False))' but i'm still confused.
    – candlez
    Dec 28, 2019 at 19:46
  • You are more likely to get a good answer if you provide more details. For example, what exactly are you submitting as your originate command and what exactly is the error output
    – cousinit
    Dec 28, 2019 at 19:47

3 Answers 3

0

More details would help, but from what you put in the comment you have several problems with your current init.

  • Pair should be capitaliized
  • You incorrectly are using keywords map and list, they arent needed, both maps and lists are defined by {} and in the case of maps with each item using Elt

Some examples for your sub types:

(map address (list nat))

would have an init of '{ Elt "tz1amgADBK3LLGxgqPK8VAxHj7fmxX3FvWRp" {0} }'

(pair (list nat) (pair mutez (map address (list nat))))

would have an init of 'Pair {1} (Pair 100 { Elt "tz1amgADBK3LLGxgqPK8VAxHj7fmxX3FvWRp" {0} })'

1
  • ok, thanks a lot, i going to try.
    – candlez
    Dec 28, 2019 at 20:01
0

You can use try-michelson to generate valid of a given storage type. For instance, if you give it the contract, with the same storage as in your example:

parameter unit;
storage (pair (pair (list nat) (pair mutez (map address (list nat)))) (pair address (pair address bool)));
code { FAILWITH; }

And press "generate storage", you will have an example initial storage such as:

(Pair (Pair { 172 ; 24263 }            (Pair 1926673630438126278                  { Elt "tz1VUTd4vuyvobzTYwDjVS6BJYNVnZJ773nn" { 196 ; 39 ; 27641 } ;                    Elt "tz1bNMyAPYMoQ92NphetXY54Uizvw6pH45Sn" { 11429 ; 39285 ; 14428 } }))      (Pair "tz1aJLJHX1pumbM3MmPJ3zzH2sEk9T8JyFTE"            (Pair "tz1MQYB5eY4ZMrp5Qr3fanftf3R3i4KFPstV" False)))
-2

OK, so i think i got it:

'Pair (Pair {0} (Pair 0 { Elt "tz1amgADBK3LLGxgqPK8VAxHj7fmxX3FvWRp" {0}})) (Pair "tz1amgADBK3LLGxgqPK8VAxHj7fmxX3FvWRp" (Pair "tz1amgADBK3LLGxgqPK8VAxHj7fmxX3FvWRp" False))'

But now i have a real error:

At line 43 characters 19 to 27,
The FAIL instruction must appear in a tail position.

But compiling the Fi has no error, ist this in my --init parameter something wrong, or really in the .fi file ?

2
  • 1
    That's a different question, stackexchange works best when you ask one question at a time. Create a new question that specficies the contract code and the error
    – cousinit
    Dec 28, 2019 at 20:28
  • 1
    Also you should upvote answers that you find helpful in order to help others know that the information is useful as well as to encourage people to provide you future answers. The stackexchange is a collaborative community effort to share quality information.
    – cousinit
    Dec 28, 2019 at 20:33

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.