evm

package
v2.3.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 41 Imported by: 0

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
	UPKEEP_FAILURE_REASON_MERCURY_CALLBACK_REVERTED
	UPKEEP_FAILURE_REASON_REVERT_DATA_EXCEEDS_LIMIT
	UPKEEP_FAILURE_REASON_REGISTRY_PAUSED

	// Start of offchain failure types. All onchain failure reasons from
	// contract should be put above
	UPKEEP_FAILURE_REASON_MERCURY_ACCESS_NOT_ALLOWED
)

enum UpkeepFailureReason is defined by https://github.com/smartcontractkit/chainlink/blob/develop/contracts/src/v0.8/dev/automation/2_1/interfaces/AutomationRegistryInterface2_1.sol#L97 make sure failure reasons are in sync between contract and offchain enum

View Source
const (
	BlockNumber        = "blockNumber" // valid for v0.2
	FeedID             = "feedID"      // valid for v0.3
	FeedIDHex          = "feedIDHex"   // valid for v0.2
	MercuryPathV2      = "/client?"
	MercuryPathV3      = "/v1/reports?"
	MercuryBatchPathV3 = "/v1/reports/bulk?"
	RetryDelay         = 500 * time.Millisecond
	Timestamp          = "timestamp" // valid for v0.3
	TotalAttempt       = 3
	UserId             = "userId"
	MercuryV02         = MercuryVersion("v0.2")
	MercuryV03         = MercuryVersion("v0.3")
)
View Source
const (
	// DefaultAllowListExpiration decides how long an upkeep's allow list info will be valid for.
	DefaultAllowListExpiration = 20 * time.Minute
	// CleanupInterval decides when the expired items in cache will be deleted.
	CleanupInterval = 25 * time.Minute
)

Variables

View Source
var (
	Uint256               = mustNewType("uint256", "", nil)
	Uint256Arr            = mustNewType("uint256[]", "", nil)
	BytesArr              = mustNewType("bytes[]", "", nil)
	TriggerMarshalingArgs = []abi.ArgumentMarshaling{
		{Name: "blockNumber", Type: "uint32"},
		{Name: "blockHash", Type: "bytes32"},
	}
	TriggerArr          = mustNewType("tuple(uint32,bytes32)[]", "", TriggerMarshalingArgs)
	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       = 10
)

Functions

func LogProviderFilterName

func LogProviderFilterName(addr common.Address) string

func NewEvmRegistryPackerV2_1

func NewEvmRegistryPackerV2_1(abi abi.ABI) *evmRegistryPackerV2_1

func UpkeepFilterName

func UpkeepFilterName(addr common.Address) string

Types

type AdminOffchainConfig

type AdminOffchainConfig struct {
	MercuryEnabled bool `json:"mercuryEnabled"`
}

AdminOffchainConfig represents the administrative offchain config for each upkeep. It can be set by s_upkeepManager role on the registry. Upkeeps allowed to use Mercury server will have this set to true.

type BlockKeyHelper

type BlockKeyHelper[T uint32 | int64] struct {
}

func (BlockKeyHelper[T]) MakeBlockKey

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

type EVMAutomationEncoder21

type EVMAutomationEncoder21 struct {
	encoding.BasicEncoder
}

func (EVMAutomationEncoder21) DecodeReport

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

func (EVMAutomationEncoder21) Detail

func (EVMAutomationEncoder21) Eligible

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

func (EVMAutomationEncoder21) EncodeReport

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

func (EVMAutomationEncoder21) KeysFromReport

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

type EVMAutomationUpkeepResult21

type EVMAutomationUpkeepResult21 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
	Retryable        bool
}

type EvmRegistry

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

func NewEVMRegistryService

func NewEVMRegistryService(addr common.Address, client evm.Chain, mc *models.MercuryCredentials, lggr logger.Logger) (*EvmRegistry, error)

func (*EvmRegistry) CheckUpkeep

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

TODO: should be called with ocr2keepers.UpkeepPayload

func (*EvmRegistry) Close

func (r *EvmRegistry) Close() error

func (*EvmRegistry) GetActiveUpkeepIDs

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

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

func (*EvmRegistry) GetActiveUpkeepIDsByType

func (r *EvmRegistry) GetActiveUpkeepIDsByType(ctx context.Context, triggers ...uint8) ([]ocr2keepers.UpkeepIdentifier, error)

GetActiveUpkeepIDsByType returns all active upkeeps of the given trigger types.

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 FeedLookup

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

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 HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

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 MercuryBytes

type MercuryBytes struct {
	Index     int
	Error     error
	Retryable bool
	Bytes     []byte
}

type MercuryConfig

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

type MercuryResponse

type MercuryResponse struct {
	ChainlinkBlob string `json:"chainlinkBlob"`
}

MercuryResponse is used in both single feed endpoint and bulk endpoint because bulk endpoint will return ONE chainlinkBlob which contains multiple reports instead of multiple blobs.

type MercuryVersion

type MercuryVersion string

type Registry

type Registry interface {
	GetUpkeep(opts *bind.CallOpts, id *big.Int) (UpkeepInfo, error)
	GetState(opts *bind.CallOpts) (iregistry21.GetState, error)
	GetActiveUpkeepIDs(opts *bind.CallOpts, startIndex *big.Int, maxCount *big.Int) ([]*big.Int, error)
	GetActiveUpkeepIDsByType(opts *bind.CallOpts, startIndex *big.Int, endIndex *big.Int, trigger uint8) ([]*big.Int, error)
	GetUpkeepPrivilegeConfig(opts *bind.CallOpts, upkeepId *big.Int) ([]byte, error)
	GetUpkeepTriggerConfig(opts *bind.CallOpts, upkeepId *big.Int) ([]byte, error)
	CheckCallback(opts *bind.TransactOpts, id *big.Int, values [][]byte, extraData []byte) (*coreTypes.Transaction, 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