0

I have some troubles to call a contract.

This is the scenario:

Contract B (Entrypoint method "transfer"):

(pair %transfer (bytes %args1)
                              (pair (string %args2)
                                      (pair (string %args3)
                                             (pair (address %args4)
                                                    (pair (address %args5)
                                                           (nat %args6))))))

Contract A (which will call Contract B entrypoint method "transfer"):

type transfer is Transfer of (bytes * (string * (string * (address * (address * nat)))))

const contract : contract(transfer) = 
            case (Tezos.get_entrypoint_opt("%transfer", contractAddress): option(contract(transfer))) of 
            | Some (c) -> c
            | None -> (failwith("not a correct contract") : contract(transfer))
            end;

I am quite sure, something inside this statement is wrong for some reason

"type transfer is Transfer of (bytes * (string * (string * (address * (address * nat)))))"

But everytime failwith("not a correct contract") will be triggered 🙁

PS: I tried to call another method on contract B with only three parameters:

type approve is Approve of (bytes * (string * string))

Everything works fine with three parameters. But if I need to call a method with some more parameters, it fails.

Can somebody help ?

Thanks in advance!

3
  • How did you test it? On-chain directly or with the Ligo IDE/command line? Mar 24, 2021 at 7:57
  • Contract A entrypoint (which includes the get_entrypoint_opt call) is called with taquito. The transaction failed with the message "not a correct contract) Means that get_entrypoint_opt returns "None" Mar 24, 2021 at 10:01
  • So it looks like the contracts are on-chain, would you mind sharing their addresses? I would like to have a look at them. Mar 24, 2021 at 15:04

1 Answer 1

0

Found a solution! I am using in both contracts michelson_pairs for the type of the entrypoint. I also added some annotations

For example:

type transfer is michelson_pair(bytes, "args1", michelson_pair(string, "args2", string, "args3"),"")

I just removed the annotations:

type transfer is michelson_pair(bytes, "", michelson_pair(string, "", string, ""),"") 

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.