I'm working on building an interface for liquidity baking and am encountering the error: Error during estimation when I submit the calculations for the swap tokenToXtz or xtzToToken on the swap function.
After trying to use both https://tezostaquito.io/docs/next/liquidity_baking/ and https://gitlab.com/camlcase-dev/dexter-calculations/-/tree/2a5b30e5edc00b6f4faa17fdae8590bfad428649/ along with random other resources I have found online, I'm not getting anywhere.
Anyone encounter this issue / know where there is a detailed guide to interacting with the liquidity baking contract?
I'm using v13.0.0 of taquito.
Example:
Using the current storage data for the LB dex contract with the https://github.com/kukai-wallet/kukai-dex-calculations and Kukai's implementation of it in their wallet, here is what I am getting:
Storage used: xtz_pool: 5535658327002 token_pool: 41689853021 xtz_in: 1000000
Returns:
minsTokenBought: 7478
And then when calling the xtzToToken entrypoint on the contract, I get:
Raw:
[
{
destination: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5',
kind: 'transaction',
amount: 0,
parameters: {
entrypoint: 'xtzToToken',
value: {
prim: 'Pair',
args: [
{ string: 'tz1ezDb77a9jaFMHDWs8QXrKEDkpgGdgsjPD' },
{ prim: 'Pair', args: [{ int: '7478' }, { string: '2022-09-14T12:34:57.270Z' }] },
],
},
},
},
]
Error Warning Received:
{
error: [
{
errors: [
{
kind: 'temporary',
id: 'proto.013-PtJakart.michelson_v1.runtime_error',
contract_handle: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5',
contract_code: 'Deprecated',
},
{
kind: 'temporary',
id: 'proto.013-PtJakart.michelson_v1.script_rejected',
location: 1492,
with: { int: '18' },
},
],
errorDetails: 'Error occurred during estimation',
name: 'TezosOperationError',
id: 'proto.013-PtJakart.michelson_v1.script_rejected',
kind: 'temporary',
message: '18',
isError: true,
},
{
errors: [
{
kind: 'temporary',
id: 'proto.013-PtJakart.michelson_v1.runtime_error',
contract_handle: 'KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5',
contract_code: 'Deprecated',
},
{
kind: 'temporary',
id: 'proto.013-PtJakart.michelson_v1.script_rejected',
location: 1492,
with: { int: '18' },
},
],
errorDetails: 'Error occurred during estimation',
name: 'TezosOperationError',
id: 'proto.013-PtJakart.michelson_v1.script_rejected',
kind: 'temporary',
message: '18',
isError: true,
},
],
}
Thanks in advance!