Skip to content

Commit 77f974f

Browse files
committed
chore(lazer) Moved lib methods to internal
1 parent c39e9da commit 77f974f

File tree

4 files changed

+399
-163
lines changed

4 files changed

+399
-163
lines changed

lazer/contracts/evm/src/PythLazerLib.sol

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ library PythLazerLib {
118118
function parseFeedValueUint64(
119119
bytes calldata update,
120120
uint16 pos
121-
) public pure returns (uint64 value, uint16 new_pos) {
121+
) internal pure returns (uint64 value, uint16 new_pos) {
122122
value = uint64(bytes8(update[pos:pos + 8]));
123123
pos += 8;
124124
new_pos = pos;
@@ -127,7 +127,7 @@ library PythLazerLib {
127127
function parseFeedValueInt64(
128128
bytes calldata update,
129129
uint16 pos
130-
) public pure returns (int64 value, uint16 new_pos) {
130+
) internal pure returns (int64 value, uint16 new_pos) {
131131
value = int64(uint64(bytes8(update[pos:pos + 8])));
132132
pos += 8;
133133
new_pos = pos;
@@ -136,7 +136,7 @@ library PythLazerLib {
136136
function parseFeedValueUint16(
137137
bytes calldata update,
138138
uint16 pos
139-
) public pure returns (uint16 value, uint16 new_pos) {
139+
) internal pure returns (uint16 value, uint16 new_pos) {
140140
value = uint16(bytes2(update[pos:pos + 2]));
141141
pos += 2;
142142
new_pos = pos;
@@ -145,7 +145,7 @@ library PythLazerLib {
145145
function parseFeedValueInt16(
146146
bytes calldata update,
147147
uint16 pos
148-
) public pure returns (int16 value, uint16 new_pos) {
148+
) internal pure returns (int16 value, uint16 new_pos) {
149149
value = int16(uint16(bytes2(update[pos:pos + 2])));
150150
pos += 2;
151151
new_pos = pos;
@@ -154,7 +154,7 @@ library PythLazerLib {
154154
function parseFeedValueUint8(
155155
bytes calldata update,
156156
uint16 pos
157-
) public pure returns (uint8 value, uint16 new_pos) {
157+
) internal pure returns (uint8 value, uint16 new_pos) {
158158
value = uint8(update[pos]);
159159
pos += 1;
160160
new_pos = pos;
@@ -166,7 +166,7 @@ library PythLazerLib {
166166
/// @return update The parsed Update struct containing all feeds and their properties
167167
function parseUpdateFromPayload(
168168
bytes calldata payload
169-
) public pure returns (PythLazerStructs.Update memory update) {
169+
) internal pure returns (PythLazerStructs.Update memory update) {
170170
// Parse payload header
171171
uint16 pos;
172172
uint8 feedsLen;
@@ -447,14 +447,14 @@ library PythLazerLib {
447447
/// @notice Check if price exists
448448
function hasPrice(
449449
PythLazerStructs.Feed memory feed
450-
) public pure returns (bool) {
450+
) internal pure returns (bool) {
451451
return _hasValue(feed, uint8(PythLazerStructs.PriceFeedProperty.Price));
452452
}
453453

454454
/// @notice Check if best bid price exists
455455
function hasBestBidPrice(
456456
PythLazerStructs.Feed memory feed
457-
) public pure returns (bool) {
457+
) internal pure returns (bool) {
458458
return
459459
_hasValue(
460460
feed,
@@ -465,7 +465,7 @@ library PythLazerLib {
465465
/// @notice Check if best ask price exists
466466
function hasBestAskPrice(
467467
PythLazerStructs.Feed memory feed
468-
) public pure returns (bool) {
468+
) internal pure returns (bool) {
469469
return
470470
_hasValue(
471471
feed,
@@ -476,7 +476,7 @@ library PythLazerLib {
476476
/// @notice Check if publisher count exists
477477
function hasPublisherCount(
478478
PythLazerStructs.Feed memory feed
479-
) public pure returns (bool) {
479+
) internal pure returns (bool) {
480480
return
481481
_hasValue(
482482
feed,
@@ -487,15 +487,15 @@ library PythLazerLib {
487487
/// @notice Check if exponent exists
488488
function hasExponent(
489489
PythLazerStructs.Feed memory feed
490-
) public pure returns (bool) {
490+
) internal pure returns (bool) {
491491
return
492492
_hasValue(feed, uint8(PythLazerStructs.PriceFeedProperty.Exponent));
493493
}
494494

495495
/// @notice Check if confidence exists
496496
function hasConfidence(
497497
PythLazerStructs.Feed memory feed
498-
) public pure returns (bool) {
498+
) internal pure returns (bool) {
499499
return
500500
_hasValue(
501501
feed,
@@ -506,7 +506,7 @@ library PythLazerLib {
506506
/// @notice Check if funding rate exists
507507
function hasFundingRate(
508508
PythLazerStructs.Feed memory feed
509-
) public pure returns (bool) {
509+
) internal pure returns (bool) {
510510
return
511511
_hasValue(
512512
feed,
@@ -517,7 +517,7 @@ library PythLazerLib {
517517
/// @notice Check if funding timestamp exists
518518
function hasFundingTimestamp(
519519
PythLazerStructs.Feed memory feed
520-
) public pure returns (bool) {
520+
) internal pure returns (bool) {
521521
return
522522
_hasValue(
523523
feed,
@@ -528,7 +528,7 @@ library PythLazerLib {
528528
/// @notice Check if funding rate interval exists
529529
function hasFundingRateInterval(
530530
PythLazerStructs.Feed memory feed
531-
) public pure returns (bool) {
531+
) internal pure returns (bool) {
532532
return
533533
_hasValue(
534534
feed,
@@ -539,7 +539,7 @@ library PythLazerLib {
539539
/// @notice Check if market session exists
540540
function hasMarketSession(
541541
PythLazerStructs.Feed memory feed
542-
) public pure returns (bool) {
542+
) internal pure returns (bool) {
543543
return
544544
_hasValue(
545545
feed,
@@ -550,14 +550,14 @@ library PythLazerLib {
550550
// Requested helpers — property included in this update
551551
function isPriceRequested(
552552
PythLazerStructs.Feed memory feed
553-
) public pure returns (bool) {
553+
) internal pure returns (bool) {
554554
return
555555
_isRequested(feed, uint8(PythLazerStructs.PriceFeedProperty.Price));
556556
}
557557

558558
function isBestBidPriceRequested(
559559
PythLazerStructs.Feed memory feed
560-
) public pure returns (bool) {
560+
) internal pure returns (bool) {
561561
return
562562
_isRequested(
563563
feed,
@@ -567,7 +567,7 @@ library PythLazerLib {
567567

568568
function isBestAskPriceRequested(
569569
PythLazerStructs.Feed memory feed
570-
) public pure returns (bool) {
570+
) internal pure returns (bool) {
571571
return
572572
_isRequested(
573573
feed,
@@ -577,7 +577,7 @@ library PythLazerLib {
577577

578578
function isPublisherCountRequested(
579579
PythLazerStructs.Feed memory feed
580-
) public pure returns (bool) {
580+
) internal pure returns (bool) {
581581
return
582582
_isRequested(
583583
feed,
@@ -587,7 +587,7 @@ library PythLazerLib {
587587

588588
function isExponentRequested(
589589
PythLazerStructs.Feed memory feed
590-
) public pure returns (bool) {
590+
) internal pure returns (bool) {
591591
return
592592
_isRequested(
593593
feed,
@@ -597,7 +597,7 @@ library PythLazerLib {
597597

598598
function isConfidenceRequested(
599599
PythLazerStructs.Feed memory feed
600-
) public pure returns (bool) {
600+
) internal pure returns (bool) {
601601
return
602602
_isRequested(
603603
feed,
@@ -607,7 +607,7 @@ library PythLazerLib {
607607

608608
function isFundingRateRequested(
609609
PythLazerStructs.Feed memory feed
610-
) public pure returns (bool) {
610+
) internal pure returns (bool) {
611611
return
612612
_isRequested(
613613
feed,
@@ -617,7 +617,7 @@ library PythLazerLib {
617617

618618
function isFundingTimestampRequested(
619619
PythLazerStructs.Feed memory feed
620-
) public pure returns (bool) {
620+
) internal pure returns (bool) {
621621
return
622622
_isRequested(
623623
feed,
@@ -627,7 +627,7 @@ library PythLazerLib {
627627

628628
function isFundingRateIntervalRequested(
629629
PythLazerStructs.Feed memory feed
630-
) public pure returns (bool) {
630+
) internal pure returns (bool) {
631631
return
632632
_isRequested(
633633
feed,
@@ -637,7 +637,7 @@ library PythLazerLib {
637637

638638
function isMarketSessionRequested(
639639
PythLazerStructs.Feed memory feed
640-
) public pure returns (bool) {
640+
) internal pure returns (bool) {
641641
return
642642
_isRequested(
643643
feed,
@@ -650,7 +650,7 @@ library PythLazerLib {
650650
/// @notice Get price (reverts if not exists)
651651
function getPrice(
652652
PythLazerStructs.Feed memory feed
653-
) public pure returns (int64) {
653+
) internal pure returns (int64) {
654654
require(
655655
isPriceRequested(feed),
656656
"Price is not requested for the timestamp"
@@ -662,7 +662,7 @@ library PythLazerLib {
662662
/// @notice Get best bid price (reverts if not exists)
663663
function getBestBidPrice(
664664
PythLazerStructs.Feed memory feed
665-
) public pure returns (int64) {
665+
) internal pure returns (int64) {
666666
require(
667667
isBestBidPriceRequested(feed),
668668
"Best bid price is not requested for the timestamp"
@@ -677,7 +677,7 @@ library PythLazerLib {
677677
/// @notice Get best ask price (reverts if not exists)
678678
function getBestAskPrice(
679679
PythLazerStructs.Feed memory feed
680-
) public pure returns (int64) {
680+
) internal pure returns (int64) {
681681
require(
682682
isBestAskPriceRequested(feed),
683683
"Best ask price is not requested for the timestamp"
@@ -692,7 +692,7 @@ library PythLazerLib {
692692
/// @notice Get publisher count (reverts if not exists)
693693
function getPublisherCount(
694694
PythLazerStructs.Feed memory feed
695-
) public pure returns (uint16) {
695+
) internal pure returns (uint16) {
696696
require(
697697
isPublisherCountRequested(feed),
698698
"Publisher count is not requested for the timestamp"
@@ -707,7 +707,7 @@ library PythLazerLib {
707707
/// @notice Get exponent (reverts if not exists)
708708
function getExponent(
709709
PythLazerStructs.Feed memory feed
710-
) public pure returns (int16) {
710+
) internal pure returns (int16) {
711711
require(
712712
isExponentRequested(feed),
713713
"Exponent is not requested for the timestamp"
@@ -719,7 +719,7 @@ library PythLazerLib {
719719
/// @notice Get confidence (reverts if not exists)
720720
function getConfidence(
721721
PythLazerStructs.Feed memory feed
722-
) public pure returns (uint64) {
722+
) internal pure returns (uint64) {
723723
require(
724724
isConfidenceRequested(feed),
725725
"Confidence is not requested for the timestamp"
@@ -734,7 +734,7 @@ library PythLazerLib {
734734
/// @notice Get funding rate (reverts if not exists)
735735
function getFundingRate(
736736
PythLazerStructs.Feed memory feed
737-
) public pure returns (int64) {
737+
) internal pure returns (int64) {
738738
require(
739739
isFundingRateRequested(feed),
740740
"Funding rate is not requested for the timestamp"
@@ -749,7 +749,7 @@ library PythLazerLib {
749749
/// @notice Get funding timestamp (reverts if not exists)
750750
function getFundingTimestamp(
751751
PythLazerStructs.Feed memory feed
752-
) public pure returns (uint64) {
752+
) internal pure returns (uint64) {
753753
require(
754754
isFundingTimestampRequested(feed),
755755
"Funding timestamp is not requested for the timestamp"
@@ -764,7 +764,7 @@ library PythLazerLib {
764764
/// @notice Get funding rate interval (reverts if not exists)
765765
function getFundingRateInterval(
766766
PythLazerStructs.Feed memory feed
767-
) public pure returns (uint64) {
767+
) internal pure returns (uint64) {
768768
require(
769769
isFundingRateIntervalRequested(feed),
770770
"Funding rate interval is not requested for the timestamp"

0 commit comments

Comments
 (0)