oracle

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const PriceMultiplier = 1e18

Variables

View Source
var ErrPriceNotSet = errors.New("unable to sign a price because the price is not set")
View Source
var ErrUnmarshallingFailure = errors.New("unable to unmarshal given JSON")

Functions

This section is empty.

Types

type Median

type Median interface {
	// Address returns medianizer contract address.
	Address() common.Address
	// Age returns the value from contract's age method. The age is the block
	// timestamp of last price val update.
	Age(ctx context.Context) (time.Time, error)
	// Bar returns the value from contract's bar method. The bar method returns
	// the minimum number of prices necessary to accept a new median value.
	Bar(ctx context.Context) (int64, error)
	// Val returns current asset price form the contract's storage.
	Val(ctx context.Context) (*big.Int, error)
	// Wat returns asset name.
	Wat(ctx context.Context) (string, error)
	// Feeds returns a list of all Ethereum addresses that are authorized to update
	// Oracle prices (orcls).
	Feeds(ctx context.Context) ([]ethereum.Address, error)
	// Poke sends transaction to the smart contract which invokes contract's
	// poke method, which updates asset price (val).  If simulateBeforeRun is
	// set to true, then transaction will be simulated on the EVM before actual
	// transaction will be send.
	Poke(ctx context.Context, prices []*Price, simulateBeforeRun bool) (*ethereum.Hash, error)
	// Lift sends transaction to the smart contract which invokes contract's
	// lift method, which sends  adds given addresses to the feeders list (orcls).
	// If simulateBeforeRun is set to true, then transaction will be simulated
	// on the EVM before actual transaction will be send.
	Lift(ctx context.Context, addresses []common.Address, simulateBeforeRun bool) (*ethereum.Hash, error)
	// Drop sends transaction to the smart contract which invokes contract's
	// drop method, which removes given addresses from the feeders list (orcls).
	// If simulateBeforeRun is set to true, then transaction will be simulated
	// on the EVM before actual transaction will be send.
	Drop(ctx context.Context, addresses []common.Address, simulateBeforeRun bool) (*ethereum.Hash, error)
	// SetBar sends transaction to the smart contract which invokes contract's
	// setBar method, which sets bar variable (quorum).  If simulateBeforeRun is
	// set to true, then transaction will be simulated on the EVM before actual
	// transaction will be send.
	SetBar(ctx context.Context, bar *big.Int, simulateBeforeRun bool) (*ethereum.Hash, error)
}

Median is an interface for the median oracle contract: https://github.com/makerdao/median/

Contract documentation: https://docs.makerdao.com/smart-contract-modules/oracle-module/median-detailed-documentation

type Price

type Price struct {
	Wat string    // Wat is the asset name.
	Val *big.Int  // Val is the asset price multiplied by PriceMultiplier.
	Age time.Time // Age is the time when the price was obtained.

	// Signature:
	V byte
	R [32]byte
	S [32]byte

	// StarkWare signature:
	StarkR  []byte
	StarkS  []byte
	StarkPK []byte
}

func (*Price) Fields

func (p *Price) Fields(signer ethereum.Signer) log.Fields

func (*Price) Float64Price

func (p *Price) Float64Price() float64

func (*Price) From

func (p *Price) From(signer ethereum.Signer) (*ethereum.Address, error)

func (*Price) MarshalJSON

func (p *Price) MarshalJSON() ([]byte, error)

func (*Price) SetFloat64Price

func (p *Price) SetFloat64Price(price float64)

func (*Price) Sign

func (p *Price) Sign(signer ethereum.Signer) error

func (*Price) Signature

func (p *Price) Signature() ethereum.Signature

func (*Price) UnmarshalJSON

func (p *Price) UnmarshalJSON(bytes []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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