PythSDK.sol 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: Apache 2
  2. pragma solidity ^0.8.0;
  3. import "../libraries/external/BytesLib.sol";
  4. contract PythSDK {
  5. // Price represents a current aggregation price from pyth publisher feeds.
  6. struct Price {
  7. // The price ID.
  8. bytes32 id;
  9. // Product account key.
  10. bytes32 productId;
  11. // The current price.
  12. int64 price;
  13. // Confidence interval around the price.
  14. uint64 conf;
  15. // Price exponent.
  16. int32 expo;
  17. // Status of price.
  18. PriceStatus status;
  19. // Maximum number of allowed publishers that can contribute to a price.
  20. uint32 maxNumPublishers;
  21. // Number of publishers that made up current aggregate.
  22. uint32 numPublishers;
  23. // Exponentially moving average price.
  24. int64 emaPrice;
  25. // Exponentially moving average confidence interval.
  26. uint64 emaConf;
  27. }
  28. /* PriceStatus represents the availability status of a price feed.
  29. UNKNOWN: The price feed is not currently updating for an unknown reason.
  30. TRADING: The price feed is updating as expected.
  31. HALTED: The price feed is not currently updating because trading in the product has been halted.
  32. AUCTION: The price feed is not currently updating because an auction is setting the price.
  33. */
  34. enum PriceStatus {
  35. UNKNOWN,
  36. TRADING,
  37. HALTED,
  38. AUCTION
  39. }
  40. }