Package zephyr.daemon.model
Class ZephyrPricingRecord
java.lang.Object
zephyr.daemon.model.ZephyrPricingRecord
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 Summary
ConstructorsConstructorDescriptionConstructs an empty pricing record.Constructs a copy of the given pricing record. -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a copy of this pricing record.booleanReturns the moving average of the ZPH price in USD.Returns the rate of the reserve asset ZRS.Returns the moving average of the rate of the reserve asset ZRS.Returns the reserve ratio.Returns the moving average of the reserve ratio.Returns the oracle's signature of the record, as the daemon serializes it.getSpot()Returns the spot price of ZPH in USD.Returns the rate of the stable asset ZSD.Returns the moving average of the rate of the stable asset ZSD.Returns the timestamp of the oracle record.Returns the price of the yield asset ZYS.inthashCode()merge(ZephyrPricingRecord record) 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.setMovingAverage(BigInteger movingAverage) Sets the moving average of the ZPH price in USD.setReserve(BigInteger reserve) Sets the rate of the reserve asset ZRS.setReserveMa(BigInteger reserveMa) Sets the moving average of the rate of the reserve asset ZRS.setReserveRatio(BigInteger reserveRatio) Sets the reserve ratio.setReserveRatioMa(BigInteger reserveRatioMa) Sets the moving average of the reserve ratio.setSignature(String signature) Sets the oracle's signature of the record, as the daemon serializes it.setSpot(BigInteger spot) Sets the spot price of ZPH in USD.setStable(BigInteger stable) Sets the rate of the stable asset ZSD.setStableMa(BigInteger stableMa) Sets the moving average of the rate of the stable asset ZSD.setTimestamp(BigInteger timestamp) Sets the timestamp of the oracle record.setYieldPrice(BigInteger yieldPrice) Sets the price of the yield asset ZYS.toString()toString(int indent) Returns one line per field.
-
Constructor Details
-
ZephyrPricingRecord
public ZephyrPricingRecord()Constructs an empty pricing record. -
ZephyrPricingRecord
Constructs a copy of the given pricing record.- Parameters:
record- is the record to copy
-
-
Method Details
-
copy
Returns a copy of this pricing record.- Returns:
- the copy
-
getSpot
Returns the spot price of ZPH in USD.- Returns:
- the spot price of ZPH in USD
-
setSpot
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
Returns the moving average of the ZPH price in USD.- Returns:
- the moving average of the ZPH price in USD
-
setMovingAverage
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
Returns the rate of the stable asset ZSD.- Returns:
- the rate of the stable asset ZSD
-
setStable
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
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
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
Returns the rate of the reserve asset ZRS.- Returns:
- the rate of the reserve asset ZRS
-
setReserve
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
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
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
Returns the reserve ratio.- Returns:
- the reserve ratio
-
setReserveRatio
Sets the reserve ratio.- Parameters:
reserveRatio- is the reserve ratio to set- Returns:
- a reference to this record for chaining
-
getReserveRatioMa
Returns the moving average of the reserve ratio.- Returns:
- the moving average of the reserve ratio
-
setReserveRatioMa
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
Returns the price of the yield asset ZYS.- Returns:
- the price of the yield asset ZYS
-
setYieldPrice
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
Returns the timestamp of the oracle record.- Returns:
- the timestamp of the oracle record
-
setTimestamp
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
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
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
-
toString
Returns one line per field.- Parameters:
indent- indents the lines- Returns:
- the human-readable string
-
hashCode
public int hashCode() -
equals
-