Skip to content

Commit

Permalink
add new datasource (#62)
Browse files Browse the repository at this point in the history
* add new ds

* remove comment
  • Loading branch information
augustbleeds authored Apr 22, 2024
1 parent af2f85f commit 13c17a9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21.3
require (
github.com/hashicorp/go-plugin v1.6.0
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240327133125-eed636b9a6df
github.com/smartcontractkit/libocr v0.0.0-20240326191951-2bbe9382d052
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c
github.com/stretchr/testify v1.9.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+
github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI=
github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU=
github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0=
github.com/smartcontractkit/libocr v0.0.0-20240326191951-2bbe9382d052 h1:1WFjrrVrWoQ9UpVMh7Mx4jDpzhmo1h8hFUKd9awIhIU=
github.com/smartcontractkit/libocr v0.0.0-20240326191951-2bbe9382d052/go.mod h1:SJEZCHgMCAzzBvo9vMV2DQ9onfEcIJCYSViyP4JI6c4=
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c h1:lIyMbTaF2H0Q71vkwZHX/Ew4KF2BxiKhqEXwF8rn+KI=
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand Down
12 changes: 10 additions & 2 deletions median/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ func (p *Plugin) NewMedianFactory(ctx context.Context, provider types.MedianProv
lggr := logger.With(p.Logger, ctxVals.Args()...)

factory := median.NumericalMedianFactory{
DataSource: dataSource,
JuelsPerFeeCoinDataSource: juelsPerFeeCoin,
DataSource: dataSource,
JuelsPerFeeCoinDataSource: juelsPerFeeCoin,
GasPriceSubunitsDataSource: &ZeroDataSource{},
IncludeGasPriceSubunitsInObservation: false,
Logger: logger.NewOCRWrapper(lggr, true, func(msg string) {
ctx, cancelFn := p.stop.NewCtx()
defer cancelFn()
Expand Down Expand Up @@ -64,6 +66,12 @@ func (p *Plugin) NewMedianFactory(ctx context.Context, provider types.MedianProv
return s, nil
}

type ZeroDataSource struct{}

func (d *ZeroDataSource) Observe(ctx context.Context, reportTimestamp ocrtypes.ReportTimestamp) (*big.Int, error) {
return new(big.Int), nil
}

type reportingPluginFactoryService struct {
services.StateMachine
lggr logger.Logger
Expand Down

0 comments on commit 13c17a9

Please sign in to comment.