Skip to content

Commit

Permalink
Transmission delay config for exec plugin (#380)
Browse files Browse the repository at this point in the history
Transmission delay config for exec plugin
  • Loading branch information
asoliman92 authored Dec 18, 2024
1 parent f742191 commit ec2d169
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pluginconfig/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package pluginconfig
import (
"encoding/json"
"errors"
"time"

commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config"
)
Expand Down Expand Up @@ -36,9 +37,23 @@ type ExecuteOffchainConfig struct {

// TokenDataObservers registers different strategies for processing token data.
TokenDataObservers []TokenDataObserverConfig `json:"tokenDataObservers"`

// transmissionDelayMultiplier is used to calculate the transmission delay for each oracle.
TransmissionDelayMultiplier time.Duration `json:"transmissionDelayMultiplier"`
}

func (e *ExecuteOffchainConfig) ApplyDefaultsAndValidate() error {
e.applyDefaults()
return e.Validate()
}

func (e *ExecuteOffchainConfig) applyDefaults() {
if e.TransmissionDelayMultiplier == 0 {
e.TransmissionDelayMultiplier = defaultTransmissionDelayMultiplier
}
}

func (e ExecuteOffchainConfig) Validate() error {
func (e *ExecuteOffchainConfig) Validate() error {
// TODO: this doesn't really make much sense for non-EVM chains.
// Maybe we need to have a field in the config that is not JSON-encoded
// that indicates chain family?
Expand Down Expand Up @@ -77,7 +92,7 @@ func (e ExecuteOffchainConfig) Validate() error {
return nil
}

func (e ExecuteOffchainConfig) IsUSDCEnabled() bool {
func (e *ExecuteOffchainConfig) IsUSDCEnabled() bool {
for _, ob := range e.TokenDataObservers {
if ob.WellFormed() != nil {
continue
Expand Down

0 comments on commit ec2d169

Please sign in to comment.