evm

package
v2.9.1-vrf-20240219 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: MIT Imports: 27 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UPKEEP_FAILURE_REASON_NONE = iota
	UPKEEP_FAILURE_REASON_UPKEEP_CANCELLED
	UPKEEP_FAILURE_REASON_UPKEEP_PAUSED
	UPKEEP_FAILURE_REASON_TARGET_CHECK_REVERTED
	UPKEEP_FAILURE_REASON_UPKEEP_NOT_NEEDED
	UPKEEP_FAILURE_REASON_PERFORM_DATA_EXCEEDS_LIMIT
	UPKEEP_FAILURE_REASON_INSUFFICIENT_BALANCE
)

enum UpkeepFailureReason https://github.com/smartcontractkit/chainlink/blob/d9dee8ea6af26bc82463510cb8786b951fa98585/contracts/src/v0.8/interfaces/AutomationRegistryInterface2_0.sol#L94

View Source
const (
	// DefaultUpkeepExpiration decides how long an upkeep info will be valid for. after it expires, a getUpkeepInfo
	// call will be made to the registry to obtain the most recent upkeep info and refresh this cache.
	DefaultUpkeepExpiration = 10 * time.Minute
	// DefaultCooldownExpiration decides how long a Mercury upkeep will be put in cool down for the first time. within
	// 10 minutes, subsequent failures will result in double amount of cool down period.
	DefaultCooldownExpiration = 5 * time.Second
	// DefaultApiErrExpiration decides a running sum of total errors of an upkeep in this 10 minutes window. it is used
	// to decide how long the cool down period will be.
	DefaultApiErrExpiration = 10 * time.Minute
	// CleanupInterval decides when the expired items in cache will be deleted.
	CleanupInterval = 15 * time.Minute
)

Variables

View Source
var (
	Uint256, _                = abi.NewType("uint256", "", nil)
	Uint256Arr, _             = abi.NewType("uint256[]", "", nil)
	PerformDataMarshalingArgs = []abi.ArgumentMarshaling{
		{Name: "checkBlockNumber", Type: "uint32"},
		{Name: "checkBlockhash", Type: "bytes32"},
		{Name: "performData", Type: "bytes"},
	}
	PerformDataArr, _   = abi.NewType("tuple(uint32,bytes32,bytes)[]", "", PerformDataMarshalingArgs)
	ErrUnexpectedResult = fmt.Errorf("unexpected result struct")
)
View Source
var (
	ErrLogReadFailure                = fmt.Errorf("failure reading logs")
	ErrHeadNotAvailable              = fmt.Errorf("head not available")
	ErrRegistryCallFailure           = fmt.Errorf("registry chain call failure")
	ErrBlockKeyNotParsable           = fmt.Errorf("block identifier not parsable")
	ErrUpkeepKeyNotParsable          = fmt.Errorf("upkeep key not parsable")
	ErrInitializationFailure         = fmt.Errorf("failed to initialize registry")
	ErrContextCancelled              = fmt.Errorf("context was cancelled")
	ErrABINotParsable                = fmt.Errorf("error parsing abi")
	ActiveUpkeepIDBatchSize    int64 = 1000
	FetchUpkeepConfigBatchSize       = 50
)

Functions

func LogProviderFilterName

func LogProviderFilterName(addr common.Address) string

func NewEvmRegistryPackerV2_0

func NewEvmRegistryPackerV2_0(abi abi.ABI) *evmRegistryPackerV2_0

func UpkeepFilterName

func UpkeepFilterName(addr common.Address) string

Types

type BlockKeyHelper

type BlockKeyHelper[T uint32 | int64] struct {
}

func (BlockKeyHelper[T]) MakeBlockKey

func (kh BlockKeyHelper[T]) MakeBlockKey(b T) ocr2keepers.BlockKey

type EVMAutomationEncoder20

type EVMAutomationEncoder20 struct {
	encoding.BasicEncoder
}

func (EVMAutomationEncoder20) DecodeReport

func (enc EVMAutomationEncoder20) DecodeReport(report []byte) ([]ocr2keepers.UpkeepResult, error)

func (EVMAutomationEncoder20) Detail

func (EVMAutomationEncoder20) Eligible

func (enc EVMAutomationEncoder20) Eligible(result ocr2keepers.UpkeepResult) (bool, error)

func (EVMAutomationEncoder20) EncodeReport

func (enc EVMAutomationEncoder20) EncodeReport(toReport []ocr2keepers.UpkeepResult) ([]byte, error)

func (EVMAutomationEncoder20) KeysFromReport

func (enc EVMAutomationEncoder20) KeysFromReport(b []byte) ([]ocr2keepers.UpkeepKey, error)

type EVMAutomationUpkeepResult20

type EVMAutomationUpkeepResult20 struct {
	// Block is the block number used to build an UpkeepKey for this result
	Block uint32
	// ID is the unique identifier for the upkeep
	ID            *big.Int
	Eligible      bool
	FailureReason uint8
	GasUsed       *big.Int
	PerformData   []byte
	FastGasWei    *big.Int
	LinkNative    *big.Int
	// CheckBlockNumber is the block number that the contract indicates the
	// upkeep was checked on
	CheckBlockNumber uint32
	CheckBlockHash   [32]byte
	ExecuteGas       uint32
}

type EvmRegistry

type EvmRegistry struct {
	HeadProvider
	// contains filtered or unexported fields
}

func NewEVMRegistryService

func NewEVMRegistryService(addr common.Address, client legacyevm.Chain, lggr logger.Logger) (*EvmRegistry, error)

func (*EvmRegistry) CheckUpkeep

func (r *EvmRegistry) CheckUpkeep(ctx context.Context, mercuryEnabled bool, keys ...ocr2keepers.UpkeepKey) ([]ocr2keepers.UpkeepResult, error)

func (*EvmRegistry) Close

func (r *EvmRegistry) Close() error

func (*EvmRegistry) GetActiveUpkeepIDs

func (r *EvmRegistry) GetActiveUpkeepIDs(context.Context) ([]ocr2keepers.UpkeepIdentifier, error)

GetActiveUpkeepKeys uses the latest head and map of all active upkeeps to build a slice of upkeep keys.

func (*EvmRegistry) HealthReport

func (r *EvmRegistry) HealthReport() map[string]error

func (*EvmRegistry) Name

func (r *EvmRegistry) Name() string

func (*EvmRegistry) Ready

func (r *EvmRegistry) Ready() error

func (*EvmRegistry) Start

func (r *EvmRegistry) Start(ctx context.Context) error

type HeadProvider

type HeadProvider struct {
	// contains filtered or unexported fields
}

func (*HeadProvider) HeadTicker

func (hw *HeadProvider) HeadTicker() chan ocr2keepers.BlockKey

HeadTicker provides external access to the heads channel

func (*HeadProvider) LatestBlock

func (hw *HeadProvider) LatestBlock() int64

type LatestBlockGetter

type LatestBlockGetter interface {
	LatestBlock() int64
}

type LogProvider

type LogProvider struct {
	// contains filtered or unexported fields
}

func NewLogProvider

func NewLogProvider(
	logger logger.Logger,
	logPoller logpoller.LogPoller,
	registryAddress common.Address,
	client evmclient.Client,
	lookbackBlocks int64,
) (*LogProvider, error)

func (*LogProvider) Close

func (c *LogProvider) Close() error

func (*LogProvider) HealthReport

func (c *LogProvider) HealthReport() map[string]error

func (*LogProvider) Name

func (c *LogProvider) Name() string

func (*LogProvider) PerformLogs

func (c *LogProvider) PerformLogs(ctx context.Context) ([]ocr2keepers.PerformLog, error)

func (*LogProvider) Ready

func (c *LogProvider) Ready() error

func (*LogProvider) StaleReportLogs

func (c *LogProvider) StaleReportLogs(ctx context.Context) ([]ocr2keepers.StaleReportLog, error)

func (*LogProvider) Start

func (c *LogProvider) Start(ctx context.Context) error

type Registry

type Registry interface {
	GetUpkeep(opts *bind.CallOpts, id *big.Int) (keeper_registry_wrapper2_0.UpkeepInfo, error)
	GetState(opts *bind.CallOpts) (keeper_registry_wrapper2_0.GetState, error)
	GetActiveUpkeepIDs(opts *bind.CallOpts, startIndex *big.Int, maxCount *big.Int) ([]*big.Int, error)
	ParseLog(log coreTypes.Log) (generated.AbigenLog, error)
}

type TransmitUnpacker

type TransmitUnpacker interface {
	UnpackTransmitTxInput([]byte) ([]ocr2keepers.UpkeepResult, error)
}

type UpkeepKeyHelper

type UpkeepKeyHelper[T uint32 | int64] struct {
}

func (UpkeepKeyHelper[T]) MakeUpkeepKey

func (kh UpkeepKeyHelper[T]) MakeUpkeepKey(b T, id *big.Int) ocr2keepers.UpkeepKey

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL