@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
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
|
|
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;
|