File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ type Config struct {
1010 DatabaseURL string
1111 SendGridAPIKey string
1212 InfuraProjectID string
13+ CoinGeckoAPIKey string
1314}
1415
1516func LoadConfig () (* Config , error ) {
Original file line number Diff line number Diff line change 77 "log"
88 "math/big"
99 "os"
10+ "time"
1011
1112 "github.com/Jetlum/WalletAlertService/config"
1213 "github.com/Jetlum/WalletAlertService/database"
@@ -60,6 +61,19 @@ func main() {
6061 emailNotification := services .NewEmailNotification (cfg .SendGridAPIKey )
6162 nftDetector := nfts .NewNFTDetector ()
6263
64+ // Initialize price monitoring services
65+ priceMonitor := services .NewPriceMonitor (cfg .CoinGeckoAPIKey )
66+ priceAlertRepo := repository .NewPriceAlertRepository (database .DB )
67+ priceAlertService := services .NewPriceAlertService (
68+ priceMonitor ,
69+ priceAlertRepo ,
70+ emailNotification ,
71+ )
72+
73+ // Start monitoring
74+ priceMonitor .StartMonitoring (1 * time .Minute )
75+ priceAlertService .StartMonitoring ()
76+
6377 // Connect to Ethereum node
6478 client , err := ethclient .Dial (fmt .Sprintf ("wss://mainnet.infura.io/ws/v3/%s" , cfg .InfuraProjectID ))
6579 if err != nil {
You can’t perform that action at this time.
0 commit comments