@merkl/api 0.21.39 → 0.21.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -88,7 +88,9 @@ export class DynamicDataService {
88
88
  const timespan = endTimestamp - startTimestamp;
89
89
  const isWithinTimespan = moment().unix() > startTimestamp && moment().unix() < endTimestamp;
90
90
  const dayspan = Math.max(1, timespan / DAY);
91
- let dailyAmount = isWithinTimespan ? BigInt(record.campaign.amount) / BigInt(dayspan) : BigInt(0);
91
+ let dailyAmount = isWithinTimespan
92
+ ? (BigInt(record.campaign.amount) * BigInt(10 ** 6)) / BigInt(Math.floor(dayspan * 10 ** 6))
93
+ : BigInt(0);
92
94
  let rewardToken;
93
95
  try {
94
96
  rewardToken = await TokenService.findUniqueOrThrow({
@@ -369,8 +369,10 @@ export class RewardService {
369
369
  continue;
370
370
  const timespan = Number(end - start);
371
371
  const isWithinTimespan = moment().unix() > start && moment().unix() < end;
372
- const dayspan = Math.max(1, Math.floor(timespan / DAY));
373
- const dailyAmount = isWithinTimespan ? BigInt(amount) / BigInt(dayspan) : BigInt(0);
372
+ const dayspan = Math.max(1, timespan / DAY);
373
+ const dailyAmount = isWithinTimespan
374
+ ? (BigInt(amount) * BigInt(10 ** 6)) / BigInt(Math.floor(dayspan * 10 ** 6))
375
+ : BigInt(0);
374
376
  const campaignIdInDb = CampaignService.hashId({ campaignId, distributionChain: chainId });
375
377
  try {
376
378
  let token;