Git Product home page Git Product logo

Comments (5)

johngrantuk avatar johngrantuk commented on August 29, 2024 1

Hi. Thanks for the info.
I think this may be related to using an outdated priceRate value but we would have to debug further. In the meantime maybe you could use queryBatchSwap with the swap info to get the accurate onchain value.

from balancer-sor.

dongwookang95 avatar dongwookang95 commented on August 29, 2024

Thanks for your suggrestion. I've tried with queryBatchSwap function. It halved the number of errored pools, but still receiving errors. My implementation is following :

`const swaps: BatchSwapStep[] = [
{
poolId: poolInfo.id,
assetInIndex: 0,
assetOutIndex: 1,
amount: amount0In.toString(),
userData: "0x",
},
];

const assets: string[] = [token0, token1];
const swapInfoTest = await balancer.swaps.queryBatchSwap({
kind: swapType,
swaps,
assets,
});`

The token0 and token1 are representing each token's address, and the swapType was set to SwapExactIn. What could be causing this errors? The difference between actual amount returned and queryBatchSwap results are usually less than 0.1%. I will attach the pools with the error.
batchswapError.json.zip

from balancer-sor.

sergioyuhjtman avatar sergioyuhjtman commented on August 29, 2024

I've been studying your file batchswapError.json and could replicate the reported behaviour for some of the pools.
Those with error code BAL#304, are simply due to not enough liquidity in those pools for the requested amount.
Regarding those with different outcomes, I wonder if it is possible that they are due to the time delay between the SOR query and batchSwap query. Most of the reported pools have parameters that change very rapidly, like price rates or moving weights.
Are we sure that both queries were performed with data from the same block?
For most of the reported errors, I think it's possible that the cause is different input data.

from balancer-sor.

dongwookang95 avatar dongwookang95 commented on August 29, 2024

Hi @sergioyuhjtman @johngrantuk , Thanks for the reply.

To clarify the batchswapError.json was comparison results between queryBatchSwap() and swap(). About the time delay between the queryBatchSwap() and Swap(), I fork at block#16217540 , then execute queryBatchSwap() at 16217540 and swap() at 16217541 respectively. However, I found queryBatchSwap is callstatic function which means it won't affect on the state to calculate the price calculation parameters. So that I don't think it is the problem related to time/block difference.

I will add the difference error between getSwap() from SOR and swap() form contract as well. The forked block number is 16217628.

Thank you in advance.

errors.zip

from balancer-sor.

dongwookang95 avatar dongwookang95 commented on August 29, 2024

Issue is resolved from 4.1.1 update

from balancer-sor.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.