bitcoin-sv / bsv-faucet

https://bsv-faucet.vercel.app
MIT License
1 stars 7 forks source link

#10 Admin: Funding replenishment alerts #16

Open mo-jaber opened 3 days ago

mo-jaber commented 3 days ago

Related to https://github.com/bitcoin-sv/bsv-faucet/issues/17 and https://github.com/bitcoin-sv/bsv-faucet/issues/13

Description: Automatically alert admins when the faucet's wallet is running low on coins, enabling timely refills to maintain service continuity.

User Story: As an admin, I want to receive alerts when the faucet wallet's balance is low, so that I can replenish funds in a timely manner to ensure uninterrupted distribution of testnet coins.

acceptance criteria

  1. I can set a custom low-balance threshold in the admin dashboard for when an alert should be triggered.

  2. The system monitors the faucet wallet balance in real-time and checks it against the defined threshold.

  3. When the wallet balance falls below the set threshold, the system sends an immediate alert via email and/or SMS.

  4. The alert includes:

    • Current wallet balance.
    • Date and time of the alert.
    • Recommended action for replenishment.
  5. I can configure multiple email addresses or phone numbers to receive alerts.

  6. The system continues to send periodic alerts if the balance remains below the threshold until the wallet is replenished.

Jemiiah commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello @mo-jaber I'm a front-end web 3 developer with good experience in contributing to OD Project and over 50+ contributions in OD Hack this is my github profile : https://github.com/Jemiiah here is my onlydust profile as well : https://app.onlydust.com/u/Jemiiah

How I plan on tackling this issue

Admin Dashboard Setup Start by adding a section in the admin dashboard where admins can define a custom "low balance" threshold. This will let admins set the minimum acceptable wallet balance (in BSV). Make this threshold editable, but with sensible defaults (e.g., 0.1 BSV).

Real-time Wallet Monitoring I’ll need to implement real-time monitoring of the faucet’s BSV wallet balance. This will involve integrating an API or Web3 function to periodically check the wallet's balance and compare it against the threshold set by the admin.

For this, a simple polling mechanism (maybe every few minutes) can be used to fetch the balance of the wallet. Alternatively, I could use a WebSocket or event listener to trigger the check when the balance updates.

Trigger Alert on Low Balance If the balance falls below the defined threshold, we need to fire off alerts immediately. Here’s what I’ll do:

Send an alert via email and/or SMS (this will require integrating with services like SendGrid for email or Twilio for SMS). Include the following in the message: Current wallet balance Date/time the alert was triggered Suggested action (e.g., "Please refill the wallet with at least X BSV to continue operations.") Alert Configurations The admin should be able to configure multiple contact points (email addresses and phone numbers) that will receive the low-balance alerts. I’ll add a form where they can input multiple contacts and choose how they want to be notified (email, SMS, or both).

Continuous Alerts Until Replenishment If the wallet stays below the threshold, I’ll set up recurring alerts. Let’s say every X hours (configurable by the admin, with a default of 4 or 6 hours), the system will keep sending reminders until the balance is topped up. This ensures that the faucet doesn’t run out of funds unnoticed for long.

UI Design Considerations On the front-end, make the alert settings interface simple and clear. The admin should easily be able to:

Set the low-balance threshold Add/edit email addresses or phone numbers for alerting See the current wallet balance in real-time on the dashboard (so they can track it easily without waiting for alerts) Backend Integration for Alerts For this, I’ll need the backend to support:

Fetching the wallet balance Managing alert contacts (emails and phone numbers) Triggering the actual alerts (using services like SendGrid/Twilio as mentioned above) My job here would be to ensure the front-end integrates smoothly with these backend services. On the frontend side, I’ll handle:

Form submissions for alert setup Real-time balance monitoring (polling/WebSocket) Displaying the current balance and alert status in the admin dashboard. Testing Before deploying, I’ll:

Test the balance threshold functionality by setting a low threshold and manually lowering the wallet balance to see if the alert fires. Verify that the email and SMS notifications work as expected, with correct information. Test edge cases, like invalid email/phone inputs or balance fluctuating around the threshold.

0xdevcollins commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm Collins a frontend and blockchain developer, and an active contributor on OnlyDust. You can check out my profile here: https://app.onlydust.com/u/0xdevcollins. This is my first time contributing to this repository, and I’m excited about the opportunity to contribute. Looking forward to collaborating!

How I plan on tackling this issue

To tackle this issue, I would first implement a real-time monitoring system that checks the faucet wallet’s balance continuously and compares it to the low-balance threshold set by the admin in the dashboard. This threshold will be fully customizable, allowing admins to define when they want to receive alerts.

Once the balance drops below the set threshold, the system will immediately send an alert via email and/or SMS to the configured contacts. The alert will include the current wallet balance, the date and time the alert was triggered, and a recommended action to replenish the wallet.

I would also ensure that admins can configure multiple email addresses or phone numbers to receive these alerts, providing flexibility in communication. Additionally, the system will send periodic alerts if the balance remains low until the wallet is refilled, ensuring that admins stay informed and can take action promptly to maintain service continuity.

saimeunt commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm the maintainer of op-scan (https://github.com/walnuthq/op-scan) a blockchain explorer with a very similar tech stack so I'm familiar with the patterns and best practices used in this project. I will use my XP in Full Stack Web3 Development to implement this issue.

How I plan on tackling this issue

The user story being self explanatory, I will carefully implement it using the latest Next.js best practices, choosing the right shadcn/ui component for the job. I will probably use something like https://resend.com/ to craft a beautiful alert email and I will leverage Vercel CRON jobs system to periodically check for faucet deplenishment.

Benjtalkshow commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a Full Stack Developer specializing in Next.js, TypeScript, Node.js, Cairo and Rust . With over 31 contributions across projects in the OnlyDust ecosystem, I’ve developed strong proficiency in delivering high-quality solutions and resolving complex issues within tight deadlines. My experience spans frontend, backend, smart contracts, and the optimization and maintenance of scalable codebases.

How I plan on tackling this issue

I will implement a Funding Replenishment Alerts feature for admins to ensure timely refills of the faucet's wallet when its balance is low. This feature will help maintain service continuity for the distribution of testnet coins.

As an admin, I will have the ability to set a custom low-balance threshold in the admin dashboard that will trigger alerts when the wallet balance drops below this defined level. The system will monitor the faucet wallet's balance in real-time, continuously checking it against the specified threshold.

When the wallet balance falls below the set threshold, the system will send an immediate alert via email and/or SMS. This alert will include the current wallet balance, the date and time of the alert, and a recommended action for replenishment.

I will also allow admins to configure multiple email addresses or phone numbers to receive these alerts, ensuring that the right team members are notified. If the balance remains below the threshold, the system will continue to send periodic alerts until the wallet is replenished, providing admins with ongoing updates and helping them take prompt action.

ShantelPeters commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

have extensive experience in full-stack web development, particularly in creating user management systems and implementing role-based access controls. My background includes working with real-time data monitoring and alert systems, which aligns well with the requirements for the automatic alert feature.

How I plan on tackling this issue

To implement the automatic alert system for low balances in the faucet wallet, I will first design an interface within the admin dashboard that allows admins to set a custom low-balance threshold. This will involve creating a user-friendly form that validates input to ensure the threshold is within acceptable limits.

Next, I will implement a background service that continuously monitors the faucet wallet balance in real-time. This service will periodically query the wallet balance and compare it against the defined threshold. If the balance falls below the threshold, the system will trigger an alert mechanism.

For the alert system, I will set up email and SMS notification services. Upon triggering an alert, the system will compile relevant information, including the current wallet balance, the date and time of the alert, and recommended actions for replenishment. I will ensure that the system supports configuration for multiple email addresses and phone numbers to receive alerts.

To maintain functionality, I will implement a mechanism for periodic alerts that continues to notify admins until the wallet is replenished. I will also write tests to validate the functionality of the alert system, ensuring reliability and responsiveness in various scenarios.

This approach will provide admins with timely notifications, allowing for efficient management of the faucet's funds and ensuring uninterrupted service.

jrmncos commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm Software Enginer Backend SR (in web2 but this issue is clear)

How I plan on tackling this issue

I will follow the acceptance criteria

suhas-sensei commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i have attended tsoc recently and i have experience in this project

aniruddhaaps commented 2 days ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a python dev . A new-comer here, willing and ready to contribute to solve the issue.

Jemiiah commented 1 day ago

@mo-jaber please kindly assign let me start to work on this issue 🚀

blessingbytes commented 1 day ago

I’d like to work on this.