-
Notifications
You must be signed in to change notification settings - Fork 2
/
module.go
52 lines (43 loc) · 1.11 KB
/
module.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
package ibc
import (
"sync"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/rs/zerolog"
grpcClient "github.com/bro-n-bro/spacebox-crawler/client/grpc"
"github.com/bro-n-bro/spacebox-crawler/modules/utils"
tb "github.com/bro-n-bro/spacebox-crawler/pkg/mapper/to_broker"
"github.com/bro-n-bro/spacebox-crawler/types"
)
const (
ModuleName = "ibc"
)
var (
_ types.Module = &Module{}
_ types.RecursiveMessagesHandler = &Module{}
_ types.BlockHandler = &Module{}
)
type (
denomCache struct {
denomHashes map[string]struct{}
mu sync.RWMutex
}
Module struct {
log *zerolog.Logger
client *grpcClient.Client
broker broker
tbM tb.ToBroker
cdc codec.Codec
denomCache *denomCache
}
)
func New(b broker, tbM tb.ToBroker, client *grpcClient.Client, cdc codec.Codec) *Module {
return &Module{
log: utils.NewModuleLogger(ModuleName),
broker: b,
tbM: tbM,
client: client,
cdc: cdc,
denomCache: &denomCache{denomHashes: make(map[string]struct{})},
}
}
func (m *Module) Name() string { return ModuleName }