adaptors

package
v0.78.3 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnknownOracleSource = errors.New("unknown oracle source")

ErrUnknownOracleSource is used when the input data is originated from an unknown, unsupported or unspecified oracle source.

Functions

This section is empty.

Types

type Adaptor

type Adaptor interface {
	Normalise(crypto.PublicKey, []byte) (*common.Data, error)
}

Adaptor represents a adaptor that consumes and normalises data from a specific type of source.

type Adaptors

type Adaptors struct {
	// Adaptors holds all the supported Adaptors sorted by source.
	Adaptors map[commandspb.OracleDataSubmission_OracleSource]Adaptor
}

Adaptors normalises the input data into an common.Data according to its source.

func New

func New() *Adaptors

New creates an Adaptors with all the supported oracle Adaptor.

func (*Adaptors) Normalise

func (a *Adaptors) Normalise(txPubKey crypto.PublicKey, data commandspb.OracleDataSubmission) (*common.Data, error)

Normalise normalises the input data into an common.Data based on its source.

type JSONAdaptor

type JSONAdaptor struct{}

JSONAdaptor is a Adaptor for simple data broadcasting. Link: https://compound.finance/docs/prices

func NewJSONAdaptor

func NewJSONAdaptor() *JSONAdaptor

NewJSONAdaptor creates a new JSONAdaptor.

func (*JSONAdaptor) Normalise

func (a *JSONAdaptor) Normalise(txPubKey crypto.PublicKey, data []byte) (*common.Data, error)

Normalise normalises a JSON payload into an common.Data.

type OpenOracleAdaptor

type OpenOracleAdaptor struct{}

OpenOracleAdaptor is a specific oracle Adaptor for Open Oracle / Open Price Feed standard. Link: https://compound.finance/docs/prices

func NewOpenOracleAdaptor

func NewOpenOracleAdaptor() *OpenOracleAdaptor

NewOpenOracleAdaptor creates a new OpenOracleAdaptor.

func (*OpenOracleAdaptor) Normalise

func (a *OpenOracleAdaptor) Normalise(_ crypto.PublicKey, data []byte) (*common.Data, error)

Normalise normalises an Open Oracle / Open Price Feed payload into an signed.Data. The public key from the transaction is not used, only those from the Open Oracle data.

Jump to

Keyboard shortcuts

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