1
1
# Wallet Alert Service
2
2
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.
4
4
5
5
## Features
6
6
@@ -9,31 +9,40 @@ A Go-based microservice that monitors Ethereum wallet activities and sends custo
9
9
- Detects large token transfers (> 1 ETH)
10
10
- Identifies NFT transfers for popular collections (BAYC, Moonbirds)
11
11
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
+
12
18
- ** Customizable User Alerts**
13
19
- Email notifications via SendGrid
14
20
- Configurable alert thresholds
15
21
- Per-wallet notification preferences
16
-
17
- - ** Event Types**
18
- - Large transfers (> 1 ETH)
19
- - NFT transfers
20
- - Custom threshold alerts
22
+ - Price alert preferences
21
23
22
24
## Architecture
23
25
24
26
### Core Components
25
27
26
28
- ** 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
28
33
- ** Data Storage** : GORM-based PostgreSQL integration
29
34
- ** Repository Layer** :
30
35
- [ ` EventRepository ` ] ( repository/event_repository.go ) for event storage
31
36
- [ ` 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
32
40
33
41
### Models
34
42
35
43
- [ ` Event ` ] ( models/event.go ) : Stores transaction details and event types
36
44
- [ ` UserPreference ` ] ( models/models.go ) : Manages user notification preferences
45
+ - [ ` PriceAlert ` ] ( models/models.go ) : Stores cryptocurrency price alert settings
37
46
38
47
## Installation
39
48
@@ -59,6 +68,9 @@ Create a `config.yaml` file in the root directory with the following content:
59
68
url: "postgresql://username:password@localhost:5432/dbname"
60
69
sendgrid:
61
70
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
62
74
63
75
## Usage
64
76
@@ -68,13 +80,23 @@ Create a `config.yaml` file in the root directory with the following content:
68
80
69
81
2. ** Configure user preferences**
70
82
83
+ // Transaction alerts
71
84
userPreference := &models.UserPreference{
72
85
UserID: "user@example.com",
73
86
WalletAddress: "0x...",
74
87
MinEtherValue: "1000000000000000000", // 1 ETH
75
88
TrackNFTs: true,
76
89
EmailNotification: true,
77
90
}
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
+ }
78
100
79
101
## Testing
80
102
@@ -87,6 +109,18 @@ Create a `config.yaml` file in the root directory with the following content:
87
109
go test -v ./services/... // Test notification services
88
110
go test -v ./repository/... // Test repositories
89
111
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
+
90
124
## Key Components
91
125
92
126
** NFT Detection** :
@@ -99,12 +133,21 @@ Create a `config.yaml` file in the root directory with the following content:
99
133
Real-time block monitoring
100
134
Transaction filtering and categorization
101
135
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
102
144
103
145
** Notification System** :
104
146
105
147
Email notifications via SendGrid
106
148
User preference-based filtering
107
149
Customizable notification templates
150
+ Support for both transaction and price alerts
108
151
109
152
## Development
110
153
Project Structure
@@ -133,4 +176,6 @@ Set test environment:
133
176
go-ethereum: Ethereum client
134
177
sendgrid-go: Email notifications
135
178
gorm: Database ORM
136
- viper: Configuration management
179
+ viper: Configuration management
180
+ coingecko-api: CoinGecko API client
181
+
0 commit comments