-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement NewPluginProvider (EVM) (#11995)
* Implement NewPluginProvider (generic) * Implement PluginProvider Start/Stop/Name/Ready/HealthReport methods * Fix a lint error * Update common, starknet, solana, cosmos * Update common, starknet, solana, cosmos --------- Co-authored-by: Cedric Cordenier <[email protected]> Co-authored-by: Bolek <[email protected]>
- Loading branch information
1 parent
6ef15c5
commit 28b53e5
Showing
9 changed files
with
146 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package evm | ||
|
||
import ( | ||
"context" | ||
|
||
ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" | ||
|
||
"github.com/smartcontractkit/chainlink-common/pkg/services" | ||
"github.com/smartcontractkit/chainlink-common/pkg/types" | ||
|
||
"github.com/smartcontractkit/chainlink/v2/core/logger" | ||
) | ||
|
||
type pluginProvider struct { | ||
services.Service | ||
chainReader types.ChainReader | ||
codec types.Codec | ||
contractTransmitter ocrtypes.ContractTransmitter | ||
configWatcher *configWatcher | ||
lggr logger.Logger | ||
ms services.MultiStart | ||
} | ||
|
||
var _ types.PluginProvider = (*pluginProvider)(nil) | ||
|
||
func NewPluginProvider( | ||
chainReader types.ChainReader, | ||
codec types.Codec, | ||
contractTransmitter ocrtypes.ContractTransmitter, | ||
configWatcher *configWatcher, | ||
lggr logger.Logger, | ||
) *pluginProvider { | ||
return &pluginProvider{ | ||
chainReader: chainReader, | ||
codec: codec, | ||
contractTransmitter: contractTransmitter, | ||
configWatcher: configWatcher, | ||
lggr: lggr, | ||
ms: services.MultiStart{}, | ||
} | ||
} | ||
|
||
func (p *pluginProvider) Name() string { return p.lggr.Name() } | ||
|
||
func (p *pluginProvider) Ready() error { return nil } | ||
|
||
func (p *pluginProvider) HealthReport() map[string]error { | ||
hp := map[string]error{p.Name(): p.Ready()} | ||
services.CopyHealth(hp, p.configWatcher.HealthReport()) | ||
return hp | ||
} | ||
|
||
func (p *pluginProvider) ContractTransmitter() ocrtypes.ContractTransmitter { | ||
return p.contractTransmitter | ||
} | ||
|
||
func (p *pluginProvider) OffchainConfigDigester() ocrtypes.OffchainConfigDigester { | ||
return p.configWatcher.OffchainConfigDigester() | ||
} | ||
|
||
func (p *pluginProvider) ContractConfigTracker() ocrtypes.ContractConfigTracker { | ||
return p.configWatcher.configPoller | ||
} | ||
|
||
func (p *pluginProvider) ChainReader() types.ChainReader { | ||
return p.chainReader | ||
} | ||
|
||
func (p *pluginProvider) Codec() types.Codec { | ||
return p.codec | ||
} | ||
|
||
func (p *pluginProvider) Start(ctx context.Context) error { | ||
return p.configWatcher.Start(ctx) | ||
} | ||
|
||
func (p *pluginProvider) Close() error { | ||
return p.configWatcher.Close() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters