-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
factory.go
35 lines (28 loc) · 893 Bytes
/
factory.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
package promwrapper
import (
"math/big"
"github.com/smartcontractkit/libocr/offchainreporting2plus/types"
)
var _ types.ReportingPluginFactory = &promFactory{}
type promFactory struct {
wrapped types.ReportingPluginFactory
name string
chainType string
chainID *big.Int
}
func (p *promFactory) NewReportingPlugin(config types.ReportingPluginConfig) (types.ReportingPlugin, types.ReportingPluginInfo, error) {
plugin, info, err := p.wrapped.NewReportingPlugin(config)
if err != nil {
return nil, types.ReportingPluginInfo{}, err
}
prom := New(plugin, p.name, p.chainType, p.chainID, config, nil)
return prom, info, nil
}
func NewPromFactory(wrapped types.ReportingPluginFactory, name, chainType string, chainID *big.Int) types.ReportingPluginFactory {
return &promFactory{
wrapped: wrapped,
name: name,
chainType: chainType,
chainID: chainID,
}
}