median

package
v0.11.0-dev.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: AGPL-3.0 Imports: 13 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() types.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) ([]types.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 sent.
	Poke(ctx context.Context, prices []*Price, simulateBeforeRun bool) (*types.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 sent.
	Lift(ctx context.Context, addresses []types.Address, simulateBeforeRun bool) (*types.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 sent.
	Drop(ctx context.Context, addresses []types.Address, simulateBeforeRun bool) (*types.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 sent.
	SetBar(ctx context.Context, bar *big.Int, simulateBeforeRun bool) (*types.Hash, error)
}

Median is an interface for the Medianizer 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.
	Sig types.Signature // Sig is the signature of the price.
}

func (*Price) Fields

func (p *Price) Fields(r crypto.Recoverer) log.Fields

func (*Price) Float64Price

func (p *Price) Float64Price() float64

func (*Price) From

func (p *Price) From(r crypto.Recoverer) (*types.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 wallet.Key) error

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