@clonegod/ttd-bsc-common 3.1.60 → 3.1.62
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.
|
@@ -46,8 +46,9 @@ class QuotePriceVerify {
|
|
|
46
46
|
if (cached.verifiedReferenceBlock === cached.referenceBlock)
|
|
47
47
|
return;
|
|
48
48
|
cached.verifiedReferenceBlock = cached.referenceBlock;
|
|
49
|
-
const
|
|
50
|
-
const
|
|
49
|
+
const sign = params.swapperDeltaConvention ? -1n : 1n;
|
|
50
|
+
const amt0 = BigInt(amount0) * sign;
|
|
51
|
+
const amt1 = BigInt(amount1) * sign;
|
|
51
52
|
if (amt0 === 0n && amt1 === 0n)
|
|
52
53
|
return;
|
|
53
54
|
let inputTokenAddress;
|
|
@@ -134,9 +135,9 @@ class QuotePriceVerify {
|
|
|
134
135
|
const side = isBuy ? 'BUY' : 'SELL';
|
|
135
136
|
if (refPrice <= 0 || execPriceNum <= 0)
|
|
136
137
|
return;
|
|
137
|
-
const diffBps = (
|
|
138
|
+
const diffBps = (refPrice - execPriceNum) / refPrice * 10000;
|
|
138
139
|
const absDiffBps = Math.abs(diffBps);
|
|
139
|
-
const status = absDiffBps <
|
|
140
|
+
const status = absDiffBps < 5 ? '✅' : absDiffBps < 10 ? '⚠️' : '❌';
|
|
140
141
|
const usdStr = swapUsd > 0 ? `$${swapUsd.toFixed(0)}` : '$?';
|
|
141
142
|
const maxUsd = cached.quoteAmountUsd * 2;
|
|
142
143
|
const inRange = swapUsd <= 0 || swapUsd <= maxUsd;
|