adaptors

package
v0.68.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: MIT Imports: 9 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) (*oracles.OracleData, error)
}

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

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 oracles.OracleData according to its source.

func New

func New() *Adaptors

New creates an Adaptors with all the supported oracle Adaptor.

func (*Adaptors) Normalise

Normalise normalises the input data into an oracles.OracleData based on its source.

type JSONAdaptor

type JSONAdaptor struct{}

JSONAdaptor is an oracle Adaptor for simple oracle 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) (*oracles.OracleData, error)

Normalise normalises a JSON payload into an oracles.OracleData.

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) (*oracles.OracleData, error)

Normalise normalises an Open Oracle / Open Price Feed payload into an oracles.OracleData. 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