/
main.go
42 lines (33 loc) · 889 Bytes
/
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
package main
import (
"os"
"github.com/smartcontractkit/chainlink/core/logger"
"go.uber.org/zap/zapcore"
)
func init() {
logger.SetLogger(logger.CreateProductionLogger("", false, zapcore.DebugLevel, false))
}
func main() {
logger.Info("Starting the IRITA adapter")
chainID := os.Getenv("ILA_CHAIN_ID")
endpointRPC := os.Getenv("ILA_ENDPOINT_RPC")
endpointGRPC := os.Getenv("ILA_ENDPOINT_GRPC")
mnemonic := os.Getenv("ILA_KEY_MNEMONIC")
listenAddr := os.Getenv("ILA_LISTEN_ADDR")
endpoint := Endpoint{
ChainID: chainID,
RPC: endpointRPC,
GRPC: endpointGRPC,
}
keyParams := KeyParams{
Mnemonic: mnemonic,
Name: DefaultKeyName,
Password: DefaultKeyPass,
}
adapter, err := NewIritaAdapter(endpoint, keyParams)
if err != nil {
logger.Errorf("Failed to create the IRITA adapter: %s", err)
return
}
RunWebServer(listenAddr, adapter.handle)
}