Skip to content

[377][378][379][380] [BE-029–BE-032] Auto-sweep worker, yield calculator, toggle API, and report notifications#426

Merged
ONEONUORA merged 1 commit into
Fracverse:masterfrom
josephchimebuka:feat/be-029-032-yield-workers
Jun 27, 2026
Merged

[377][378][379][380] [BE-029–BE-032] Auto-sweep worker, yield calculator, toggle API, and report notifications#426
ONEONUORA merged 1 commit into
Fracverse:masterfrom
josephchimebuka:feat/be-029-032-yield-workers

Conversation

@josephchimebuka

@josephchimebuka josephchimebuka commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Closes #377
Closes #378
Closes #379
Closes #380

Summary

Implements backend issues #377, #378, #379, and #380:

Issue Ticket Deliverable
#377 BE-029 Auto-sweep scheduler background worker (sweep_worker.rs)
#378 BE-030 POST /api/yield/toggle-auto preference endpoint
#379 BE-031 Off-chain real-time yield calculator (yield_calc.rs)
#380 BE-032 Daily/weekly yield report notification scheduler (notifications.rs)

#377 — Auto-sweep scheduler

  • Polls users with auto_earn_enabled = true
  • Sweeps idle available_balance into earning_balance and logs DEPOSIT transactions
  • Configurable via SWEEP_POLL_INTERVAL_SECS and SWEEP_MIN_IDLE_AMOUNT

#378 — Toggle auto-earn API

  • POST /api/yield/toggle-auto saves users.auto_earn_enabled
  • Returns confirmation payload with current auto_earn_enabled state
  • GET /api/yield/balance also exposes auto_earn_enabled

#379 — Off-chain yield calculator

  • Linear interest estimate since last_yield_sync_at using current APY
  • Balance API returns accrued_interest and total_earning_balance
  • format_yield_feed_fields helper exposed for feed query responses

#380 — Yield report notifications

  • Daily and weekly schedulers for users with positive earning balances
  • Sends Expo push notifications when earned yield exceeds YIELD_REPORT_THRESHOLD
  • Uses user_push_tokens table and Expo Push API

Database migration

20260627000000_yield_auto_earn_and_notifications.sql adds:

  • users.auto_earn_enabled, last_daily_yield_report_at, last_weekly_yield_report_at
  • user_yield_balances.last_yield_sync_at
  • user_push_tokens table

Test plan

  • cargo build succeeds
  • Unit tests for yield_calc and notification period math pass
  • Run migration and verify POST /api/yield/toggle-auto toggles auto_earn_enabled
  • Confirm GET /api/yield/balance returns live accrued_interest / total_earning_balance
  • Seed auto-earn user with idle balance; verify sweep worker moves funds
  • Register Expo push token; verify scheduler sends notification above threshold

@drips-wave

drips-wave Bot commented Jun 27, 2026

Copy link
Copy Markdown

@josephchimebuka Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@josephchimebuka josephchimebuka changed the title feat: auto-sweep worker, yield calculator, toggle API, and report notifications (#377–#380) [377][378][379][380] [BE-029–BE-032] Auto-sweep worker, yield calculator, toggle API, and report notifications Jun 27, 2026
…ifications

Closes Fracverse#377
Closes Fracverse#378
Closes Fracverse#379
Closes Fracverse#380

- BE-029: auto-sweep scheduler background worker
- BE-030: POST /api/yield/toggle-auto preference endpoint
- BE-031: off-chain real-time yield calculator
- BE-032: daily/weekly yield report notification scheduler

Co-authored-by: Cursor <cursoragent@cursor.com>

@ONEONUORA ONEONUORA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @josephchimebuka
Thank you for your contribution

@ONEONUORA ONEONUORA merged commit d8417b4 into Fracverse:master Jun 27, 2026
7 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants