llo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 7 Imported by: 11

Documentation

Index

Constants

View Source
const (

	// NOTE: Only add something here if you actually need it, because it has to
	// be supported forever and can't be changed
	AggregatorMedian = 1
	AggregatorMode   = 2
	// AggregatorQuote is a special aggregator that is used to aggregate
	// a list of Bid/Mid/Ask price tuples
	AggregatorQuote = 3
)

Variables

Functions

This section is empty.

Types

type Aggregator added in v0.2.1

type Aggregator uint32

func AggregatorFromString added in v0.2.1

func AggregatorFromString(s string) (Aggregator, error)

func (Aggregator) MarshalJSON added in v0.2.1

func (a Aggregator) MarshalJSON() ([]byte, error)

func (Aggregator) MarshalText added in v0.2.1

func (a Aggregator) MarshalText() ([]byte, error)

func (Aggregator) String added in v0.2.1

func (a Aggregator) String() string

func (*Aggregator) UnmarshalJSON added in v0.2.1

func (a *Aggregator) UnmarshalJSON(data []byte) error

func (*Aggregator) UnmarshalText added in v0.2.1

func (a *Aggregator) UnmarshalText(text []byte) error

type ChannelDefinition

type ChannelDefinition struct {
	// ReportFormat controls the output format of the report. It might be a
	// different chain target, different report format etc. Custom logic can be
	// implemented for each report format.
	ReportFormat ReportFormat `json:"reportFormat"`
	// Streams is the list of streams to be observed and aggregated
	// by the protocol.
	Streams []Stream `json:"streams"`
	// Opts contains configuration data for use in report generation
	// for this channel, e.g. feed ID, expiry window, USD base fee etc
	//
	// How this is encoded is up to the implementer but should be consistent
	// for a given ReportFormat
	//
	// May be nil
	Opts ChannelOpts `json:"opts"`
}

func (ChannelDefinition) Equals added in v0.2.1

type ChannelDefinitionCache

type ChannelDefinitionCache interface {
	Definitions() ChannelDefinitions
	services.Service
}

type ChannelDefinitions

type ChannelDefinitions map[ChannelID]ChannelDefinition

func (*ChannelDefinitions) Scan added in v0.2.2

func (c *ChannelDefinitions) Scan(value interface{}) error

func (ChannelDefinitions) Value added in v0.2.2

func (c ChannelDefinitions) Value() (driver.Value, error)

type ChannelID

type ChannelID = uint32

It is recommended not to use 0 as a channel ID to avoid confusion with uninitialized values

type ChannelOpts added in v0.2.1

type ChannelOpts []byte

func (ChannelOpts) MarshalJSON added in v0.2.1

func (m ChannelOpts) MarshalJSON() ([]byte, error)

MarshalJSON passes raw json directly through in a canonicalized form.

func (*ChannelOpts) UnmarshalJSON added in v0.2.1

func (m *ChannelOpts) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON allows taking an actual JSON object as ChannelOpts and passes it through in canonicalized form.

type LifeCycleStage

type LifeCycleStage string

type ReportFormat

type ReportFormat uint32

ReportFormat represents different formats for different targets e.g. EVM, Solana, JSON, kalechain etc

const (

	// NOTE: Only add something here if you actually need it, because it has to
	// be supported forever and can't be changed
	ReportFormatEVMPremiumLegacy ReportFormat = 1
	ReportFormatJSON             ReportFormat = 2
)

func ReportFormatFromString

func ReportFormatFromString(s string) (ReportFormat, error)

func (ReportFormat) MarshalJSON added in v0.2.1

func (rf ReportFormat) MarshalJSON() ([]byte, error)

func (ReportFormat) MarshalText added in v0.2.1

func (rf ReportFormat) MarshalText() ([]byte, error)

func (ReportFormat) String

func (rf ReportFormat) String() string

func (*ReportFormat) UnmarshalJSON added in v0.2.1

func (rf *ReportFormat) UnmarshalJSON(data []byte) error

func (*ReportFormat) UnmarshalText added in v0.2.1

func (rf *ReportFormat) UnmarshalText(text []byte) error

type ReportInfo

type ReportInfo struct {
	LifeCycleStage LifeCycleStage
	ReportFormat   ReportFormat
}

type Stream added in v0.2.1

type Stream struct {
	// ID is the ID of the stream to be observed
	StreamID StreamID `json:"streamId"`
	// Aggregator is the method used by consensus protocol to aggregate
	// multiple stream observations e.g. "median", "mode" or other more exotic
	// methods
	Aggregator Aggregator `json:"aggregator"`
}

type StreamID

type StreamID = uint32

Chose uint32 to represent StreamID and ChannelID for the following reasons: - 4 billion is more than enough to cover our conceivable channel/stream requirements - It is the most compatible, supported everywhere, can be serialized into JSON and used in Javascript without problems - It is the smallest reasonable data type that balances between a large set of possible identifiers and not using too much space - If randomly chosen, low chance of off-by-one ids being valid - Is not specific to any chain, e.g. [32]byte is not fully supported on starknet etc - Avoids any possible encoding/copypasta issues e.g. UUIDs which can convert to [32]byte in multiple different ways

It is recommended not to use 0 as a stream ID to avoid confusion with uninitialized values

Jump to

Keyboard shortcuts

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