@clonegod/ttd-bsc-common 3.0.51 → 3.0.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,7 +55,7 @@ class QuoteAccuracyChecker {
55
55
  else {
56
56
  return;
57
57
  }
58
- this.compareAndLog(poolAddress, poolName, poolInfo, cached, inputTokenAddress, outputTokenAddress, inputAmountUi, outputAmountUi, cached.token0PriceUsd, cached.token1PriceUsd, token0Address, txHash);
58
+ this.compareAndLog(poolAddress, poolName, poolInfo, cached, inputTokenAddress, outputTokenAddress, inputAmountUi, outputAmountUi, cached.token0PriceUsd, cached.token1PriceUsd, token0Address, blockNumber, txHash);
59
59
  }
60
60
  checkSync(params) {
61
61
  if (!this.enabled)
@@ -97,9 +97,9 @@ class QuoteAccuracyChecker {
97
97
  inputAmountUi = Number(delta1) / Math.pow(10, token1Decimals);
98
98
  outputAmountUi = Number(-delta0) / Math.pow(10, token0Decimals);
99
99
  }
100
- this.compareAndLog(poolAddress, poolName, poolInfo, cached, inputTokenAddress, outputTokenAddress, inputAmountUi, outputAmountUi, cached.token0PriceUsd, cached.token1PriceUsd, token0Address);
100
+ this.compareAndLog(poolAddress, poolName, poolInfo, cached, inputTokenAddress, outputTokenAddress, inputAmountUi, outputAmountUi, cached.token0PriceUsd, cached.token1PriceUsd, token0Address, blockNumber);
101
101
  }
102
- compareAndLog(poolAddress, poolName, poolInfo, cached, inputTokenAddress, outputTokenAddress, inputAmountUi, outputAmountUi, token0PriceUsd, token1PriceUsd, token0Address, txHash) {
102
+ compareAndLog(poolAddress, poolName, poolInfo, cached, inputTokenAddress, outputTokenAddress, inputAmountUi, outputAmountUi, token0PriceUsd, token1PriceUsd, token0Address, swapBlockNumber, txHash) {
103
103
  if (inputAmountUi <= 0 || outputAmountUi <= 0)
104
104
  return;
105
105
  let swapUsd = 0;
@@ -131,10 +131,14 @@ class QuoteAccuracyChecker {
131
131
  const tradeFlow = isBuy
132
132
  ? `${inputAmountUi.toFixed(4)} ${quoteToken.symbol} -> ${outputAmountUi.toFixed(4)} ${baseToken.symbol}`
133
133
  : `${inputAmountUi.toFixed(4)} ${baseToken.symbol} -> ${outputAmountUi.toFixed(4)} ${quoteToken.symbol}`;
134
- const txTag = txHash ? ` tx:${txHash.slice(0, 10)}` : '';
135
- const srcTag = cached.source ? ` [${cached.source}]` : '';
136
- const msg = ` ↳ [QuoteAccuracy] vs blk:${cached.blockNumber}${srcTag} ${side} ${usdStr} (${tradeFlow}), ${isBuy ? 'ask' : 'bid'}=${refPrice.toFixed(12)} vs exec=${execPriceNum.toFixed(12)}, diff=${diffBps > 0 ? '+' : ''}${diffBps.toFixed(1)}bps ${status}${rangeTag}${txTag}`;
137
- console.log(msg + '\n');
134
+ const quoteSrc = cached.source || '?';
135
+ const quoteTag = `quote[${quoteSrc} blk:${cached.blockNumber}]`;
136
+ const swapBlk = swapBlockNumber || '?';
137
+ const swapTx = txHash ? ` ${txHash.slice(0, 10)}` : '';
138
+ const swapTag = `swap[blk:${swapBlk}${swapTx}]`;
139
+ const priceLabel = isBuy ? 'ask' : 'bid';
140
+ const msg = ` ↳ [QuoteAccuracy] ${side} ${usdStr} (${tradeFlow}) ${quoteTag} ${priceLabel}=${refPrice.toFixed(12)} vs ${swapTag} exec=${execPriceNum.toFixed(12)} diff=${diffBps > 0 ? '+' : ''}${diffBps.toFixed(1)}bps ${status}${rangeTag}`;
141
+ console.log(msg);
138
142
  }
139
143
  }
140
144
  exports.QuoteAccuracyChecker = QuoteAccuracyChecker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-bsc-common",
3
- "version": "3.0.51",
3
+ "version": "3.0.52",
4
4
  "description": "BSC common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",