11# Wallet Alert Service
22
3- A Go-based microservice that monitors Ethereum wallet activities and sends customized alerts based on user preferences.
3+ A Go-based microservice that monitors Ethereum wallet activities and cryptocurrency prices, sending customized alerts based on user preferences.
44
55## Features
66
@@ -9,31 +9,40 @@ A Go-based microservice that monitors Ethereum wallet activities and sends custo
99 - Detects large token transfers (> 1 ETH)
1010 - Identifies NFT transfers for popular collections (BAYC, Moonbirds)
1111
12+ - ** Cryptocurrency Price Alerts**
13+ - Real-time price monitoring via CoinGecko API
14+ - Support for multiple cryptocurrencies (BTC, ETH)
15+ - Customizable price thresholds
16+ - Upper and lower bound price alerts
17+
1218- ** Customizable User Alerts**
1319 - Email notifications via SendGrid
1420 - Configurable alert thresholds
1521 - Per-wallet notification preferences
16-
17- - ** Event Types**
18- - Large transfers (> 1 ETH)
19- - NFT transfers
20- - Custom threshold alerts
22+ - Price alert preferences
2123
2224## Architecture
2325
2426### Core Components
2527
2628- ** Event Detection** : [ ` nfts.NFTDetector ` ] ( nft/nftdetector.go ) for NFT transfers
27- - ** Notification Service** : [ ` services.EmailNotification ` ] ( services/email_notifier.go ) for sending alerts
29+ - ** Price Monitoring** : [ ` services.PriceMonitor ` ] ( services/price_monitor.go ) for cryptocurrency prices
30+ - ** Alert Services** :
31+ - [ ` services.PriceAlertService ` ] ( services/price_alert.go ) for price alerts
32+ - [ ` services.EmailNotification ` ] ( services/email_notifier.go ) for notifications
2833- ** Data Storage** : GORM-based PostgreSQL integration
2934- ** Repository Layer** :
3035 - [ ` EventRepository ` ] ( repository/event_repository.go ) for event storage
3136 - [ ` UserPreferenceRepository ` ] ( repository/user_preference.go ) for user preferences
37+ - [ ` PriceAlertRepository ` ] ( repository/price_alert_repository.go ) for price alerts
38+ - ** Mock Layer** :
39+ - [ ` mock ` ] ( mock/ ) package for testing with mock implementations
3240
3341### Models
3442
3543- [ ` Event ` ] ( models/event.go ) : Stores transaction details and event types
3644- [ ` UserPreference ` ] ( models/models.go ) : Manages user notification preferences
45+ - [ ` PriceAlert ` ] ( models/models.go ) : Stores cryptocurrency price alert settings
3746
3847## Installation
3948
@@ -59,6 +68,9 @@ Create a `config.yaml` file in the root directory with the following content:
5968 url: "postgresql://username:password@localhost:5432/dbname"
6069 sendgrid:
6170 api_key: "YOUR_SENDGRID_API_KEY"
71+ coingecko:
72+ api_key: "YOUR_COINGECKO_API_KEY"
73+ price_check_interval: 1 # Interval in minutes for price checking
6274
6375## Usage
6476
@@ -68,13 +80,23 @@ Create a `config.yaml` file in the root directory with the following content:
6880
69812. ** Configure user preferences**
7082
83+ // Transaction alerts
7184 userPreference := &models.UserPreference{
7285 UserID: "user@example.com",
7386 WalletAddress: "0x...",
7487 MinEtherValue: "1000000000000000000", // 1 ETH
7588 TrackNFTs: true,
7689 EmailNotification: true,
7790 }
91+
92+ // Price alerts
93+ priceAlert := &models.PriceAlert{
94+ UserID: "user@example.com",
95+ CryptocurrencyID: "BTC",
96+ ThresholdPrice: "50000.00",
97+ IsUpperBound: true,
98+ EmailNotification: true,
99+ }
78100
79101## Testing
80102
@@ -87,6 +109,18 @@ Create a `config.yaml` file in the root directory with the following content:
87109 go test -v ./services/... // Test notification services
88110 go test -v ./repository/... // Test repositories
89111
112+ ## Development
113+ Project Structure
114+
115+ ├── config/ # Configuration management
116+ ├── database/ # Database initialization and connection
117+ ├── models/ # Data models and validation
118+ ├── nft/ # NFT detection logic
119+ ├── repository/ # Data access layer
120+ ├── services/ # Business logic and notifications
121+ ├── mock/ # Mock implementations for testing
122+ └── main.go # Application entry point
123+
90124## Key Components
91125
92126** NFT Detection** :
@@ -99,12 +133,21 @@ Create a `config.yaml` file in the root directory with the following content:
99133 Real-time block monitoring
100134 Transaction filtering and categorization
101135 Event creation and storage
136+
137+ ** Price Monitoring** :
138+
139+ Real-time cryptocurrency price tracking
140+ Configurable check intervals
141+ Support for multiple cryptocurrencies
142+ Threshold-based alerts
143+ Notification System
102144
103145** Notification System** :
104146
105147 Email notifications via SendGrid
106148 User preference-based filtering
107149 Customizable notification templates
150+ Support for both transaction and price alerts
108151
109152## Development
110153Project Structure
@@ -133,4 +176,6 @@ Set test environment:
133176 go-ethereum: Ethereum client
134177 sendgrid-go: Email notifications
135178 gorm: Database ORM
136- viper: Configuration management
179+ viper: Configuration management
180+ coingecko-api: CoinGecko API client
181+
0 commit comments