5

I've tried to understand how to interact on the interface on Better Call dev but can't seem to figure it out. When I execute them under simulation I get failed transaction. Where do I insert the amount of Tez and tzBTC I want to provide? and how will I know the ratio? -> what is maxTokensDeposited? -> what is minLqtminted? are those two sort of caps that if exceeded the contract call will not go through?

2

You put the amount of tez you'd like to supply in the amount field, which represents the tez amount transferred to the contract. maxTokensDeposited and minLqtMinted are the maximum number of tokens (tzBTC on mainnet) that you'd like to provide and the number of liquidity tokens you'd like to receive. The market making contract (CPMM) calculates the exchange rate for both of these and this call will fail if it's below either parameter or if you don't have enough tokens. You can back of the envelope it using the pool values in storage and the constant product formula in the Granada docs: https://tezos.gitlab.io/010/liquidity_baking.html.

You can set minLqtMinted to zero and the call should succeed, but you'll just be giving tez to the CPMM for free. To actually provide liquidity you'll need to first obtain tokens (the testnet stand-in for tzBTC) and then set an allowance in the token contract for the CPMM. Currently, the easiest way to do this on granadanet is to swap tokens out of the CPMM itself using the xtzToToken entrypoint. Then go to the token contract address in the CPMM storage and call the approve entrypoint with the CPMM address in the spender field. Now you should be able to provide liquidity and check your liquidity token balance in the LQT contract. When you remove liquidity, you'll notice the value of liquidity tokens has appreciated due to the liquidity baking subsidy.

1
  • 2
    Is there any official documentation on this? Will there be a blog post with better instructions? Screenshots? Maybe a YT video demonstration? What about a web-based UI with wallet integration?
    – utdrmac
    Jul 28 at 21:13

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.