You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not sure the best way to show this, but these are my results below. As you can see, all of the estimates are correct except for one, which turns out to be the only one with a different decimal value for one of the pairs. These pool values are pulled via the subgraph, parsed, estimated, and then queried, so I understand that there might simply be a diff created by a swap in a new block, but I get it consistently ... it seems like a large diff, especially since it compounds when trying to calculate the deltas for a batch with multiple swaps.
Here is a snippet where the deltas are being calculated:
import*asSDKfrom'@georgeroman/balancer-v2-pools';
...
exportconstgetSDKestimatesForPools=(pools: Balancer.Pool[])=>pools.map((pool)=>{const{ tokens }=pool;const[srcToken,destToken]=tokens;constmaxIn=calcMaxOutForToken(srcToken).div(10**srcToken.decimals).toString();try{constwPool=newSDK.WeightedPool({
...pool,tokens: tokens.map((token)=>({
...token,weight: token.weight.toString(),balance: token.balance.toString(),})),bptTotalSupply: '0',// We're not using this for the momentswapFeePercentage: pool.swapFee.toString(),query: true,});returnBig(wPool.swapGivenIn(srcToken.symbol,destToken.symbol,maxIn)).mul(10**destToken.decimals).toString();
Not sure the best way to show this, but these are my results below. As you can see, all of the estimates are correct except for one, which turns out to be the only one with a different decimal value for one of the pairs. These pool values are pulled via the subgraph, parsed, estimated, and then queried, so I understand that there might simply be a diff created by a swap in a new block, but I get it consistently ... it seems like a large diff, especially since it compounds when trying to calculate the deltas for a batch with multiple swaps.
Actual deltas (from queryBatchSwap; the second number is the delta under analysis):
The pair/swap that is off is this:
With the Pool type def:
Here is the raw pool data:
The text was updated successfully, but these errors were encountered: