@d20dao/vrf-sdk 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,6 +66,11 @@
66
66
  "name": "FailedCall",
67
67
  "type": "error"
68
68
  },
69
+ {
70
+ "inputs": [],
71
+ "name": "FeeOverflow",
72
+ "type": "error"
73
+ },
69
74
  {
70
75
  "inputs": [
71
76
  {
@@ -87,6 +92,11 @@
87
92
  "name": "InsufficientCallbackGas",
88
93
  "type": "error"
89
94
  },
95
+ {
96
+ "inputs": [],
97
+ "name": "InvalidBatch",
98
+ "type": "error"
99
+ },
90
100
  {
91
101
  "inputs": [],
92
102
  "name": "InvalidCallbackGas",
@@ -194,6 +204,11 @@
194
204
  "name": "RefundNotAvailable",
195
205
  "type": "error"
196
206
  },
207
+ {
208
+ "inputs": [],
209
+ "name": "RenounceDisabled",
210
+ "type": "error"
211
+ },
197
212
  {
198
213
  "inputs": [],
199
214
  "name": "RequestExpired",
@@ -290,6 +305,31 @@
290
305
  "name": "CallbackAttempted",
291
306
  "type": "event"
292
307
  },
308
+ {
309
+ "anonymous": false,
310
+ "inputs": [
311
+ {
312
+ "indexed": true,
313
+ "internalType": "uint256",
314
+ "name": "requestId",
315
+ "type": "uint256"
316
+ },
317
+ {
318
+ "indexed": true,
319
+ "internalType": "address",
320
+ "name": "refundAddress",
321
+ "type": "address"
322
+ },
323
+ {
324
+ "indexed": false,
325
+ "internalType": "uint256",
326
+ "name": "amount",
327
+ "type": "uint256"
328
+ }
329
+ ],
330
+ "name": "FeeOverpaymentCredited",
331
+ "type": "event"
332
+ },
293
333
  {
294
334
  "anonymous": false,
295
335
  "inputs": [
@@ -353,6 +393,25 @@
353
393
  "name": "FulfillmentEvidence",
354
394
  "type": "event"
355
395
  },
396
+ {
397
+ "anonymous": false,
398
+ "inputs": [
399
+ {
400
+ "indexed": true,
401
+ "internalType": "uint256",
402
+ "name": "requestId",
403
+ "type": "uint256"
404
+ },
405
+ {
406
+ "indexed": false,
407
+ "internalType": "uint8",
408
+ "name": "reason",
409
+ "type": "uint8"
410
+ }
411
+ ],
412
+ "name": "FulfillmentSkipped",
413
+ "type": "event"
414
+ },
356
415
  {
357
416
  "anonymous": false,
358
417
  "inputs": [
@@ -531,6 +590,31 @@
531
590
  "name": "OwnershipTransferred",
532
591
  "type": "event"
533
592
  },
593
+ {
594
+ "anonymous": false,
595
+ "inputs": [
596
+ {
597
+ "indexed": false,
598
+ "internalType": "uint256",
599
+ "name": "minFee",
600
+ "type": "uint256"
601
+ },
602
+ {
603
+ "indexed": false,
604
+ "internalType": "uint16",
605
+ "name": "feeMultiplier",
606
+ "type": "uint16"
607
+ },
608
+ {
609
+ "indexed": false,
610
+ "internalType": "uint32",
611
+ "name": "fulfillGasOverhead",
612
+ "type": "uint32"
613
+ }
614
+ ],
615
+ "name": "PricingChanged",
616
+ "type": "event"
617
+ },
534
618
  {
535
619
  "anonymous": false,
536
620
  "inputs": [
@@ -648,6 +732,25 @@
648
732
  "name": "RandomnessRequested",
649
733
  "type": "event"
650
734
  },
735
+ {
736
+ "anonymous": false,
737
+ "inputs": [
738
+ {
739
+ "indexed": false,
740
+ "internalType": "uint16",
741
+ "name": "previousBps",
742
+ "type": "uint16"
743
+ },
744
+ {
745
+ "indexed": false,
746
+ "internalType": "uint16",
747
+ "name": "newBps",
748
+ "type": "uint16"
749
+ }
750
+ ],
751
+ "name": "RefundBpsChanged",
752
+ "type": "event"
753
+ },
651
754
  {
652
755
  "anonymous": false,
653
756
  "inputs": [
@@ -806,6 +909,58 @@
806
909
  "stateMutability": "view",
807
910
  "type": "function"
808
911
  },
912
+ {
913
+ "inputs": [],
914
+ "name": "MAX_FEE_MULTIPLIER",
915
+ "outputs": [
916
+ {
917
+ "internalType": "uint16",
918
+ "name": "",
919
+ "type": "uint16"
920
+ }
921
+ ],
922
+ "stateMutability": "view",
923
+ "type": "function"
924
+ },
925
+ {
926
+ "inputs": [],
927
+ "name": "MAX_FULFILL_BATCH",
928
+ "outputs": [
929
+ {
930
+ "internalType": "uint256",
931
+ "name": "",
932
+ "type": "uint256"
933
+ }
934
+ ],
935
+ "stateMutability": "view",
936
+ "type": "function"
937
+ },
938
+ {
939
+ "inputs": [],
940
+ "name": "MAX_FULFILL_GAS_OVERHEAD",
941
+ "outputs": [
942
+ {
943
+ "internalType": "uint32",
944
+ "name": "",
945
+ "type": "uint32"
946
+ }
947
+ ],
948
+ "stateMutability": "view",
949
+ "type": "function"
950
+ },
951
+ {
952
+ "inputs": [],
953
+ "name": "MAX_MIN_FEE",
954
+ "outputs": [
955
+ {
956
+ "internalType": "uint256",
957
+ "name": "",
958
+ "type": "uint256"
959
+ }
960
+ ],
961
+ "stateMutability": "view",
962
+ "type": "function"
963
+ },
809
964
  {
810
965
  "inputs": [],
811
966
  "name": "MIN_CALLBACK_GAS",
@@ -819,6 +974,32 @@
819
974
  "stateMutability": "view",
820
975
  "type": "function"
821
976
  },
977
+ {
978
+ "inputs": [],
979
+ "name": "MIN_FULFILL_GAS_OVERHEAD",
980
+ "outputs": [
981
+ {
982
+ "internalType": "uint32",
983
+ "name": "",
984
+ "type": "uint32"
985
+ }
986
+ ],
987
+ "stateMutability": "view",
988
+ "type": "function"
989
+ },
990
+ {
991
+ "inputs": [],
992
+ "name": "MIN_REFUND_BPS",
993
+ "outputs": [
994
+ {
995
+ "internalType": "uint16",
996
+ "name": "",
997
+ "type": "uint16"
998
+ }
999
+ ],
1000
+ "stateMutability": "view",
1001
+ "type": "function"
1002
+ },
822
1003
  {
823
1004
  "inputs": [],
824
1005
  "name": "REFUND_CALLBACK_GAS",
@@ -930,6 +1111,19 @@
930
1111
  "stateMutability": "view",
931
1112
  "type": "function"
932
1113
  },
1114
+ {
1115
+ "inputs": [],
1116
+ "name": "feeMultiplier",
1117
+ "outputs": [
1118
+ {
1119
+ "internalType": "uint16",
1120
+ "name": "",
1121
+ "type": "uint16"
1122
+ }
1123
+ ],
1124
+ "stateMutability": "view",
1125
+ "type": "function"
1126
+ },
933
1127
  {
934
1128
  "inputs": [],
935
1129
  "name": "feeRecipient",
@@ -943,6 +1137,19 @@
943
1137
  "stateMutability": "view",
944
1138
  "type": "function"
945
1139
  },
1140
+ {
1141
+ "inputs": [],
1142
+ "name": "fulfillGasOverhead",
1143
+ "outputs": [
1144
+ {
1145
+ "internalType": "uint32",
1146
+ "name": "",
1147
+ "type": "uint32"
1148
+ }
1149
+ ],
1150
+ "stateMutability": "view",
1151
+ "type": "function"
1152
+ },
946
1153
  {
947
1154
  "inputs": [
948
1155
  {
@@ -1008,6 +1215,71 @@
1008
1215
  "stateMutability": "nonpayable",
1009
1216
  "type": "function"
1010
1217
  },
1218
+ {
1219
+ "inputs": [
1220
+ {
1221
+ "internalType": "uint256[]",
1222
+ "name": "ids",
1223
+ "type": "uint256[]"
1224
+ },
1225
+ {
1226
+ "components": [
1227
+ {
1228
+ "internalType": "uint256[2]",
1229
+ "name": "pk",
1230
+ "type": "uint256[2]"
1231
+ },
1232
+ {
1233
+ "internalType": "uint256[2]",
1234
+ "name": "gamma",
1235
+ "type": "uint256[2]"
1236
+ },
1237
+ {
1238
+ "internalType": "uint256",
1239
+ "name": "c",
1240
+ "type": "uint256"
1241
+ },
1242
+ {
1243
+ "internalType": "uint256",
1244
+ "name": "s",
1245
+ "type": "uint256"
1246
+ },
1247
+ {
1248
+ "internalType": "uint256",
1249
+ "name": "seed",
1250
+ "type": "uint256"
1251
+ },
1252
+ {
1253
+ "internalType": "address",
1254
+ "name": "uWitness",
1255
+ "type": "address"
1256
+ },
1257
+ {
1258
+ "internalType": "uint256[2]",
1259
+ "name": "cGammaWitness",
1260
+ "type": "uint256[2]"
1261
+ },
1262
+ {
1263
+ "internalType": "uint256[2]",
1264
+ "name": "sHashWitness",
1265
+ "type": "uint256[2]"
1266
+ },
1267
+ {
1268
+ "internalType": "uint256",
1269
+ "name": "zInv",
1270
+ "type": "uint256"
1271
+ }
1272
+ ],
1273
+ "internalType": "struct VRF.Proof[]",
1274
+ "name": "proofs",
1275
+ "type": "tuple[]"
1276
+ }
1277
+ ],
1278
+ "name": "fulfillRandomnessBatch",
1279
+ "outputs": [],
1280
+ "stateMutability": "nonpayable",
1281
+ "type": "function"
1282
+ },
1011
1283
  {
1012
1284
  "inputs": [
1013
1285
  {
@@ -1255,6 +1527,19 @@
1255
1527
  "stateMutability": "view",
1256
1528
  "type": "function"
1257
1529
  },
1530
+ {
1531
+ "inputs": [],
1532
+ "name": "initialMinFee",
1533
+ "outputs": [
1534
+ {
1535
+ "internalType": "uint256",
1536
+ "name": "",
1537
+ "type": "uint256"
1538
+ }
1539
+ ],
1540
+ "stateMutability": "view",
1541
+ "type": "function"
1542
+ },
1258
1543
  {
1259
1544
  "inputs": [
1260
1545
  {
@@ -1420,6 +1705,19 @@
1420
1705
  "stateMutability": "pure",
1421
1706
  "type": "function"
1422
1707
  },
1708
+ {
1709
+ "inputs": [],
1710
+ "name": "minFee",
1711
+ "outputs": [
1712
+ {
1713
+ "internalType": "uint256",
1714
+ "name": "",
1715
+ "type": "uint256"
1716
+ }
1717
+ ],
1718
+ "stateMutability": "view",
1719
+ "type": "function"
1720
+ },
1423
1721
  {
1424
1722
  "inputs": [],
1425
1723
  "name": "nextRequestId",
@@ -1459,6 +1757,29 @@
1459
1757
  "stateMutability": "view",
1460
1758
  "type": "function"
1461
1759
  },
1760
+ {
1761
+ "inputs": [],
1762
+ "name": "pricing",
1763
+ "outputs": [
1764
+ {
1765
+ "internalType": "uint256",
1766
+ "name": "",
1767
+ "type": "uint256"
1768
+ },
1769
+ {
1770
+ "internalType": "uint16",
1771
+ "name": "",
1772
+ "type": "uint16"
1773
+ },
1774
+ {
1775
+ "internalType": "uint32",
1776
+ "name": "",
1777
+ "type": "uint32"
1778
+ }
1779
+ ],
1780
+ "stateMutability": "view",
1781
+ "type": "function"
1782
+ },
1462
1783
  {
1463
1784
  "inputs": [],
1464
1785
  "name": "protocolConfigurationHash",
@@ -1511,6 +1832,62 @@
1511
1832
  "stateMutability": "view",
1512
1833
  "type": "function"
1513
1834
  },
1835
+ {
1836
+ "inputs": [
1837
+ {
1838
+ "internalType": "uint32",
1839
+ "name": "callbackGasLimit",
1840
+ "type": "uint32"
1841
+ }
1842
+ ],
1843
+ "name": "quoteFee",
1844
+ "outputs": [
1845
+ {
1846
+ "internalType": "uint256",
1847
+ "name": "",
1848
+ "type": "uint256"
1849
+ }
1850
+ ],
1851
+ "stateMutability": "view",
1852
+ "type": "function"
1853
+ },
1854
+ {
1855
+ "inputs": [
1856
+ {
1857
+ "internalType": "uint32",
1858
+ "name": "callbackGasLimit",
1859
+ "type": "uint32"
1860
+ },
1861
+ {
1862
+ "internalType": "uint256",
1863
+ "name": "baseFee",
1864
+ "type": "uint256"
1865
+ }
1866
+ ],
1867
+ "name": "quoteFeeAt",
1868
+ "outputs": [
1869
+ {
1870
+ "internalType": "uint256",
1871
+ "name": "",
1872
+ "type": "uint256"
1873
+ }
1874
+ ],
1875
+ "stateMutability": "view",
1876
+ "type": "function"
1877
+ },
1878
+ {
1879
+ "inputs": [],
1880
+ "name": "refundBps",
1881
+ "outputs": [
1882
+ {
1883
+ "internalType": "uint16",
1884
+ "name": "",
1885
+ "type": "uint16"
1886
+ }
1887
+ ],
1888
+ "stateMutability": "view",
1889
+ "type": "function"
1890
+ },
1514
1891
  {
1515
1892
  "inputs": [
1516
1893
  {
@@ -1566,12 +1943,18 @@
1566
1943
  "inputs": [],
1567
1944
  "name": "renounceOwnership",
1568
1945
  "outputs": [],
1569
- "stateMutability": "nonpayable",
1946
+ "stateMutability": "view",
1570
1947
  "type": "function"
1571
1948
  },
1572
1949
  {
1573
- "inputs": [],
1574
- "name": "requestFee",
1950
+ "inputs": [
1951
+ {
1952
+ "internalType": "uint256",
1953
+ "name": "requestId",
1954
+ "type": "uint256"
1955
+ }
1956
+ ],
1957
+ "name": "requestFeePaid",
1575
1958
  "outputs": [
1576
1959
  {
1577
1960
  "internalType": "uint256",
@@ -1672,6 +2055,25 @@
1672
2055
  "stateMutability": "payable",
1673
2056
  "type": "function"
1674
2057
  },
2058
+ {
2059
+ "inputs": [
2060
+ {
2061
+ "internalType": "uint256",
2062
+ "name": "requestId",
2063
+ "type": "uint256"
2064
+ }
2065
+ ],
2066
+ "name": "requestRefundBps",
2067
+ "outputs": [
2068
+ {
2069
+ "internalType": "uint16",
2070
+ "name": "",
2071
+ "type": "uint16"
2072
+ }
2073
+ ],
2074
+ "stateMutability": "view",
2075
+ "type": "function"
2076
+ },
1675
2077
  {
1676
2078
  "inputs": [
1677
2079
  {
@@ -1772,6 +2174,42 @@
1772
2174
  "stateMutability": "nonpayable",
1773
2175
  "type": "function"
1774
2176
  },
2177
+ {
2178
+ "inputs": [
2179
+ {
2180
+ "internalType": "uint256",
2181
+ "name": "nextMinFee",
2182
+ "type": "uint256"
2183
+ },
2184
+ {
2185
+ "internalType": "uint16",
2186
+ "name": "multiplier",
2187
+ "type": "uint16"
2188
+ },
2189
+ {
2190
+ "internalType": "uint32",
2191
+ "name": "overhead",
2192
+ "type": "uint32"
2193
+ }
2194
+ ],
2195
+ "name": "setPricing",
2196
+ "outputs": [],
2197
+ "stateMutability": "nonpayable",
2198
+ "type": "function"
2199
+ },
2200
+ {
2201
+ "inputs": [
2202
+ {
2203
+ "internalType": "uint16",
2204
+ "name": "next",
2205
+ "type": "uint16"
2206
+ }
2207
+ ],
2208
+ "name": "setRefundBps",
2209
+ "outputs": [],
2210
+ "stateMutability": "nonpayable",
2211
+ "type": "function"
2212
+ },
1775
2213
  {
1776
2214
  "inputs": [
1777
2215
  {
@@ -145,6 +145,11 @@
145
145
  "name": "PreparationClosed",
146
146
  "type": "error"
147
147
  },
148
+ {
149
+ "inputs": [],
150
+ "name": "RenounceDisabled",
151
+ "type": "error"
152
+ },
148
153
  {
149
154
  "inputs": [],
150
155
  "name": "UUPSUnauthorizedCallContext",
@@ -161,6 +166,31 @@
161
166
  "name": "UUPSUnsupportedProxiableUUID",
162
167
  "type": "error"
163
168
  },
169
+ {
170
+ "anonymous": false,
171
+ "inputs": [
172
+ {
173
+ "indexed": true,
174
+ "internalType": "uint64",
175
+ "name": "fromEpoch",
176
+ "type": "uint64"
177
+ },
178
+ {
179
+ "indexed": true,
180
+ "internalType": "bytes32",
181
+ "name": "catalogHash",
182
+ "type": "bytes32"
183
+ },
184
+ {
185
+ "indexed": false,
186
+ "internalType": "address[4]",
187
+ "name": "signers",
188
+ "type": "address[4]"
189
+ }
190
+ ],
191
+ "name": "CatalogScheduled",
192
+ "type": "event"
193
+ },
164
194
  {
165
195
  "anonymous": false,
166
196
  "inputs": [
@@ -295,6 +325,19 @@
295
325
  "stateMutability": "view",
296
326
  "type": "function"
297
327
  },
328
+ {
329
+ "inputs": [],
330
+ "name": "MAX_ATTESTATION_AGE",
331
+ "outputs": [
332
+ {
333
+ "internalType": "uint256",
334
+ "name": "",
335
+ "type": "uint256"
336
+ }
337
+ ],
338
+ "stateMutability": "view",
339
+ "type": "function"
340
+ },
298
341
  {
299
342
  "inputs": [],
300
343
  "name": "MAX_PACKET_BYTES",
@@ -393,6 +436,25 @@
393
436
  "stateMutability": "view",
394
437
  "type": "function"
395
438
  },
439
+ {
440
+ "inputs": [
441
+ {
442
+ "internalType": "uint64",
443
+ "name": "epochId",
444
+ "type": "uint64"
445
+ }
446
+ ],
447
+ "name": "catalogHashAt",
448
+ "outputs": [
449
+ {
450
+ "internalType": "bytes32",
451
+ "name": "hash",
452
+ "type": "bytes32"
453
+ }
454
+ ],
455
+ "stateMutability": "view",
456
+ "type": "function"
457
+ },
396
458
  {
397
459
  "inputs": [
398
460
  {
@@ -753,6 +815,24 @@
753
815
  "inputs": [],
754
816
  "name": "renounceOwnership",
755
817
  "outputs": [],
818
+ "stateMutability": "view",
819
+ "type": "function"
820
+ },
821
+ {
822
+ "inputs": [
823
+ {
824
+ "internalType": "address[4]",
825
+ "name": "signers",
826
+ "type": "address[4]"
827
+ },
828
+ {
829
+ "internalType": "uint64",
830
+ "name": "fromEpoch",
831
+ "type": "uint64"
832
+ }
833
+ ],
834
+ "name": "scheduleCatalog",
835
+ "outputs": [],
756
836
  "stateMutability": "nonpayable",
757
837
  "type": "function"
758
838
  },
@@ -769,6 +849,25 @@
769
849
  "stateMutability": "nonpayable",
770
850
  "type": "function"
771
851
  },
852
+ {
853
+ "inputs": [
854
+ {
855
+ "internalType": "uint64",
856
+ "name": "epochId",
857
+ "type": "uint64"
858
+ }
859
+ ],
860
+ "name": "signersAt",
861
+ "outputs": [
862
+ {
863
+ "internalType": "address[4]",
864
+ "name": "signers",
865
+ "type": "address[4]"
866
+ }
867
+ ],
868
+ "stateMutability": "view",
869
+ "type": "function"
870
+ },
772
871
  {
773
872
  "inputs": [
774
873
  {
@@ -27,7 +27,8 @@ abstract contract MiningRandomnessConsumer is D20VRFConsumer {
27
27
  if (claimRandomness[claimId].requested) revert ClaimAlreadyRequested();
28
28
  claimRandomness[claimId].requested = true;
29
29
  ID20VRF rng = ID20VRF(vrfCoordinator);
30
- requestId = rng.requestRandomness{value: rng.requestFee()}(
30
+ // The same-transaction quote is exact; only off-chain senders need a buffer.
31
+ requestId = rng.requestRandomness{value: rng.quoteFee(callbackGasLimit)}(
31
32
  keccak256(abi.encode(claimId, lockedWork)), callbackGasLimit, refundAddress
32
33
  );
33
34
  claimRandomness[claimId].requestId = requestId;