-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.go
93 lines (79 loc) · 2.56 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package main
import (
"log"
"swap.io-ledger/src/addressSyncer"
"swap.io-ledger/src/auth"
"swap.io-ledger/src/config"
"swap.io-ledger/src/database"
"swap.io-ledger/src/httpHandler"
"swap.io-ledger/src/httpServer"
"swap.io-ledger/src/managers/AddressSyncStatusManager"
"swap.io-ledger/src/managers/CoinsManager"
"swap.io-ledger/src/managers/TxsManager"
"swap.io-ledger/src/managers/UsersAdressesManager"
"swap.io-ledger/src/managers/UsersManager"
"swap.io-ledger/src/managers/UsersSpendsManager"
"swap.io-ledger/src/networks"
"swap.io-ledger/src/registrar"
"swap.io-ledger/src/serviceRegistry"
"swap.io-ledger/src/socketServer"
"swap.io-ledger/src/txsHandler"
)
func main() {
//privateKey, err := crypto.HexToECDSA("fad9c8855b740a0b7ed4c221dbad0f33a83a49cad6b3fe8d5817ac83d38b6a19")
//if err != nil {
// log.Fatal(err)
//}
//log.Println(privateKey)
//data, err := hex.DecodeString("31363338363231323238323731")
//hash := crypto.Keccak256Hash(data)
//
//signature, err := hex.DecodeString("5cfcfaf6a33d99daf66ba54d57506aef92d3bff0f6194b5556b5903207ee833e0fe3716acc43e037a02e2651ecb0ae9537bf52c36d95f12664121ec616031cbd")
//signature = append(signature, 0)
//if err != nil {
// log.Fatal(err)
//}
//
//sigPublicKeyBytes, err := hex.DecodeString("049a7df67f79246283fdc93af76d4f8cdd62c4886e8cd870944e817dd0b97934fdd7719d0810951e03418205868a5c1b40b192451367f28e0088dd75e15de40c05")
//if err != nil {
// log.Fatal(err)
//}
////049a7df67f79246283fdc93af76d4f8cdd62c4886e8cd870944e817dd0b97934fdd7719d0810951e03418205868a5c1b40b192451367f28e0088dd75e15de40c05
//
//fmt.Println(sigPublicKeyBytes)
//fmt.Println(hex.EncodeToString(sigPublicKeyBytes))
//
//log.Println(crypto.VerifySignature(sigPublicKeyBytes, hash.Bytes(), signature[:64]))
//
//fmt.Println()
config.InitializeConfig()
registry := serviceRegistry.NewServiceRegistry()
databaseInstance := database.InitialiseDatabase()
err := registry.RegisterService(
databaseInstance,
)
if err != nil {
log.Panicln(err)
}
TxsManager.Register(registry)
CoinsManager.Register(registry)
UsersManager.Register(registry)
UsersAdressesManager.Register(registry)
UsersSpendsManager.Register(registry)
AddressSyncStatusManager.Register(registry)
txsHandler.Register(registry)
networks.Register(registry)
AddressSyncer.Register(registry)
registrar.Register(registry)
auth.Register(registry)
socketServer.Register(registry)
HttpServer.Register(registry)
err = registry.RegisterService(
httpHandler.InitializeServer(),
)
if err != nil {
log.Panicln(err)
}
registry.StartAll()
<-make(chan struct{})
}