PythStructs.sol 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // contracts/Structs.sol
  2. // SPDX-License-Identifier: Apache 2
  3. pragma solidity ^0.8.0;
  4. import "../libraries/external/BytesLib.sol";
  5. import "./PythSDK.sol";
  6. contract PythStructs {
  7. using BytesLib for bytes;
  8. struct BatchPriceAttestation {
  9. Header header;
  10. uint16 nAttestations;
  11. uint16 attestationSize;
  12. PriceAttestation[] attestations;
  13. }
  14. struct Header {
  15. uint32 magic;
  16. uint16 version;
  17. uint8 payloadId;
  18. }
  19. struct PriceAttestation {
  20. Header header;
  21. bytes32 productId;
  22. bytes32 priceId;
  23. uint8 priceType;
  24. int64 price;
  25. int32 exponent;
  26. Rational emaPrice;
  27. Rational emaConf;
  28. uint64 confidenceInterval;
  29. uint8 status;
  30. uint8 corpAct;
  31. uint64 timestamp;
  32. }
  33. struct Rational {
  34. int64 value;
  35. int64 numerator;
  36. int64 denominator;
  37. }
  38. struct UpgradeContract {
  39. bytes32 module;
  40. uint8 action;
  41. uint16 chain;
  42. address newContract;
  43. }
  44. struct PriceInfo {
  45. PythSDK.PriceFeed priceFeed;
  46. uint256 attestationTime;
  47. uint256 arrivalTime;
  48. uint256 arrivalBlock;
  49. }
  50. struct PriceFeedResponse {
  51. PythSDK.PriceFeed priceFeed;
  52. }
  53. }