median

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 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 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) Hash added in v0.11.0

func (p *Price) Hash() types.Hash

Hash is an equivalent of keccak256(abi.encodePacked(val_, age_, wat))) in Solidity.

func (*Price) MarshalJSON

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

func (*Price) SetFloat64Price

func (p *Price) SetFloat64Price(price float64)

func (*Price) SetHexPrice added in v0.11.0

func (p *Price) SetHexPrice(price string) error

func (*Price) Sign

func (p *Price) Sign(signer wallet.Key) error

func (*Price) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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