Skip to content

Commit 2dae222

Browse files
committed
Fix lower bound exchange data native amount threshold
1 parent 5a88c9b commit 2dae222

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/code/currency/validation.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ func validateCurrencyLaunchpadClientExchangeData(ctx context.Context, data code_
118118
// Given the sell value, does it align with the native amount in the target currency
119119
// within half a penny?
120120
errorThreshold := 0.005
121-
nativeAmountLowerBound := math.Max(proto.NativeAmount-errorThreshold, errorThreshold)
121+
nativeAmountLowerBound := proto.NativeAmount - errorThreshold
122+
if nativeAmountLowerBound < errorThreshold {
123+
nativeAmountLowerBound = errorThreshold
124+
}
122125
nativeAmountUpperBound := proto.NativeAmount + errorThreshold
123126
coreMintSellValueInUnits := float64(coreMintSellValueInQuarks) / float64(coreMintQuarksPerUnit)
124127
potentialNativeAmount := otherExchangeRateRecord.Rate * coreMintSellValueInUnits / usdExchangeRateRecord.Rate

0 commit comments

Comments
 (0)