I am trying to replace get_contract with Tezos.get_entrypoint_opt I need to transfer FA1.2 tokens in Dex: https://github.com/madfish-solutions/quipuswap-core/blob/master/contracts/Dex.ligo#L21-L28

      operations := transaction(
         Transfer(Tezos.sender, this, tokenAmount), 
         case (Tezos.get_entrypoint_opt("%transfer", s.tokenAddress) : option(contract(x))) of Some(contr) -> contr
         | None -> (failwith("01"):contract(x))
         ) # operations;

But the entrypoint isn't found during execution. Deployed contract: https://better-call.dev/carthagenet/KT1PB7PCFS3F71FT8fbRmYsYX3ex8W7X5Vcw I have used this approach before and it worked fine:

operations := transaction(Transfer(Tezos.sender, this, tokenAmount), 0mutez, (get_contract(s.tokenAddress): contract(tokenAction))) # operations;

Deployed contract: https://better-call.dev/carthagenet/KT1KSpx5NY7FkY9PFBGRbYbui36rEF6agVWr Could someone advise something?


In LIGO entrypoint name corresponds to your router enum value types, not function names. So "Transfer" should start with uppercase letter.

In you case you should call it as follows: Tezos.get_entrypoint_opt("%Transfer", s.tokenAddress)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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