Documentation ¶
Index ¶
- Constants
- Variables
- type Price
- func (p *Price) Fields(r crypto.Recoverer) log.Fields
- func (p *Price) Float64Price() float64
- func (p *Price) From(r crypto.Recoverer) (*types.Address, error)
- func (p *Price) Hash() types.Hash
- func (p *Price) MarshalJSON() ([]byte, error)
- func (p *Price) SetFloat64Price(price float64)
- func (p *Price) SetHexPrice(price string) error
- func (p *Price) Sign(signer wallet.Key) error
- func (p *Price) UnmarshalJSON(bytes []byte) error
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) Float64Price ¶
func (*Price) Hash ¶ added in v0.11.0
Hash is an equivalent of keccak256(abi.encodePacked(val_, age_, wat))) in Solidity.
func (*Price) MarshalJSON ¶
func (*Price) SetFloat64Price ¶
func (*Price) SetHexPrice ¶ added in v0.11.0
func (*Price) UnmarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.