Documentation ¶
Index ¶
- Constants
- Variables
- type Median
- 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 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 feeds 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 feeds 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) 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.