securesecrets / shadejs

SDK for integrating with Shade contracts
https://shadejs.dev
7 stars 1 forks source link

StInj-Inj pair token0Amount and token1Amount way too big #156

Closed Subfortytwo closed 4 weeks ago

Subfortytwo commented 4 weeks ago

Hi,

A little example that seems wrong to me:

        const output = await batchQueryPairsInfo({
            queryRouterContractAddress: 'secret17gnlxnwux0szd7qhl90ym8lw22qvedjz4v09dm',
            queryRouterCodeHash: '72a09535b77b76862f7b568baf1ddbe158a2e4bbd0f0879c69ada9b398e31c1f',
            pairsContracts: [{
                address: secret1c26v64jmesejsauxx5uamaycfe4zt3rth3yg4e,
                codeHash: e88165353d5d7e7847f2c84134c3f7871b2eee684ffac9fcf8d99a4da39dc2f2
            }]
        })
        console.log("output: ", output)

Result:

output:  [
  {
    pairContractAddress: 'secret1c26v64jmesejsauxx5uamaycfe4zt3rth3yg4e',
    pairInfo: {
      token0Contract: [Object],
      token1Contract: [Object],
      lpTokenContract: [Object],
      factoryContract: [Object],
      daoContractAddress: 'secret1g86l6j393vtzd9jmmxu57mx4q8y9gza0tncjpp',
      isStable: true,
      token0Amount: '1911933261860998115980',
      token1Amount: '3927370102718270638419',
      lpTokenAmount: '2898119872925304534650',
      lpFee: 0.0005,
      daoFee: 0.0005,
      stableParams: [Object],
      contractVersion: 1
    },
    blockHeight: undefined
  }
]

token0Amount and token1Amount are a bit off by a UDENOM imo, what do you think?

To compare, here is the StAtom-Atom pair :

output:  [
  {
    pairContractAddress: 'secret1a65a9xgqrlsgdszqjtxhz069pgsh8h4a83hwt0',
    pairInfo: {
      token0Contract: [Object],
      token1Contract: [Object],
      lpTokenContract: [Object],
      factoryContract: [Object],
      daoContractAddress: 'secret1g86l6j393vtzd9jmmxu57mx4q8y9gza0tncjpp',
      isStable: true,
      token0Amount: '7695298136',
      token1Amount: '11263094835',
      lpTokenAmount: '9249498325',
      lpFee: 0.0005,
      daoFee: 0.0005,
      stableParams: [Object],
      contractVersion: 1
    },
    blockHeight: undefined
  }
]

Thanks

Subfortytwo commented 4 weeks ago

Damn,

        console.log("output: ", output[0].pairInfo.stableParams)

  token0Data: { oracleKey: 'Stableswap Rate Base', decimals: 18 },
  token1Data: { oracleKey: 'Stride INJ Rate', decimals: 18 },

The info hides here, 18 decimals, that's why, correct?

Subfortytwo commented 4 weeks ago

I will close it. Sorry for the disturbance.