Skip to content

Commit d94f82b

Browse files
fix to calculate jettons price
1 parent 41b2465 commit d94f82b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/rates/market.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -679,10 +679,11 @@ func convertedDeDustPoolResponse(pools map[ton.AccountID]float64, respBody io.Re
679679
existingAssets.Assets[0].Reserve, existingAssets.Assets[1].Reserve,
680680
existingAssets.Assets[0].Decimals, existingAssets.Assets[1].Decimals,
681681
)
682-
// Calculate the total liquidity of the pool
683-
currentLiquidity := firstAssetReserve + secondAssetReserve
684-
existingLiquidity := existingFirstReserve + existingSecondReserve
685-
if currentLiquidity > existingLiquidity {
682+
// Check if the current reserve is greater than the existing reserve
683+
if firstAsset.Account == mainAsset.Account && firstAssetReserve > existingFirstReserve {
684+
actualAssets[mainAsset.Account] = DeDustAssets{Assets: []Asset{firstAsset, secondAsset}, IsStable: deDustAssets.IsStable}
685+
}
686+
if secondAsset.Account == mainAsset.Account && secondAssetReserve > existingSecondReserve {
686687
actualAssets[mainAsset.Account] = DeDustAssets{Assets: []Asset{firstAsset, secondAsset}, IsStable: deDustAssets.IsStable}
687688
}
688689
}

0 commit comments

Comments
 (0)