forked from forbole/callisto
/
module.go
44 lines (36 loc) · 1011 Bytes
/
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
package pricefeed
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/forbole/juno/v2/types/config"
"github.com/forbole/bdjuno/v2/database"
"github.com/forbole/juno/v2/modules"
)
var (
_ modules.Module = &Module{}
_ modules.AdditionalOperationsModule = &Module{}
_ modules.PeriodicOperationsModule = &Module{}
)
// Module represents the module that allows to get the token prices
type Module struct {
cfg *Config
cdc codec.Marshaler
db *database.Db
historyModule HistoryModule
}
// NewModule returns a new Module instance
func NewModule(cfg config.Config, historyModule HistoryModule, cdc codec.Marshaler, db *database.Db) *Module {
pricefeedCfg, err := ParseConfig(cfg.GetBytes())
if err != nil {
panic(err)
}
return &Module{
cfg: pricefeedCfg,
cdc: cdc,
db: db,
historyModule: historyModule,
}
}
// Name implements modules.Module
func (m *Module) Name() string {
return "pricefeed"
}