1

I'm trying to call the addLiquidity entrypoint of this contract, which is a copy of the Liquidity Baking CPMM contract, which is itself a copy of the Dexter contract.

The original Dexter docs give an example of how to call the addLiquidity entrypoint, and I have been formatting my tezos-client command identically.

However when I run that command I get an error telling me that the argument I have passed to the addLiquidity entrypoint is incorrect. This is confusing as I have formatted it the same way as the example in the docs.

Here is the command I"m running: tezos-client transfer 10 from alice to KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5 --entrypoint 'addLiquidity' --arg 'Pair (Pair "tz1eYpX4e1nu7e3cvtF7UvKFqUvWDahte1ot" 0) (Pair 100 "2030-06-29T18:00:21Z")' --burn-cap 999

Here is the error I get:

Invalid argument passed to contract KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5.
At (unshown) location 0, value
  (Left (Left (Left (Pair (Pair "tz1eYpX4e1nu7e3cvtF7UvKFqUvWDahte1ot" 0) (Pair 100 "2030-06-29T18:00:21Z")))))
is invalid for type
  or (or (or (pair %addLiquidity
                (address %owner)
                (nat %minLqtMinted)
                (nat %maxTokensDeposited)
                (timestamp %deadline))
             (unit %default))
         (or (pair %removeLiquidity
                (address %to)
                (nat %lqtBurned)
                (mutez %minXtzWithdrawn)
                (nat %minTokensWithdrawn)
                (timestamp %deadline))
             (pair %tokenToToken
                (address %outputDexterContract)
                (nat %minTokensBought)
                (address %to)
                (nat %tokensSold)
                (timestamp %deadline))))
     (or (pair %tokenToXtz
            (address %to)
            (nat %tokensSold)
            (mutez %minXtzBought)
            (timestamp %deadline))
         (pair %xtzToToken (address %to) (nat %minTokensBought) (timestamp %deadline))).
At (unshown) location 0, value
  (Left (Left (Pair (Pair "tz1eYpX4e1nu7e3cvtF7UvKFqUvWDahte1ot" 0) (Pair 100 "2030-06-29T18:00:21Z"))))
is invalid for type
  or (or (pair %addLiquidity
            (address %owner)
            (nat %minLqtMinted)
            (nat %maxTokensDeposited)
            (timestamp %deadline))
         (unit %default))
     (or (pair %removeLiquidity
            (address %to)
            (nat %lqtBurned)
            (mutez %minXtzWithdrawn)
            (nat %minTokensWithdrawn)
            (timestamp %deadline))
         (pair %tokenToToken
            (address %outputDexterContract)
            (nat %minTokensBought)
            (address %to)
            (nat %tokensSold)
            (timestamp %deadline))).
At (unshown) location 0, value
  (Left (Pair (Pair "tz1eYpX4e1nu7e3cvtF7UvKFqUvWDahte1ot" 0) (Pair 100 "2030-06-29T18:00:21Z")))
is invalid for type
  or (pair %addLiquidity
        (address %owner)
        (nat %minLqtMinted)
        (nat %maxTokensDeposited)
        (timestamp %deadline))
     (unit %default).
At (unshown) location 0, value
  (Pair (Pair "tz1eYpX4e1nu7e3cvtF7UvKFqUvWDahte1ot" 0) (Pair 100 "2030-06-29T18:00:21Z"))
is invalid for type
  pair (address %owner)
       (nat %minLqtMinted)
       (nat %maxTokensDeposited)
       (timestamp %deadline).
At (unshown) location 1, value
  (Pair "tz1eYpX4e1nu7e3cvtF7UvKFqUvWDahte1ot" 0)
is invalid for type address.
At (unshown) location 1, unexpected primitive, only a string or a byte
sequence can be used here.
Fatal error:
  transfer simulation failed

1 Answer 1

1

As you can see in the explorer, the addLiquidity entrypoint accepts parameter of type

(pair address (pair nat (pair nat timestamp))

But you pass (according to the original Dexter contract):

(pair (pair address nat) (pair nat timestamp))

These are two different types, so you need to re-group your Pairs this way:

Pair "tz1eYpX4e1nu7e3cvtF7UvKFqUvWDahte1ot" (Pair 0 (Pair 100 "2030-06-29T18:00:21Z"))
2
  • Thanks, this is incredibly helpful. I've looked around for a really good explanation of pairs and I have yet to find one. Do you have any recommendations?
    – Whirlybird
    Jul 24, 2021 at 13:36
  • @Whirlybird not sure if I have ever seen such the explanation. pair is quite self-explanatory :) Maybe this will help: tezos.gitlab.io/michelson-reference/#type-pair
    – Groxan
    Jul 25, 2021 at 18:30

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.