Selaa lähdekoodia

fix: 修正 TickMath decimals 调整方向,应为 10^(decA-decB)

原公式 10^(decB-decA) 在两个 token decimals 不同时会产生巨大偏差,
导致 MNT/USDC 等交易对价格区间显示为 7e-7 而非正确的 ~0.70。
当 decimals 相同时(如 XAUt0/USDT)碰巧正确,掩盖了此 bug。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lushdog@outlook.com 1 viikko sitten
vanhempi
commit
84fb6f91bc
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      src/discord/index.ts

+ 1 - 1
src/discord/index.ts

@@ -80,7 +80,7 @@ export async function sendDiscordMessage(positionDetails: OpenPositionEvent['pos
 
 	// 添加区间信息
 	if (positionDetails.lowerTick !== undefined && positionDetails.upperTick !== undefined && mintA && mintB) {
-		const decimalsAdj = Math.pow(10, mintB.decimals - mintA.decimals)
+		const decimalsAdj = Math.pow(10, mintA.decimals - mintB.decimals)
 		const rawPriceLower = Math.pow(1.0001, positionDetails.lowerTick) * decimalsAdj
 		const rawPriceUpper = Math.pow(1.0001, positionDetails.upperTick) * decimalsAdj