Skip to content

Commit 008a3e6

Browse files
committed
Add an additoinal quark to airdrop to reduce chance of round downs on client
1 parent f16e5a5 commit 008a3e6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/code/server/transaction/airdrop.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,13 @@ func (s *transactionServer) airdrop(ctx context.Context, intentId string, owner
216216
return nil, err
217217
}
218218

219+
var additionalQuarks uint64
219220
var otherRateRecord *currency.ExchangeRateRecord
220221
switch currencyCode {
221222
case currency_lib.USD:
223+
if !common.IsCoreMintUsdStableCoin() {
224+
additionalQuarks = 1
225+
}
222226
otherRateRecord = usdRateRecord
223227
case common.CoreMintSymbol:
224228
otherRateRecord = &currency.ExchangeRateRecord{
@@ -227,6 +231,7 @@ func (s *transactionServer) airdrop(ctx context.Context, intentId string, owner
227231
Symbol: string(common.CoreMintSymbol),
228232
}
229233
default:
234+
additionalQuarks = 1
230235
otherRateRecord, err = s.data.GetExchangeRate(ctx, currencyCode, exchangeRateTime)
231236
if err != nil {
232237
log.WithError(err).Warn("failure getting other rate")
@@ -235,7 +240,7 @@ func (s *transactionServer) airdrop(ctx context.Context, intentId string, owner
235240
}
236241

237242
coreMintAmount := nativeAmount / otherRateRecord.Rate
238-
quarkAmount := uint64(coreMintAmount * float64(common.CoreMintQuarksPerUnit))
243+
quarkAmount := uint64(coreMintAmount*float64(common.CoreMintQuarksPerUnit)) + additionalQuarks
239244

240245
usdValue := usdRateRecord.Rate * coreMintAmount
241246
if usdValue > s.conf.maxAirdropUsdValue.Get(ctx) {

0 commit comments

Comments
 (0)