@@ -519,7 +519,7 @@ library PythLazerLib {
519519 );
520520 }
521521
522- // Requested (applicability) helpers — property included in this update
522+ // Requested helpers — property included in this update
523523 function isPriceRequested (
524524 PythLazerStructs.Feed memory feed
525525 ) public pure returns (bool ) {
@@ -613,73 +613,127 @@ library PythLazerLib {
613613 function getPrice (
614614 PythLazerStructs.Feed memory feed
615615 ) public pure returns (int64 ) {
616- require (hasPrice (feed), "Price does not exist " );
616+ require (
617+ isPriceRequested (feed),
618+ "Price is not requested for the timestamp "
619+ );
620+ require (hasPrice (feed), "Price is not present for the timestamp " );
617621 return feed._price;
618622 }
619623
620624 /// @notice Get best bid price (reverts if not exists)
621625 function getBestBidPrice (
622626 PythLazerStructs.Feed memory feed
623627 ) public pure returns (int64 ) {
624- require (hasBestBidPrice (feed), "Best bid price does not exist " );
628+ require (
629+ isBestBidPriceRequested (feed),
630+ "Best bid price is not requested for the timestamp "
631+ );
632+ require (
633+ hasBestBidPrice (feed),
634+ "Best bid price is not present for the timestamp "
635+ );
625636 return feed._bestBidPrice;
626637 }
627638
628639 /// @notice Get best ask price (reverts if not exists)
629640 function getBestAskPrice (
630641 PythLazerStructs.Feed memory feed
631642 ) public pure returns (int64 ) {
632- require (hasBestAskPrice (feed), "Best ask price does not exist " );
643+ require (
644+ isBestAskPriceRequested (feed),
645+ "Best ask price is not requested for the timestamp "
646+ );
647+ require (
648+ hasBestAskPrice (feed),
649+ "Best ask price is not present for the timestamp "
650+ );
633651 return feed._bestAskPrice;
634652 }
635653
636654 /// @notice Get publisher count (reverts if not exists)
637655 function getPublisherCount (
638656 PythLazerStructs.Feed memory feed
639657 ) public pure returns (uint16 ) {
640- require (hasPublisherCount (feed), "Publisher count does not exist " );
658+ require (
659+ isPublisherCountRequested (feed),
660+ "Publisher count is not requested for the timestamp "
661+ );
662+ require (
663+ hasPublisherCount (feed),
664+ "Publisher count is not present for the timestamp "
665+ );
641666 return feed._publisherCount;
642667 }
643668
644669 /// @notice Get exponent (reverts if not exists)
645670 function getExponent (
646671 PythLazerStructs.Feed memory feed
647672 ) public pure returns (int16 ) {
648- require (hasExponent (feed), "Exponent does not exist " );
673+ require (
674+ isExponentRequested (feed),
675+ "Exponent is not requested for the timestamp "
676+ );
677+ require (hasExponent (feed), "Exponent is not present for the timestamp " );
649678 return feed._exponent;
650679 }
651680
652681 /// @notice Get confidence (reverts if not exists)
653682 function getConfidence (
654683 PythLazerStructs.Feed memory feed
655684 ) public pure returns (uint64 ) {
656- require (hasConfidence (feed), "Confidence does not exist " );
685+ require (
686+ isConfidenceRequested (feed),
687+ "Confidence is not requested for the timestamp "
688+ );
689+ require (
690+ hasConfidence (feed),
691+ "Confidence is not present for the timestamp "
692+ );
657693 return feed._confidence;
658694 }
659695
660696 /// @notice Get funding rate (reverts if not exists)
661697 function getFundingRate (
662698 PythLazerStructs.Feed memory feed
663699 ) public pure returns (int64 ) {
664- require (hasFundingRate (feed), "Funding rate does not exist " );
700+ require (
701+ isFundingRateRequested (feed),
702+ "Funding rate is not requested for the timestamp "
703+ );
704+ require (
705+ hasFundingRate (feed),
706+ "Funding rate is not present for the timestamp "
707+ );
665708 return feed._fundingRate;
666709 }
667710
668711 /// @notice Get funding timestamp (reverts if not exists)
669712 function getFundingTimestamp (
670713 PythLazerStructs.Feed memory feed
671714 ) public pure returns (uint64 ) {
672- require (hasFundingTimestamp (feed), "Funding timestamp does not exist " );
715+ require (
716+ isFundingTimestampRequested (feed),
717+ "Funding timestamp is not requested for the timestamp "
718+ );
719+ require (
720+ hasFundingTimestamp (feed),
721+ "Funding timestamp is not present for the timestamp "
722+ );
673723 return feed._fundingTimestamp;
674724 }
675725
676726 /// @notice Get funding rate interval (reverts if not exists)
677727 function getFundingRateInterval (
678728 PythLazerStructs.Feed memory feed
679729 ) public pure returns (uint64 ) {
730+ require (
731+ isFundingRateIntervalRequested (feed),
732+ "Funding rate interval is not requested for the timestamp "
733+ );
680734 require (
681735 hasFundingRateInterval (feed),
682- "Funding rate interval does not exist "
736+ "Funding rate interval is not present for the timestamp "
683737 );
684738 return feed._fundingRateInterval;
685739 }
0 commit comments