@pwngh/economy-lab
    Preparing search index...

    Interface PromoStore

    Tracks each marketing promo grant so the promo-expiry sweep can reverse the unspent remainder against SYSTEM.PROMO_FLOAT once the grant expires.

    interface PromoStore {
        claimDue(
            now: number,
            limit: number,
            options?: CallOptions,
        ): Promise<readonly PromoGrant[]>;
        markReversed(id: string, options?: CallOptions): Promise<void>;
        open(grant: PromoGrant, options?: CallOptions): Promise<void>;
    }
    Index
    • Grabs up to limit expired (expiresAt <= now), not-yet-reversed grants, oldest expiresAt first; a reversed grant is never handed back, so a grant is reversed at most once across sweeps.

      Parameters

      • now: number
      • limit: number
      • Optionaloptions: CallOptions

      Returns Promise<readonly PromoGrant[]>

    • Marks a grant reversed so claimDue never returns it again; a missing or already-reversed row is a no-op, so re-running the sweep is harmless.

      Parameters

      Returns Promise<void>

    • Idempotent on grant.id: opening the same id twice never overwrites the first row. Called inside the grant's transaction, so it only takes effect if that transaction commits.

      Parameters

      Returns Promise<void>