66 "time"
77
88 transactionpb "github.com/code-payments/code-protobuf-api/generated/go/transaction/v2"
9+ "github.com/sirupsen/logrus"
910
1011 "github.com/code-payments/code-server/pkg/code/common"
1112 code_data "github.com/code-payments/code-server/pkg/code/data"
@@ -74,6 +75,14 @@ func validateCurrencyLaunchpadClientExchangeData(ctx context.Context, data code_
7475 return false , "" , err
7576 }
7677
78+ log := logrus .StandardLogger ().WithFields (logrus.Fields {
79+ "currency" : proto .Currency ,
80+ "native_amount" : proto .NativeAmount ,
81+ "exhange_rate" : proto .ExchangeRate ,
82+ "quarks" : proto .Quarks ,
83+ "mint" : mintAccount .PublicKey ().ToBase58 (),
84+ })
85+
7786 coreMintQuarksPerUnit := common .GetMintQuarksPerUnit (common .CoreMintAccount )
7887 otherMintQuarksPerUnit := common .GetMintQuarksPerUnit (mintAccount )
7988
@@ -126,6 +135,7 @@ func validateCurrencyLaunchpadClientExchangeData(ctx context.Context, data code_
126135 coreMintSellValueInUnits := float64 (coreMintSellValueInQuarks ) / float64 (coreMintQuarksPerUnit )
127136 potentialNativeAmount := otherExchangeRateRecord .Rate * coreMintSellValueInUnits / usdExchangeRateRecord .Rate
128137 if potentialNativeAmount < nativeAmountLowerBound || potentialNativeAmount > nativeAmountUpperBound {
138+ log .WithField ("potential_native_amount" , potentialNativeAmount ).Info ("native amount is outside error threshold" )
129139 continue
130140 }
131141
@@ -134,6 +144,7 @@ func validateCurrencyLaunchpadClientExchangeData(ctx context.Context, data code_
134144 expectedRate := potentialNativeAmount / otherMintUnits
135145 percentDiff := math .Abs (proto .ExchangeRate - expectedRate ) / expectedRate
136146 if percentDiff > 0.0001 {
147+ log .WithField ("potential_exchange_rate" , expectedRate ).Info ("native amount is outside error threshold" )
137148 continue
138149 }
139150
0 commit comments