0

I want to call an Approve method on a FA1.2 token contract.

Michelson code of Approve method at FA1.2 token contract:

(pair %approve (address %spender) (nat %value))

My PascaLigo code:

type approve_params is michelson_pair(address, "spender", nat, "value")
type approve is Approve of approve_params

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

Compiled into michelson:

CONTRACT %approve (pair (address %spender) (nat %value)) ;

That works! I can call the approve method without any problems.

But now I want to call an other Approve method, that looks like this (like ETHtz):

(pair %approve (address :spender) (nat :value)))

How do I have to implement this statement in PascaLigo code ? Annotiations with ":" are not allowed.

I tried so much, but I am still not able to call this method. Always getting failwith message "not a correct contract (approve)".

By the way is someone able to interact with token contracts like ETHtz or BTCtz with PascaLigo implementation?

Your Answer

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

Browse other questions tagged or ask your own question.