Skip to content

feat(rotational): configurable deposit reminders before round deadline#97

Open
Ebenezer199914 wants to merge 1 commit into
JointSave-org:mainfrom
Ebenezer199914:feat/deposit-reminders-93
Open

feat(rotational): configurable deposit reminders before round deadline#97
Ebenezer199914 wants to merge 1 commit into
JointSave-org:mainfrom
Ebenezer199914:feat/deposit-reminders-93

Conversation

@Ebenezer199914

Copy link
Copy Markdown
Contributor

Summary

Closes #93

Adds configurable deposit reminders so members get notified before a rotational round's deposit deadline.

Changes

Smart Contract ()

  • **** — new persistent storage key (u64, seconds)
  • **** — admin-only setter; stores lead time and bumps TTL
  • **** — public getter; returns 0 (disabled) when not set
  • **** — view function; returns true when now ≥ next_payout_time − lead_time and now < next_payout_time and pool is active

Tests (7 new cases in tests.rs)

  • Default lead time is 0
  • Set and get round-trip
  • Non-admin rejection
  • deposit_reminder_due false when lead time is 0
  • False before the reminder window
  • True inside the reminder window
  • False at/after the deadline
  • False when pool is inactive

Frontend / Infra

  • useUserProfile.tsemail_on_reminder: boolean added to NotificationPreferences
  • useNotifications.ts — pre-existing TS7006 implicit-any fix (non-breaking)
  • lib/supabase.tsemail_on_reminder added to user_profiles JSONB type definitions
  • notify-pool-event/index.ts — handles deposit_reminder activity type; sends email + in-app notification to all members who haven't deposited; respects email_on_reminder opt-out
  • hooks/useDepositReminder.ts — new hook; calls deposit_reminder_due via RPC simulation; inserts pool_activity row on true to trigger the webhook
  • migrations/20260623000000_add_reminder_lead_time.sql — adds nullable reminder_lead_time bigint column to pools table

Testing

  • tsc --noEmit passes with zero errors
  • 27 contract unit tests in tests.rs + 4 in test.rs (CI runs cargo test)
  • No existing tests modified

JointSave-org#93)

- Add ReminderLeadTime DataKey to rotational contract
- Add set_reminder_lead_time (admin-only) and reminder_lead_time (getter)
- Add deposit_reminder_due view: true when within the lead-time window
- Extend TTL for ReminderLeadTime in bump_config_state_internal
- Add 7 unit tests covering default, set/get, auth guard, and all
  boundary conditions of deposit_reminder_due
- Add email_on_reminder to NotificationPreferences (useUserProfile,
  useNotifications, supabase.ts types, notify-pool-event edge function)
- Handle deposit_reminder activity_type in notify-pool-event with
  email + in-app notification delivery
- Add useDepositReminder hook to check contract view and dispatch activity
- Add DB migration: reminder_lead_time column on pools table
- Fix pre-existing TS7006 implicit-any in useNotifications.ts
@Sendi0011

Copy link
Copy Markdown
Contributor

@Ebenezer199914 kindly resolve conflict please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Add configurable deposit reminders before a rotational round's deadline

2 participants