Class ZephyrPricingRecord

java.lang.Object
zephyr.daemon.model.ZephyrPricingRecord

public class ZephyrPricingRecord extends Object
The oracle prices a Zephyr block was built with, as the daemon serializes them in the block header's pricing_record. The values are in the daemon's fixed-point units (10^12 per unit, like amounts). Per field: spot and moving average are the price of ZPH in USD; stable and reserve are the rates of the stable asset ZSD and the reserve asset ZRS (each with its moving average); reserve ratio and its moving average are the reserve ratio; yield price is the price of the yield asset; the timestamp is the oracle's timestamp; the signature is the oracle's signature. ZephyrReserveInfo is the wallet-side view; this is the per-block record.
  • Constructor Details

    • ZephyrPricingRecord

      public ZephyrPricingRecord()
      Constructs an empty pricing record.
    • ZephyrPricingRecord

      public ZephyrPricingRecord(ZephyrPricingRecord record)
      Constructs a copy of the given pricing record.
      Parameters:
      record - is the record to copy
  • Method Details

    • copy

      public ZephyrPricingRecord copy()
      Returns a copy of this pricing record.
      Returns:
      the copy
    • getSpot

      public BigInteger getSpot()
      Returns the spot price of ZPH in USD.
      Returns:
      the spot price of ZPH in USD
    • setSpot

      public ZephyrPricingRecord setSpot(BigInteger spot)
      Sets the spot price of ZPH in USD.
      Parameters:
      spot - is the spot price of ZPH in USD to set
      Returns:
      a reference to this record for chaining
    • getMovingAverage

      public BigInteger getMovingAverage()
      Returns the moving average of the ZPH price in USD.
      Returns:
      the moving average of the ZPH price in USD
    • setMovingAverage

      public ZephyrPricingRecord setMovingAverage(BigInteger movingAverage)
      Sets the moving average of the ZPH price in USD.
      Parameters:
      movingAverage - is the moving average of the ZPH price in USD to set
      Returns:
      a reference to this record for chaining
    • getStable

      public BigInteger getStable()
      Returns the rate of the stable asset ZSD.
      Returns:
      the rate of the stable asset ZSD
    • setStable

      public ZephyrPricingRecord setStable(BigInteger stable)
      Sets the rate of the stable asset ZSD.
      Parameters:
      stable - is the rate of the stable asset ZSD to set
      Returns:
      a reference to this record for chaining
    • getStableMa

      public BigInteger getStableMa()
      Returns the moving average of the rate of the stable asset ZSD.
      Returns:
      the moving average of the rate of the stable asset ZSD
    • setStableMa

      public ZephyrPricingRecord setStableMa(BigInteger stableMa)
      Sets the moving average of the rate of the stable asset ZSD.
      Parameters:
      stableMa - is the moving average of the rate of the stable asset ZSD to set
      Returns:
      a reference to this record for chaining
    • getReserve

      public BigInteger getReserve()
      Returns the rate of the reserve asset ZRS.
      Returns:
      the rate of the reserve asset ZRS
    • setReserve

      public ZephyrPricingRecord setReserve(BigInteger reserve)
      Sets the rate of the reserve asset ZRS.
      Parameters:
      reserve - is the rate of the reserve asset ZRS to set
      Returns:
      a reference to this record for chaining
    • getReserveMa

      public BigInteger getReserveMa()
      Returns the moving average of the rate of the reserve asset ZRS.
      Returns:
      the moving average of the rate of the reserve asset ZRS
    • setReserveMa

      public ZephyrPricingRecord setReserveMa(BigInteger reserveMa)
      Sets the moving average of the rate of the reserve asset ZRS.
      Parameters:
      reserveMa - is the moving average of the rate of the reserve asset ZRS to set
      Returns:
      a reference to this record for chaining
    • getReserveRatio

      public BigInteger getReserveRatio()
      Returns the reserve ratio.
      Returns:
      the reserve ratio
    • setReserveRatio

      public ZephyrPricingRecord setReserveRatio(BigInteger reserveRatio)
      Sets the reserve ratio.
      Parameters:
      reserveRatio - is the reserve ratio to set
      Returns:
      a reference to this record for chaining
    • getReserveRatioMa

      public BigInteger getReserveRatioMa()
      Returns the moving average of the reserve ratio.
      Returns:
      the moving average of the reserve ratio
    • setReserveRatioMa

      public ZephyrPricingRecord setReserveRatioMa(BigInteger reserveRatioMa)
      Sets the moving average of the reserve ratio.
      Parameters:
      reserveRatioMa - is the moving average of the reserve ratio to set
      Returns:
      a reference to this record for chaining
    • getYieldPrice

      public BigInteger getYieldPrice()
      Returns the price of the yield asset ZYS.
      Returns:
      the price of the yield asset ZYS
    • setYieldPrice

      public ZephyrPricingRecord setYieldPrice(BigInteger yieldPrice)
      Sets the price of the yield asset ZYS.
      Parameters:
      yieldPrice - is the price of the yield asset ZYS to set
      Returns:
      a reference to this record for chaining
    • getTimestamp

      public BigInteger getTimestamp()
      Returns the timestamp of the oracle record.
      Returns:
      the timestamp of the oracle record
    • setTimestamp

      public ZephyrPricingRecord setTimestamp(BigInteger timestamp)
      Sets the timestamp of the oracle record.
      Parameters:
      timestamp - is the timestamp of the oracle record to set
      Returns:
      a reference to this record for chaining
    • getSignature

      public String getSignature()
      Returns the oracle's signature of the record, as the daemon serializes it.
      Returns:
      the oracle's signature of the record, as the daemon serializes it
    • setSignature

      public ZephyrPricingRecord setSignature(String signature)
      Sets the oracle's signature of the record, as the daemon serializes it.
      Parameters:
      signature - is the oracle's signature of the record, as the daemon serializes it to set
      Returns:
      a reference to this record for chaining
    • merge

      Merges another record of the same block into this one: a field set in only one of them is taken, a field set in both must be equal.
      Parameters:
      record - is the record to merge into this one
      Returns:
      this record, merged
      Throws:
      ZephyrError - if a field is set in both records with different values
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(int indent)
      Returns one line per field.
      Parameters:
      indent - indents the lines
      Returns:
      the human-readable string
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object