@@ -164,7 +164,7 @@ library EnumerableMap {
164
164
}
165
165
166
166
/**
167
- * @dev Return the an array containing all the keys
167
+ * @dev Returns an array containing all the keys
168
168
*
169
169
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
170
170
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -175,6 +175,22 @@ library EnumerableMap {
175
175
return map._keys.values ();
176
176
}
177
177
178
+ /**
179
+ * @dev Returns an array containing a slice of the keys
180
+ *
181
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
182
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
183
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
184
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
185
+ */
186
+ function keys (
187
+ Bytes32ToBytes32Map storage map ,
188
+ uint256 start ,
189
+ uint256 end
190
+ ) internal view returns (bytes32 [] memory ) {
191
+ return map._keys.values (start, end);
192
+ }
193
+
178
194
// UintToUintMap
179
195
180
196
struct UintToUintMap {
@@ -278,6 +294,25 @@ library EnumerableMap {
278
294
return result;
279
295
}
280
296
297
+ /**
298
+ * @dev Return the an array containing a slice of the keys
299
+ *
300
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
301
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
302
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
303
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
304
+ */
305
+ function keys (UintToUintMap storage map , uint256 start , uint256 end ) internal view returns (uint256 [] memory ) {
306
+ bytes32 [] memory store = keys (map._inner, start, end);
307
+ uint256 [] memory result;
308
+
309
+ assembly ("memory-safe" ) {
310
+ result := store
311
+ }
312
+
313
+ return result;
314
+ }
315
+
281
316
// UintToAddressMap
282
317
283
318
struct UintToAddressMap {
@@ -381,6 +416,25 @@ library EnumerableMap {
381
416
return result;
382
417
}
383
418
419
+ /**
420
+ * @dev Return the an array containing a slice of the keys
421
+ *
422
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
423
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
424
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
425
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
426
+ */
427
+ function keys (UintToAddressMap storage map , uint256 start , uint256 end ) internal view returns (uint256 [] memory ) {
428
+ bytes32 [] memory store = keys (map._inner, start, end);
429
+ uint256 [] memory result;
430
+
431
+ assembly ("memory-safe" ) {
432
+ result := store
433
+ }
434
+
435
+ return result;
436
+ }
437
+
384
438
// UintToBytes32Map
385
439
386
440
struct UintToBytes32Map {
@@ -484,6 +538,25 @@ library EnumerableMap {
484
538
return result;
485
539
}
486
540
541
+ /**
542
+ * @dev Return the an array containing a slice of the keys
543
+ *
544
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
545
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
546
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
547
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
548
+ */
549
+ function keys (UintToBytes32Map storage map , uint256 start , uint256 end ) internal view returns (uint256 [] memory ) {
550
+ bytes32 [] memory store = keys (map._inner, start, end);
551
+ uint256 [] memory result;
552
+
553
+ assembly ("memory-safe" ) {
554
+ result := store
555
+ }
556
+
557
+ return result;
558
+ }
559
+
487
560
// AddressToUintMap
488
561
489
562
struct AddressToUintMap {
@@ -587,6 +660,25 @@ library EnumerableMap {
587
660
return result;
588
661
}
589
662
663
+ /**
664
+ * @dev Return the an array containing a slice of the keys
665
+ *
666
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
667
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
668
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
669
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
670
+ */
671
+ function keys (AddressToUintMap storage map , uint256 start , uint256 end ) internal view returns (address [] memory ) {
672
+ bytes32 [] memory store = keys (map._inner, start, end);
673
+ address [] memory result;
674
+
675
+ assembly ("memory-safe" ) {
676
+ result := store
677
+ }
678
+
679
+ return result;
680
+ }
681
+
590
682
// AddressToAddressMap
591
683
592
684
struct AddressToAddressMap {
@@ -690,6 +782,29 @@ library EnumerableMap {
690
782
return result;
691
783
}
692
784
785
+ /**
786
+ * @dev Return the an array containing a slice of the keys
787
+ *
788
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
789
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
790
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
791
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
792
+ */
793
+ function keys (
794
+ AddressToAddressMap storage map ,
795
+ uint256 start ,
796
+ uint256 end
797
+ ) internal view returns (address [] memory ) {
798
+ bytes32 [] memory store = keys (map._inner, start, end);
799
+ address [] memory result;
800
+
801
+ assembly ("memory-safe" ) {
802
+ result := store
803
+ }
804
+
805
+ return result;
806
+ }
807
+
693
808
// AddressToBytes32Map
694
809
695
810
struct AddressToBytes32Map {
@@ -793,6 +908,29 @@ library EnumerableMap {
793
908
return result;
794
909
}
795
910
911
+ /**
912
+ * @dev Return the an array containing a slice of the keys
913
+ *
914
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
915
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
916
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
917
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
918
+ */
919
+ function keys (
920
+ AddressToBytes32Map storage map ,
921
+ uint256 start ,
922
+ uint256 end
923
+ ) internal view returns (address [] memory ) {
924
+ bytes32 [] memory store = keys (map._inner, start, end);
925
+ address [] memory result;
926
+
927
+ assembly ("memory-safe" ) {
928
+ result := store
929
+ }
930
+
931
+ return result;
932
+ }
933
+
796
934
// Bytes32ToUintMap
797
935
798
936
struct Bytes32ToUintMap {
@@ -896,6 +1034,25 @@ library EnumerableMap {
896
1034
return result;
897
1035
}
898
1036
1037
+ /**
1038
+ * @dev Return the an array containing a slice of the keys
1039
+ *
1040
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
1041
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
1042
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
1043
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
1044
+ */
1045
+ function keys (Bytes32ToUintMap storage map , uint256 start , uint256 end ) internal view returns (bytes32 [] memory ) {
1046
+ bytes32 [] memory store = keys (map._inner, start, end);
1047
+ bytes32 [] memory result;
1048
+
1049
+ assembly ("memory-safe" ) {
1050
+ result := store
1051
+ }
1052
+
1053
+ return result;
1054
+ }
1055
+
899
1056
// Bytes32ToAddressMap
900
1057
901
1058
struct Bytes32ToAddressMap {
@@ -999,6 +1156,29 @@ library EnumerableMap {
999
1156
return result;
1000
1157
}
1001
1158
1159
+ /**
1160
+ * @dev Return the an array containing a slice of the keys
1161
+ *
1162
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
1163
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
1164
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
1165
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
1166
+ */
1167
+ function keys (
1168
+ Bytes32ToAddressMap storage map ,
1169
+ uint256 start ,
1170
+ uint256 end
1171
+ ) internal view returns (bytes32 [] memory ) {
1172
+ bytes32 [] memory store = keys (map._inner, start, end);
1173
+ bytes32 [] memory result;
1174
+
1175
+ assembly ("memory-safe" ) {
1176
+ result := store
1177
+ }
1178
+
1179
+ return result;
1180
+ }
1181
+
1002
1182
/**
1003
1183
* @dev Query for a nonexistent map key.
1004
1184
*/
@@ -1106,7 +1286,7 @@ library EnumerableMap {
1106
1286
}
1107
1287
1108
1288
/**
1109
- * @dev Return the an array containing all the keys
1289
+ * @dev Returns an array containing all the keys
1110
1290
*
1111
1291
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
1112
1292
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
@@ -1116,4 +1296,16 @@ library EnumerableMap {
1116
1296
function keys (BytesToBytesMap storage map ) internal view returns (bytes [] memory ) {
1117
1297
return map._keys.values ();
1118
1298
}
1299
+
1300
+ /**
1301
+ * @dev Returns an array containing a slice of the keys
1302
+ *
1303
+ * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
1304
+ * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
1305
+ * this function has an unbounded cost, and using it as part of a state-changing function may render the function
1306
+ * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block.
1307
+ */
1308
+ function keys (BytesToBytesMap storage map , uint256 start , uint256 end ) internal view returns (bytes [] memory ) {
1309
+ return map._keys.values (start, end);
1310
+ }
1119
1311
}
0 commit comments