PythDeprecatedStructs.sol 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // contracts/PythDeprecatedStructs.sol
  2. // SPDX-License-Identifier: Apache 2
  3. pragma solidity ^0.8.0;
  4. // This contract contains self contained structs of all our deprecated structs.
  5. // When deprecating the structs, make sure that there be no dependency to
  6. // the sdk as the sdk might change.
  7. //
  8. // By storing these structs, we keep deprecated fields definitions correctly. Then,
  9. // in the future, we can use them to cleanup their storage and redeem some gas back.
  10. contract PythDeprecatedStructs {
  11. // Structs related to the _deprecatedLatestPriceInfoV1
  12. enum DeprecatedPriceStatusV1 {
  13. UNKNOWN,
  14. TRADING,
  15. HALTED,
  16. AUCTION
  17. }
  18. struct DeprecatedPriceFeedV1 {
  19. // The price ID.
  20. bytes32 id;
  21. // Product account key.
  22. bytes32 productId;
  23. // The current price.
  24. int64 price;
  25. // Confidence interval around the price.
  26. uint64 conf;
  27. // Price exponent.
  28. int32 expo;
  29. // Status of price.
  30. DeprecatedPriceStatusV1 status;
  31. // Maximum number of allowed publishers that can contribute to a price.
  32. uint32 maxNumPublishers;
  33. // Number of publishers that made up current aggregate.
  34. uint32 numPublishers;
  35. // Exponentially moving average price.
  36. int64 emaPrice;
  37. // Exponentially moving average confidence interval.
  38. uint64 emaConf;
  39. // Unix timestamp describing when the price was published
  40. uint64 publishTime;
  41. // Price of previous price with TRADING status
  42. int64 prevPrice;
  43. // Confidence interval of previous price with TRADING status
  44. uint64 prevConf;
  45. // Unix timestamp describing when the previous price with TRADING status was published
  46. uint64 prevPublishTime;
  47. }
  48. struct DeprecatedPriceInfoV1 {
  49. uint256 attestationTime;
  50. uint256 arrivalTime;
  51. uint256 arrivalBlock;
  52. DeprecatedPriceFeedV1 priceFeed;
  53. }
  54. // Structs related to the _deprecatedLatestPriceInfoV2
  55. struct DeprecatedPriceV2 {
  56. // Price
  57. int64 price;
  58. // Confidence interval around the price
  59. uint64 conf;
  60. // Price exponent
  61. int32 expo;
  62. // Unix timestamp describing when the price was published
  63. uint publishTime;
  64. }
  65. // PriceFeed represents a current aggregate price from pyth publisher feeds.
  66. struct DeprecatedPriceFeedV2 {
  67. // The price ID.
  68. bytes32 id;
  69. // Latest available price
  70. DeprecatedPriceV2 price;
  71. // Latest available exponentially-weighted moving average price
  72. DeprecatedPriceV2 emaPrice;
  73. }
  74. struct DeprecatedPriceInfoV2 {
  75. uint256 attestationTime;
  76. uint256 arrivalTime;
  77. uint256 arrivalBlock;
  78. DeprecatedPriceFeedV2 priceFeed;
  79. }
  80. }