types

package
v2.14.0-beta0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 23 Imported by: 3

Documentation

Index

Constants

View Source
const MaxTopicFields = 3

MaxTopicFields is three because the EVM has a max of four topics, but the first topic is always the event signature.

Variables

View Source
var ErrBadRelayConfig = errors.New("bad relay config")

Functions

func GetMaxSize added in v2.9.0

func GetMaxSize(n int, args abi.Arguments) (int, error)

func SizedBigIntType added in v2.9.0

func SizedBigIntType() reflect.Type

Types

type ABIEncodingType added in v2.9.0

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

func GetAbiEncodingType added in v2.9.0

func GetAbiEncodingType(name string) (*ABIEncodingType, bool)

type ChainCodecConfig added in v2.9.0

type ChainCodecConfig struct {
	TypeABI         string                `json:"typeAbi" toml:"typeABI"`
	ModifierConfigs codec.ModifiersConfig `json:"modifierConfigs,omitempty" toml:"modifierConfigs,omitempty"`
}

type ChainContractReader added in v2.9.0

type ChainContractReader struct {
	ContractABI           string `json:"contractABI" toml:"contractABI"`
	ContractPollingFilter `json:"contractPollingFilter,omitempty" toml:"contractPollingFilter,omitempty"`
	// key is genericName from config
	Configs map[string]*ChainReaderDefinition `json:"configs" toml:"configs"`
}

type ChainReaderConfig added in v2.9.0

type ChainReaderConfig struct {
	// Contracts key is contract name
	Contracts map[string]ChainContractReader `json:"contracts" toml:"contracts"`
}

func ChainReaderConfigFromBytes added in v2.14.0

func ChainReaderConfigFromBytes(bts []byte) (ChainReaderConfig, error)

ChainReaderConfigFromBytes function applies json decoding on provided bytes to return a valid ChainReaderConfig. If other unmarshaling or parsing techniques are required, place it here.

type ChainReaderDefinition added in v2.9.0

type ChainReaderDefinition chainReaderDefinitionFields

func (*ChainReaderDefinition) HasPollingFilter added in v2.14.0

func (d *ChainReaderDefinition) HasPollingFilter() bool

func (*ChainReaderDefinition) MarshalText added in v2.9.0

func (d *ChainReaderDefinition) MarshalText() ([]byte, error)

func (*ChainReaderDefinition) UnmarshalText added in v2.9.0

func (d *ChainReaderDefinition) UnmarshalText(b []byte) error

type ChainWriterConfig added in v2.13.0

type ChainWriterConfig struct {
	Contracts    map[string]*ContractConfig
	SendStrategy txmgrtypes.TxStrategy
	MaxGasPrice  *assets.Wei
}

type ChainWriterDefinition added in v2.13.0

type ChainWriterDefinition struct {
	// chain specific contract method name or event type.
	ChainSpecificName  string                `json:"chainSpecificName"`
	Checker            string                `json:"checker"`
	FromAddress        common.Address        `json:"fromAddress"`
	GasLimit           uint64                `json:"gasLimit"` // TODO(archseer): what if this has to be configured per call?
	InputModifications codec.ModifiersConfig `json:"inputModifications,omitempty"`
}

type CodecConfig added in v2.9.0

type CodecConfig struct {
	// Configs key is the type's name for the codec
	Configs map[string]ChainCodecConfig `json:"configs" toml:"configs"`
}

type CodecEntry added in v2.9.0

type CodecEntry interface {
	Init() error
	Args() abi.Arguments
	EncodingPrefix() []byte
	GetMaxSize(n int) (int, error)
	Modifier() codec.Modifier

	// CheckedType provides a type that can be used to decode into with type-safety around sizes of integers etc.
	CheckedType() reflect.Type

	// ToNative converts a pointer to checked value into a pointer of a type to use with the go-ethereum ABI encoder
	// Note that modification of the returned value will modify the original checked value and vice versa.
	ToNative(checked reflect.Value) (reflect.Value, error)

	// IsNativePointer returns if the type is a pointer to the native type
	IsNativePointer(item reflect.Type) bool
}

func NewCodecEntry added in v2.9.0

func NewCodecEntry(args abi.Arguments, encodingPrefix []byte, mod codec.Modifier) CodecEntry

type ConfigPoller added in v2.3.0

type ConfigPoller interface {
	ocrtypes.ContractConfigTracker

	Start()
	Close() error
	Replay(ctx context.Context, fromBlock int64) error
}

type ContractConfig added in v2.13.0

type ContractConfig struct {
	ContractABI string `json:"contractABI" toml:"contractABI"`
	// key is genericName from config
	Configs map[string]*ChainWriterDefinition `json:"configs" toml:"configs"`
}

type ContractPollingFilter added in v2.14.0

type ContractPollingFilter struct {
	GenericEventNames []string `json:"genericEventNames"`
	PollingFilter     `json:"pollingFilter"`
}

type EventDefinitions added in v2.14.0

type EventDefinitions struct {
	// GenericTopicNames helps QueryingKeys not rely on EVM specific topic names. Key is chain specific name, value is generic name.
	// This helps us translate chain agnostic querying key "transfer-value" to EVM specific "evmTransferEvent-weiAmountTopic".
	GenericTopicNames map[string]string `json:"genericTopicNames,omitempty"`
	// key is a predefined generic name for evm log event data word
	// for e.g. first evm data word(32bytes) of USDC log event is value so the key can be called value
	GenericDataWordNames map[string]uint8 `json:"genericDataWordNames,omitempty"`
	// InputFields allows you to choose which indexed fields are expected from the input
	InputFields []string `json:"inputFields,omitempty"`
	// PollingFilter should be defined on a contract level in ContractPollingFilter,
	// unless event needs to override the contract level filter options.
	// This will create a separate log poller filter for this event.
	*PollingFilter `json:"pollingFilter,omitempty"`
}

type FunctionsProvider added in v2.5.0

type FunctionsProvider interface {
	types.FunctionsProvider
	LogPollerWrapper() LogPollerWrapper
}

TODO(FUN-668): Migrate this fully into types.FunctionsProvider

type LogPollerWrapper added in v2.5.0

type LogPollerWrapper interface {
	services.Service
	LatestEvents(ctx context.Context) ([]OracleRequest, []OracleResponse, error)

	// TODO (FUN-668): Remove from the LOOP interface and only use internally within the EVM relayer
	SubscribeToUpdates(ctx context.Context, name string, subscriber RouteUpdateSubscriber)
}

A LogPoller wrapper that understands router proxy contracts

type OracleRequest added in v2.5.0

type OracleRequest struct {
	RequestId           [32]byte
	RequestingContract  common.Address
	RequestInitiator    common.Address
	SubscriptionId      uint64
	SubscriptionOwner   common.Address
	Data                []byte
	DataVersion         uint16
	Flags               [32]byte
	CallbackGasLimit    uint64
	TxHash              common.Hash
	CoordinatorContract common.Address
	OnchainMetadata     []byte
}

type OracleResponse added in v2.5.0

type OracleResponse struct {
	RequestId [32]byte
}

type PollingFilter added in v2.14.0

type PollingFilter struct {
	Topic2       evmtypes.HashArray `json:"topic2"`       // list of possible values for topic2
	Topic3       evmtypes.HashArray `json:"topic3"`       // list of possible values for topic3
	Topic4       evmtypes.HashArray `json:"topic4"`       // list of possible values for topic4
	Retention    models.Interval    `json:"retention"`    // maximum amount of time to retain logs
	MaxLogsKept  uint64             `json:"maxLogsKept"`  // maximum number of logs to retain ( 0 = unlimited )
	LogsPerBlock uint64             `json:"logsPerBlock"` // rate limit ( maximum # of logs per block, 0 = unlimited )
}

func (*PollingFilter) ToLPFilter added in v2.14.0

func (f *PollingFilter) ToLPFilter(eventSigs evmtypes.HashArray) logpoller.Filter

type ReadType added in v2.9.0

type ReadType int
const (
	Method ReadType = iota
	Event
)

func (ReadType) MarshalText added in v2.9.0

func (r ReadType) MarshalText() ([]byte, error)

func (ReadType) String added in v2.9.0

func (r ReadType) String() string

func (*ReadType) UnmarshalText added in v2.9.0

func (r *ReadType) UnmarshalText(text []byte) error

type RelayConfig

type RelayConfig struct {
	ChainID                *big.Big           `json:"chainID"`
	FromBlock              uint64             `json:"fromBlock"`
	EffectiveTransmitterID null.String        `json:"effectiveTransmitterID"`
	ConfigContractAddress  *common.Address    `json:"configContractAddress"`
	ChainReader            *ChainReaderConfig `json:"chainReader"`
	Codec                  *CodecConfig       `json:"codec"`

	DefaultTransactionQueueDepth uint32 `json:"defaultTransactionQueueDepth"`
	SimulateTransactions         bool   `json:"simulateTransactions"`

	// Contract-specific
	SendingKeys pq.StringArray `json:"sendingKeys"`

	// Mercury-specific
	FeedID                  *common.Hash `json:"feedID"`
	EnableTriggerCapability bool         `json:"enableTriggerCapability"`
}

type RelayOpts added in v2.5.0

type RelayOpts struct {
	// TODO BCF-2508 -- should anyone ever get the raw config bytes that are embedded in args? if not,
	// make this private and wrap the arg fields with funcs on RelayOpts
	types.RelayArgs
	// contains filtered or unexported fields
}

func NewRelayOpts added in v2.5.0

func NewRelayOpts(args types.RelayArgs) *RelayOpts

func (*RelayOpts) RelayConfig added in v2.5.0

func (o *RelayOpts) RelayConfig() (RelayConfig, error)

type RouteUpdateSubscriber added in v2.5.0

type RouteUpdateSubscriber interface {
	UpdateRoutes(ctx context.Context, activeCoordinator common.Address, proposedCoordinator common.Address) error
}

type SizedBigInt added in v2.9.0

type SizedBigInt interface {
	Verify() error
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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