Эх сурвалжийг харах

chore(lazer) Evm contracts changed feed struct

Aditya Arora 3 долоо хоног өмнө
parent
commit
700f4001ee

+ 16 - 16
lazer/contracts/evm/src/PythLazerStructs.sol

@@ -22,20 +22,20 @@ library PythLazerStructs {
     }
 
     struct Feed {
-        // Slot 1: 4 + 4 + 8 + 8 + 8 = 32 bytes (fully packed)
+        // Slot 1: 16 + 4 + 8 + 2 + 2 = 32 bytes (fully packed!)
+        uint128 existsFlags;      // Bitmap: bit 0-127 for up to 128 properties
         uint32 feedId;
-        uint32 existsFlags; // Bitmap: bit 0-31 for up to 32 properties
         int64 _price;
+        uint16 _publisherCount;
+        int16 _exponent;
+        // Slot 2: 8 + 8 + 8 + 8 = 32 bytes (fully packed)
         int64 _bestBidPrice;
         int64 _bestAskPrice;
-        // Slot 2: 8 + 8 + 8 + 8 = 32 bytes (fully packed)
         uint64 _confidence;
         int64 _fundingRate;
+        // Slot 3: 8 + 8 = 16 bytes (16 bytes wasted)
         uint64 _fundingTimestamp;
         uint64 _fundingRateInterval;
-        // Slot 3: 2 + 2 = 4 bytes (28 bytes wasted, but unavoidable)
-        uint16 _publisherCount;
-        int16 _exponent;
     }
 
     struct Update {
@@ -44,14 +44,14 @@ library PythLazerStructs {
         Feed[] feeds;
     }
 
-    // Bitmap constants for Feed.existsFlags
-    uint32 constant PRICE_EXISTS = 1 << 0;
-    uint32 constant BEST_BID_EXISTS = 1 << 1;
-    uint32 constant BEST_ASK_EXISTS = 1 << 2;
-    uint32 constant PUBLISHER_COUNT_EXISTS = 1 << 3;
-    uint32 constant EXPONENT_EXISTS = 1 << 4;
-    uint32 constant CONFIDENCE_EXISTS = 1 << 5;
-    uint32 constant FUNDING_RATE_EXISTS = 1 << 6;
-    uint32 constant FUNDING_TIMESTAMP_EXISTS = 1 << 7;
-    uint32 constant FUNDING_RATE_INTERVAL_EXISTS = 1 << 8;
+    // Bitmap constants for Feed.existsFlags (supports up to 128 properties)
+    uint128 constant PRICE_EXISTS = 1 << 0;
+    uint128 constant BEST_BID_EXISTS = 1 << 1;
+    uint128 constant BEST_ASK_EXISTS = 1 << 2;
+    uint128 constant PUBLISHER_COUNT_EXISTS = 1 << 3;
+    uint128 constant EXPONENT_EXISTS = 1 << 4;
+    uint128 constant CONFIDENCE_EXISTS = 1 << 5;
+    uint128 constant FUNDING_RATE_EXISTS = 1 << 6;
+    uint128 constant FUNDING_TIMESTAMP_EXISTS = 1 << 7;
+    uint128 constant FUNDING_RATE_INTERVAL_EXISTS = 1 << 8;
 }