File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
web/src/app/api/v1/ads/impression Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import type { NextRequest } from 'next/server'
1919
2020// Revenue share: users get 75% of payout as credits
2121const AD_REVENUE_SHARE = 0.75
22+ const MINIMUM_CREDITS_GRANTED = 0.02
2223
2324// Rate limiting: max impressions per user per hour
2425const MAX_IMPRESSIONS_PER_HOUR = 60
@@ -224,7 +225,10 @@ export async function postAdImpression(params: {
224225 // Calculate credits to grant (75% of payout, converted to credits)
225226 // Payout is in dollars, credits are 1:1 with cents, so multiply by 100
226227 const userShareDollars = payout * AD_REVENUE_SHARE
227- const creditsToGrant = Math . floor ( userShareDollars * 100 )
228+ const creditsToGrant = Math . max (
229+ MINIMUM_CREDITS_GRANTED ,
230+ Math . floor ( userShareDollars * 100 ) ,
231+ )
228232
229233 // Grant credits if any
230234 let creditsGranted = 0
You can’t perform that action at this time.
0 commit comments