@clonegod/ttd-bsc-common 3.0.49 → 3.0.50
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.
|
@@ -37,7 +37,7 @@ export declare class QuoteAccuracyChecker {
|
|
|
37
37
|
private pendingLogs;
|
|
38
38
|
private get enabled();
|
|
39
39
|
getAndClearLog(poolAddress: string): string | null;
|
|
40
|
-
cacheQuote(poolAddress: string, priceId: string, askPrice: number, bidPrice: number, blockNumber: number, quoteAmountUsd: number, token0PriceUsd?: number, token1PriceUsd?: number): void;
|
|
40
|
+
cacheQuote(poolAddress: string, priceId: string, source: string, askPrice: number, bidPrice: number, blockNumber: number, quoteAmountUsd: number, token0PriceUsd?: number, token1PriceUsd?: number): void;
|
|
41
41
|
checkSwap(params: CheckSwapParams): void;
|
|
42
42
|
checkSync(params: CheckSyncParams): void;
|
|
43
43
|
private compareAndLog;
|
|
@@ -17,11 +17,11 @@ class QuoteAccuracyChecker {
|
|
|
17
17
|
this.pendingLogs.delete(poolAddress);
|
|
18
18
|
return log || null;
|
|
19
19
|
}
|
|
20
|
-
cacheQuote(poolAddress, priceId, askPrice, bidPrice, blockNumber, quoteAmountUsd, token0PriceUsd = 0, token1PriceUsd = 0) {
|
|
20
|
+
cacheQuote(poolAddress, priceId, source, askPrice, bidPrice, blockNumber, quoteAmountUsd, token0PriceUsd = 0, token1PriceUsd = 0) {
|
|
21
21
|
if (!this.enabled)
|
|
22
22
|
return;
|
|
23
23
|
this.quoteCache.set(poolAddress, {
|
|
24
|
-
priceId, askPrice, bidPrice, blockNumber, quoteAmountUsd,
|
|
24
|
+
priceId, source, askPrice, bidPrice, blockNumber, quoteAmountUsd,
|
|
25
25
|
verifiedBlock: 0,
|
|
26
26
|
token0PriceUsd, token1PriceUsd,
|
|
27
27
|
});
|
|
@@ -139,7 +139,8 @@ class QuoteAccuracyChecker {
|
|
|
139
139
|
? `${inputAmountUi.toFixed(4)} ${quoteToken.symbol} -> ${outputAmountUi.toFixed(4)} ${baseToken.symbol}`
|
|
140
140
|
: `${inputAmountUi.toFixed(4)} ${baseToken.symbol} -> ${outputAmountUi.toFixed(4)} ${quoteToken.symbol}`;
|
|
141
141
|
const txTag = txHash ? ` tx:${txHash.slice(0, 10)}` : '';
|
|
142
|
-
const
|
|
142
|
+
const srcTag = cached.source ? ` [${cached.source}]` : '';
|
|
143
|
+
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}`;
|
|
143
144
|
this.pendingLogs.set(poolAddress, msg);
|
|
144
145
|
}
|
|
145
146
|
}
|