@d20dao/vrf-sdk 0.2.0 → 0.3.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.
package/AGENTS.md CHANGED
@@ -32,7 +32,7 @@ Keepers may fulfill up to 16 requests in one fulfillRandomnessBatch transaction.
32
32
 
33
33
  ## Verification and trust
34
34
 
35
- The four ordered recipe slots are Hyperliquid BTC volume, ANU, TickerLayer BTCUSD and TickerLayer ETHUSD; the latter two share a provider signer. Preserve the entire exact signed response, limited to 128 bytes. Signatures establish wrapper provenance, not unbiased upstream data. At publication an attestation may be at most 240 seconds old (MAX_ATTESTATION_AGE) and never future-dated.
35
+ The four ordered recipe slots are Hyperliquid BTC volume, ANU, TickerLayer BTCUSD and TickerLayer ETHUSD; the latter two share a provider signer. The epoch anchor selects one slot; fallback attempt n (1–3) is the slot n positions later, valid only from n × 20 blocks into the epoch (getEpochFallbackSelection, fallbackOpensAt, commitEpochFallback). replayEpochCommitment derives the attempt from the committed source and rejects a commit block before its window. Preserve the entire exact signed response, limited to 128 bytes. Signatures establish wrapper provenance, not unbiased upstream data. At publication an attestation may be at most 240 seconds old (MAX_ATTESTATION_AGE) and never future-dated.
36
36
 
37
37
  Signer catalogs are per epoch. The registry owner can schedule a replacement with scheduleCatalog(signers, fromEpoch) at least two epochs ahead (event CatalogScheduled); the current and next epoch, prepared snapshots and open requests keep their signers. Replay must use signersAt(epochId) or the CatalogScheduled history as epoch.catalog.signers, which replayEpochCommitment binds to the record's catalogHash, while configuration.catalogHash stays the initial catalogHash() bound into protocolConfigurationHash.
38
38
 
@@ -51,7 +51,3 @@ This SDK holds no signer or bot keys, runs no keeper/prover and exposes no opera
51
51
  After refundRequest has paid the fixed refund address or recorded its refund credit, the coordinator calls `onRefund(requestId)` on the original consumer. Extend `D20VRFConsumer` and override `_onRefund(uint256 requestId)` to update application state; the base authenticates the coordinator. The callback only carries the request ID and does not imply that the consumer itself received money. Application assets and fees remain the application's responsibility.
52
52
 
53
53
  The first attempt forwards 100,000 gas. A reverting or gas-exhausting hook cannot undo the fee settlement. After failure, `retryRefundCallback(requestId, gasLimit)` retries the notification without another payment; successful delivery is recorded by `refundCallbackDelivered(requestId)`. Refund/retry needs sufficient outer gas. Never request new randomness from within either callback; use a separate application transaction.
54
-
55
- ## Migrating from 0.1.x
56
-
57
- requestFee() is removed: pay quoteFee(callbackGasLimit) in-transaction or quoteFeeAt plus a buffer off-chain (quoteRequestFee). Payment is msg.value >= fee with IncorrectFee(expected, actual) on underpayment and refund credit for the excess; forward a player's whole payment instead of requiring equality. EpochProtocolConfiguration.requestFee is renamed initialMinFee (same encoding). Replay takes the per-epoch catalog in epoch.catalog.signers. Attestations may be 240 seconds old (was 120). Expiry refunds pay requestRefundBps of feePaid. Fulfillments may be batched; index per-request events. renounceOwnership reverts. Deployment addresses and code hashes change with the testnet upgrade and mainnet deployment; take them from the manifests.
@@ -2,7 +2,7 @@
2
2
  "compiler": "0.8.28+commit.7893614a.Emscripten.clang",
3
3
  "protocol": {
4
4
  "sourceRepository": "https://github.com/d20dao/keeper",
5
- "sourceCommit": "200c5ad4976f487db60561171d7ed5dd63eaa94c",
5
+ "sourceCommit": "640b60cb992a7e3add1efe8e7b392341732ea004",
6
6
  "note": "Current public d20dao protocol copied byte-for-byte from committed Git blobs. Operator backends, keys, test fixtures and proof generation are excluded from the package.",
7
7
  "files": {
8
8
  "LICENSE": "bfdc94eef4cfbec12a9ed47bb406c8125cf4c306facf7b8d92db58f133b1a703",
@@ -21,12 +21,12 @@
21
21
  "src/replay.ts": "c97a5081e785e6a7f27987e2d4c4d9861fe8fa8cbc775b0152e337141d3d48d7",
22
22
  "src/sources.ts": "d8566e7809c67dc51acab3b58fc93d734d098c2eabbaf3657ac910affe12e31e",
23
23
  "src/verification.ts": "754e39554c0c432cf1404741503f66b4199b84f39003d8e42f300a7256ffaa6a",
24
- "src/epoch.ts": "23bb83fb2b0cfa85b361f9b03ff3aec733b6d6f2b48c524d731159d76310b0b9",
25
- "contracts/EpochEntropy.sol": "2ad8023f38e7a39aa1a671f6355e20be651bac9aae256cf9badff6f49b676041",
24
+ "src/epoch.ts": "41a3d60f063deccc6d19761dc63702a2fdd1efdc46f775b7202241c3eb4d1334",
25
+ "contracts/EpochEntropy.sol": "bdd4f9e5dab6626572a72a0c15e73b4f3f19c6933b7a122fad237a9784fa3cbb",
26
26
  "contracts/D20Proxy.sol": "83dcef3b72e2a0a4809c2d8df0d083d2a0f659fe2b3b01fadb1b2eaf8afb7286"
27
27
  }
28
28
  },
29
- "packageLockSha256": "35f5ae1e497ab21e4f40f2b4785381b8ad14075d5d213d1256ecddcd7e953077",
29
+ "packageLockSha256": "1607f850da1f95de8e49e64f61a3e5bab1b54ba3415678241403d6f5c66b6bf6",
30
30
  "buildDependencies": {
31
31
  "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": "41a3040398d53999dea3251ff8906e11ec1a699362a1d8f4a55bfc7709cc00f3",
32
32
  "@openzeppelin/contracts/utils/ReentrancyGuard.sol": "94e409e8f6e3184236651a6cc2b1a6a3ea0f0a25eb85b71e524ad5791bb2fbc8",
@@ -70,8 +70,8 @@
70
70
  "src/replay.ts": "c97a5081e785e6a7f27987e2d4c4d9861fe8fa8cbc775b0152e337141d3d48d7",
71
71
  "src/sources.ts": "d8566e7809c67dc51acab3b58fc93d734d098c2eabbaf3657ac910affe12e31e",
72
72
  "src/verification.ts": "754e39554c0c432cf1404741503f66b4199b84f39003d8e42f300a7256ffaa6a",
73
- "src/epoch.ts": "23bb83fb2b0cfa85b361f9b03ff3aec733b6d6f2b48c524d731159d76310b0b9",
74
- "contracts/EpochEntropy.sol": "2ad8023f38e7a39aa1a671f6355e20be651bac9aae256cf9badff6f49b676041",
73
+ "src/epoch.ts": "41a3d60f063deccc6d19761dc63702a2fdd1efdc46f775b7202241c3eb4d1334",
74
+ "contracts/EpochEntropy.sol": "bdd4f9e5dab6626572a72a0c15e73b4f3f19c6933b7a122fad237a9784fa3cbb",
75
75
  "contracts/D20Proxy.sol": "83dcef3b72e2a0a4809c2d8df0d083d2a0f659fe2b3b01fadb1b2eaf8afb7286"
76
76
  },
77
77
  "packageSources": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "sourceRepository": "https://github.com/d20dao/keeper",
3
- "sourceCommit": "200c5ad4976f487db60561171d7ed5dd63eaa94c",
3
+ "sourceCommit": "640b60cb992a7e3add1efe8e7b392341732ea004",
4
4
  "note": "Current public d20dao protocol copied byte-for-byte from committed Git blobs. Operator backends, keys, test fixtures and proof generation are excluded from the package.",
5
5
  "files": {
6
6
  "LICENSE": "bfdc94eef4cfbec12a9ed47bb406c8125cf4c306facf7b8d92db58f133b1a703",
@@ -19,8 +19,8 @@
19
19
  "src/replay.ts": "c97a5081e785e6a7f27987e2d4c4d9861fe8fa8cbc775b0152e337141d3d48d7",
20
20
  "src/sources.ts": "d8566e7809c67dc51acab3b58fc93d734d098c2eabbaf3657ac910affe12e31e",
21
21
  "src/verification.ts": "754e39554c0c432cf1404741503f66b4199b84f39003d8e42f300a7256ffaa6a",
22
- "src/epoch.ts": "23bb83fb2b0cfa85b361f9b03ff3aec733b6d6f2b48c524d731159d76310b0b9",
23
- "contracts/EpochEntropy.sol": "2ad8023f38e7a39aa1a671f6355e20be651bac9aae256cf9badff6f49b676041",
22
+ "src/epoch.ts": "41a3d60f063deccc6d19761dc63702a2fdd1efdc46f775b7202241c3eb4d1334",
23
+ "contracts/EpochEntropy.sol": "bdd4f9e5dab6626572a72a0c15e73b4f3f19c6933b7a122fad237a9784fa3cbb",
24
24
  "contracts/D20Proxy.sol": "83dcef3b72e2a0a4809c2d8df0d083d2a0f659fe2b3b01fadb1b2eaf8afb7286"
25
25
  }
26
26
  }
package/README.md CHANGED
@@ -58,7 +58,7 @@ await dice.roll(clientSeed, 100_000, { value });
58
58
 
59
59
  ## Request lifecycle
60
60
 
61
- Epochs last 200 blocks. The keeper selects one of four fixed recipes using the canonical block hash at epoch start minus one and prepares its first validated API3 snapshot locally. Idle preparation publishes no transaction. An unused local snapshot can be retained for 50 epochs (10,000 blocks), subject to live-demand and unresolved-transaction protection.
61
+ Epochs last 200 blocks. The keeper selects one of four fixed recipes using the canonical block hash at epoch start minus one and prepares its first validated API3 snapshot locally. If the selected source yields no valid packet, the next source slot in a fixed order can be committed instead, one slot per 20-block window (at most three fallbacks); a saved response is never refreshed or resampled. Idle preparation publishes no transaction. An unused local snapshot can be retained for 50 epochs (10,000 blocks), subject to live-demand and unresolved-transaction protection.
62
62
 
63
63
  A request escrows its quoted fee even when its epoch packet is not published yet, and fixes its original block, epoch, client seed, mapping, refund address, `feePaid`, `refundBps` and 60-second deadline. The keeper publishes the saved packet only for live paid demand. The randomness target becomes `max(requestBlock, committedBlock + 1)`, so its hash is unknown at publication; before publication the request has no usable target or VRF seed. Multiple requests share the packet, and timely requests can settle across epoch boundaries without changing their epoch.
64
64
 
@@ -129,36 +129,23 @@ SDK installation provides consumer and verification tooling. Chain availability,
129
129
 
130
130
  Obtain proxy addresses, implementation addresses and independently checked code hashes from the keeper's deployment manifests, and check that the coordinator implementation at your chain's proxy exposes `quoteFee`/`quoteFeeAt` (its code hash matches the manifest entry for this protocol version) before relying on this SDK's interface. The testnet upgrade to this protocol version and the Arc mainnet deployment are published there when confirmed.
131
131
 
132
- ### Arc Testnet pilot
132
+ ### Arc Testnet
133
133
 
134
134
  Chain ID: **5042002**. Use the **coordinator proxy** when constructing a consumer.
135
135
 
136
136
  | Contract | Role | Arc Testnet address |
137
137
  | --- | --- | --- |
138
- | D20VRFCoordinator | Consumer entry point / proxy | [`0xd20Da07c98F6A64CA20084fD5905abF19F5D84ac`](https://testnet.arcscan.app/address/0xd20Da07c98F6A64CA20084fD5905abF19F5D84ac) |
139
- | EpochEntropy | Epoch registry / proxy | [`0xd20Da08e4E903cBD2F99fD5F4Be021FC1a9fA496`](https://testnet.arcscan.app/address/0xd20Da08e4E903cBD2F99fD5F4Be021FC1a9fA496) |
140
- | D20CostClient | Restricted pilot consumer / proxy | [`0xd20dA0e6d4405B40040d458F8010191712E2Cb42`](https://testnet.arcscan.app/address/0xd20dA0e6d4405B40040d458F8010191712E2Cb42) |
141
- | D20VRFCoordinator | Implementation | [`0xD20da02c34489c8eC68ca1D4FC8fe5ea79ADD223`](https://testnet.arcscan.app/address/0xD20da02c34489c8eC68ca1D4FC8fe5ea79ADD223) |
142
- | EpochEntropy | Implementation | [`0xD20da079ccEf2CE273b8f2356abccE8c97c73F17`](https://testnet.arcscan.app/address/0xD20da079ccEf2CE273b8f2356abccE8c97c73F17) |
138
+ | D20VRFCoordinator | Consumer entry point / proxy | [`0xd20DA0FF9087d053f0291524Eac12abA1ADBd945`](https://testnet.arcscan.app/address/0xd20DA0FF9087d053f0291524Eac12abA1ADBd945) |
139
+ | EpochEntropy | Epoch registry / proxy | [`0xD20Da00B47A7cD2211dC4683E306913b05903756`](https://testnet.arcscan.app/address/0xD20Da00B47A7cD2211dC4683E306913b05903756) |
140
+ | D20CostClient | Restricted cost client / proxy | [`0xD20da026090B8472579a2B93030F1fC4c94807F1`](https://testnet.arcscan.app/address/0xD20da026090B8472579a2B93030F1fC4c94807F1) |
141
+ | D20VRFCoordinator | Implementation | [`0xD20da0c375cEfCdA65703699A4090237057e9b68`](https://testnet.arcscan.app/address/0xD20da0c375cEfCdA65703699A4090237057e9b68) |
142
+ | EpochEntropy | Implementation | [`0xD20Da0cf7Ddc6123f9A87c0C210F8ECB934CA7D5`](https://testnet.arcscan.app/address/0xD20Da0cf7Ddc6123f9A87c0C210F8ECB934CA7D5) |
143
143
  | D20CostClient | Implementation | [`0xD20DA00A872acfDe3e4721Fc1051BD23CC84B66b`](https://testnet.arcscan.app/address/0xD20DA00A872acfDe3e4721Fc1051BD23CC84B66b) |
144
144
 
145
- Addresses are copied from the [Arc Testnet deployment manifest](https://github.com/d20dao/keeper/blob/main/deployments/arc-testnet.json). Explorer links identify addresses; they do not assert explorer source-code verification. Implementation addresses change through owner-authorized upgrades, so the implementation rows and code hashes are only valid together with the manifest revision they came from. The pilot consumer is test tooling, not a shared application entry point. The [small-sample measurements](https://github.com/d20dao/keeper/blob/main/docs/benchmarks/arc-testnet-pilot-2026-09-15.json) cover proof acceptance, same-result callback repair and expired-request refunds; they are not an SLA.
145
+ Addresses are copied from the [Arc Testnet deployment manifest](https://github.com/d20dao/keeper/blob/main/deployments/arc-testnet.json). Explorer links identify addresses; they do not assert explorer source-code verification. Implementation addresses change through owner-authorized upgrades, so the implementation rows and code hashes are only valid together with the manifest revision they came from. The pilot consumer is test tooling, not a shared application entry point. The [testnet stress run](https://github.com/d20dao/keeper/blob/main/docs/benchmarks/arc-testnet-stress-2026-09-16.json) served 68 paid requests within 2–4 chain seconds, 47 of them in batched fulfillments; measured timings are not an SLA.
146
146
 
147
147
  ## Optional refund notification
148
148
 
149
149
  After `refundRequest` has paid the fixed refund address or recorded its refund credit, the coordinator calls `onRefund(requestId)` on the original consumer. Extend `D20VRFConsumer` and override `_onRefund(uint256 requestId)` to update application state; the base authenticates the coordinator. The callback only carries the request ID and does not imply that the consumer itself received money. Application assets and fees remain the application's responsibility.
150
150
 
151
151
  The first attempt forwards 100,000 gas. A reverting or gas-exhausting hook cannot undo the fee settlement. After failure, `retryRefundCallback(requestId, gasLimit)` retries the notification without another payment; successful delivery is recorded by `refundCallbackDelivered(requestId)`. Refund/retry needs sufficient outer gas. Never request new randomness from within either callback; use a separate application transaction.
152
-
153
- ## Migrating from 0.1.x
154
-
155
- - `requestFee()` no longer exists. Contracts pay `quoteFee(callbackGasLimit)` in the requesting transaction; off-chain senders quote with `quoteFeeAt(callbackGasLimit, latestBlock.baseFeePerGas)` plus a buffer, for example through `quoteRequestFee`, and must never quote `quoteFee` through `eth_call`.
156
- - Payment is `msg.value >= fee` instead of an exact match; underpayment reverts with `IncorrectFee(expected, actual)` and the excess becomes refund credit of the refund address, withdrawable with `withdrawRefundCredit`. Consumers that forward a player's payment should forward all of it rather than checking for equality. `RandomnessRequested` now carries `feePaid`.
157
- - `EpochProtocolConfiguration.requestFee` is renamed `initialMinFee` (same value, position and encoding; replay inputs need the key renamed, hashes are unchanged), matching the new `initialMinFee()` getter.
158
- - Replay takes the per-epoch signer catalog in `epoch.catalog.signers` (`signersAt(epochId)` or `CatalogScheduled` history) instead of assuming the initial catalog; `replayCoordinator` no longer requires it to equal `configuration.catalogHash`.
159
- - Epoch attestations may be up to 240 seconds old at publication (was 120); `MAX_ATTESTATION_AGE` is exported from `/epoch`.
160
- - An expiry refund pays `feePaid × requestRefundBps / 10000`, so it can be below the full fee for requests created after the owner lowers `refundBps` (never below 50%).
161
- - Fulfillments can arrive in batches of up to 16 (`fulfillRandomnessBatch`, `FulfillmentSkipped`); indexers must key on per-request events, not on one 452-byte calldata per transaction.
162
- - `renounceOwnership` reverts with `RenounceDisabled` on both proxies.
163
- - `examples/DiceConsumer.sol` drops its `WrongFee` check and forwards `msg.value`; the coordinator ABI adds `quoteFee`, `quoteFeeAt`, `pricing`, `setPricing`, `requestFeePaid`, `requestRefundBps`, `setRefundBps`, `initialMinFee`, `fulfillRandomnessBatch` and the `PricingChanged`, `RefundBpsChanged`, `FeeOverpaymentCredited` and `FulfillmentSkipped` events; the registry ABI adds `scheduleCatalog`, `catalogHashAt`, `signersAt`, `MAX_ATTESTATION_AGE` and `CatalogScheduled`.
164
- - Deployment addresses, implementation code hashes and configuration hashes change with the testnet upgrade and the mainnet deployment; take them from the manifests, not from a 0.1.x integration.
@@ -73,6 +73,11 @@
73
73
  "name": "FailedCall",
74
74
  "type": "error"
75
75
  },
76
+ {
77
+ "inputs": [],
78
+ "name": "FallbackNotOpen",
79
+ "type": "error"
80
+ },
76
81
  {
77
82
  "inputs": [],
78
83
  "name": "InvalidConfig",
@@ -88,6 +93,11 @@
88
93
  "name": "InvalidEpoch",
89
94
  "type": "error"
90
95
  },
96
+ {
97
+ "inputs": [],
98
+ "name": "InvalidFallback",
99
+ "type": "error"
100
+ },
91
101
  {
92
102
  "inputs": [],
93
103
  "name": "InvalidInitialization",
@@ -325,6 +335,19 @@
325
335
  "stateMutability": "view",
326
336
  "type": "function"
327
337
  },
338
+ {
339
+ "inputs": [],
340
+ "name": "FALLBACK_DELAY_BLOCKS",
341
+ "outputs": [
342
+ {
343
+ "internalType": "uint64",
344
+ "name": "",
345
+ "type": "uint64"
346
+ }
347
+ ],
348
+ "stateMutability": "view",
349
+ "type": "function"
350
+ },
328
351
  {
329
352
  "inputs": [],
330
353
  "name": "MAX_ATTESTATION_AGE",
@@ -338,6 +361,19 @@
338
361
  "stateMutability": "view",
339
362
  "type": "function"
340
363
  },
364
+ {
365
+ "inputs": [],
366
+ "name": "MAX_FALLBACK_ATTEMPT",
367
+ "outputs": [
368
+ {
369
+ "internalType": "uint8",
370
+ "name": "",
371
+ "type": "uint8"
372
+ }
373
+ ],
374
+ "stateMutability": "view",
375
+ "type": "function"
376
+ },
341
377
  {
342
378
  "inputs": [],
343
379
  "name": "MAX_PACKET_BYTES",
@@ -509,6 +545,46 @@
509
545
  "stateMutability": "nonpayable",
510
546
  "type": "function"
511
547
  },
548
+ {
549
+ "inputs": [
550
+ {
551
+ "internalType": "uint64",
552
+ "name": "epochId",
553
+ "type": "uint64"
554
+ },
555
+ {
556
+ "internalType": "uint8",
557
+ "name": "attempt",
558
+ "type": "uint8"
559
+ },
560
+ {
561
+ "components": [
562
+ {
563
+ "internalType": "uint256",
564
+ "name": "timestamp",
565
+ "type": "uint256"
566
+ },
567
+ {
568
+ "internalType": "bytes",
569
+ "name": "data",
570
+ "type": "bytes"
571
+ },
572
+ {
573
+ "internalType": "bytes",
574
+ "name": "signature",
575
+ "type": "bytes"
576
+ }
577
+ ],
578
+ "internalType": "struct EpochEntropy.Attestation",
579
+ "name": "a",
580
+ "type": "tuple"
581
+ }
582
+ ],
583
+ "name": "commitEpochFallback",
584
+ "outputs": [],
585
+ "stateMutability": "nonpayable",
586
+ "type": "function"
587
+ },
512
588
  {
513
589
  "inputs": [],
514
590
  "name": "committer",
@@ -592,6 +668,30 @@
592
668
  "stateMutability": "view",
593
669
  "type": "function"
594
670
  },
671
+ {
672
+ "inputs": [
673
+ {
674
+ "internalType": "uint64",
675
+ "name": "epochId",
676
+ "type": "uint64"
677
+ },
678
+ {
679
+ "internalType": "uint8",
680
+ "name": "attempt",
681
+ "type": "uint8"
682
+ }
683
+ ],
684
+ "name": "fallbackOpensAt",
685
+ "outputs": [
686
+ {
687
+ "internalType": "uint64",
688
+ "name": "",
689
+ "type": "uint64"
690
+ }
691
+ ],
692
+ "stateMutability": "view",
693
+ "type": "function"
694
+ },
595
695
  {
596
696
  "inputs": [],
597
697
  "name": "firstEpochStart",
@@ -671,6 +771,57 @@
671
771
  "stateMutability": "view",
672
772
  "type": "function"
673
773
  },
774
+ {
775
+ "inputs": [
776
+ {
777
+ "internalType": "uint64",
778
+ "name": "epochId",
779
+ "type": "uint64"
780
+ },
781
+ {
782
+ "internalType": "uint8",
783
+ "name": "attempt",
784
+ "type": "uint8"
785
+ }
786
+ ],
787
+ "name": "getEpochFallbackSelection",
788
+ "outputs": [
789
+ {
790
+ "components": [
791
+ {
792
+ "internalType": "uint8",
793
+ "name": "source",
794
+ "type": "uint8"
795
+ },
796
+ {
797
+ "internalType": "address",
798
+ "name": "airnode",
799
+ "type": "address"
800
+ },
801
+ {
802
+ "internalType": "bytes32",
803
+ "name": "selector",
804
+ "type": "bytes32"
805
+ },
806
+ {
807
+ "internalType": "bytes32",
808
+ "name": "queryHash",
809
+ "type": "bytes32"
810
+ },
811
+ {
812
+ "internalType": "string",
813
+ "name": "canonicalRequest",
814
+ "type": "string"
815
+ }
816
+ ],
817
+ "internalType": "struct EpochEntropy.Selection",
818
+ "name": "s",
819
+ "type": "tuple"
820
+ }
821
+ ],
822
+ "stateMutability": "view",
823
+ "type": "function"
824
+ },
674
825
  {
675
826
  "inputs": [
676
827
  {
package/dist/abi.d.ts CHANGED
@@ -1919,6 +1919,10 @@ export declare const epochEntropyAbi: readonly [{
1919
1919
  readonly inputs: readonly [];
1920
1920
  readonly name: "FailedCall";
1921
1921
  readonly type: "error";
1922
+ }, {
1923
+ readonly inputs: readonly [];
1924
+ readonly name: "FallbackNotOpen";
1925
+ readonly type: "error";
1922
1926
  }, {
1923
1927
  readonly inputs: readonly [];
1924
1928
  readonly name: "InvalidConfig";
@@ -1931,6 +1935,10 @@ export declare const epochEntropyAbi: readonly [{
1931
1935
  readonly inputs: readonly [];
1932
1936
  readonly name: "InvalidEpoch";
1933
1937
  readonly type: "error";
1938
+ }, {
1939
+ readonly inputs: readonly [];
1940
+ readonly name: "InvalidFallback";
1941
+ readonly type: "error";
1934
1942
  }, {
1935
1943
  readonly inputs: readonly [];
1936
1944
  readonly name: "InvalidInitialization";
@@ -2116,6 +2124,16 @@ export declare const epochEntropyAbi: readonly [{
2116
2124
  }];
2117
2125
  readonly stateMutability: "view";
2118
2126
  readonly type: "function";
2127
+ }, {
2128
+ readonly inputs: readonly [];
2129
+ readonly name: "FALLBACK_DELAY_BLOCKS";
2130
+ readonly outputs: readonly [{
2131
+ readonly internalType: "uint64";
2132
+ readonly name: "";
2133
+ readonly type: "uint64";
2134
+ }];
2135
+ readonly stateMutability: "view";
2136
+ readonly type: "function";
2119
2137
  }, {
2120
2138
  readonly inputs: readonly [];
2121
2139
  readonly name: "MAX_ATTESTATION_AGE";
@@ -2126,6 +2144,16 @@ export declare const epochEntropyAbi: readonly [{
2126
2144
  }];
2127
2145
  readonly stateMutability: "view";
2128
2146
  readonly type: "function";
2147
+ }, {
2148
+ readonly inputs: readonly [];
2149
+ readonly name: "MAX_FALLBACK_ATTEMPT";
2150
+ readonly outputs: readonly [{
2151
+ readonly internalType: "uint8";
2152
+ readonly name: "";
2153
+ readonly type: "uint8";
2154
+ }];
2155
+ readonly stateMutability: "view";
2156
+ readonly type: "function";
2129
2157
  }, {
2130
2158
  readonly inputs: readonly [];
2131
2159
  readonly name: "MAX_PACKET_BYTES";
@@ -2257,6 +2285,37 @@ export declare const epochEntropyAbi: readonly [{
2257
2285
  readonly outputs: readonly [];
2258
2286
  readonly stateMutability: "nonpayable";
2259
2287
  readonly type: "function";
2288
+ }, {
2289
+ readonly inputs: readonly [{
2290
+ readonly internalType: "uint64";
2291
+ readonly name: "epochId";
2292
+ readonly type: "uint64";
2293
+ }, {
2294
+ readonly internalType: "uint8";
2295
+ readonly name: "attempt";
2296
+ readonly type: "uint8";
2297
+ }, {
2298
+ readonly components: readonly [{
2299
+ readonly internalType: "uint256";
2300
+ readonly name: "timestamp";
2301
+ readonly type: "uint256";
2302
+ }, {
2303
+ readonly internalType: "bytes";
2304
+ readonly name: "data";
2305
+ readonly type: "bytes";
2306
+ }, {
2307
+ readonly internalType: "bytes";
2308
+ readonly name: "signature";
2309
+ readonly type: "bytes";
2310
+ }];
2311
+ readonly internalType: "struct EpochEntropy.Attestation";
2312
+ readonly name: "a";
2313
+ readonly type: "tuple";
2314
+ }];
2315
+ readonly name: "commitEpochFallback";
2316
+ readonly outputs: readonly [];
2317
+ readonly stateMutability: "nonpayable";
2318
+ readonly type: "function";
2260
2319
  }, {
2261
2320
  readonly inputs: readonly [];
2262
2321
  readonly name: "committer";
@@ -2319,6 +2378,24 @@ export declare const epochEntropyAbi: readonly [{
2319
2378
  }];
2320
2379
  readonly stateMutability: "view";
2321
2380
  readonly type: "function";
2381
+ }, {
2382
+ readonly inputs: readonly [{
2383
+ readonly internalType: "uint64";
2384
+ readonly name: "epochId";
2385
+ readonly type: "uint64";
2386
+ }, {
2387
+ readonly internalType: "uint8";
2388
+ readonly name: "attempt";
2389
+ readonly type: "uint8";
2390
+ }];
2391
+ readonly name: "fallbackOpensAt";
2392
+ readonly outputs: readonly [{
2393
+ readonly internalType: "uint64";
2394
+ readonly name: "";
2395
+ readonly type: "uint64";
2396
+ }];
2397
+ readonly stateMutability: "view";
2398
+ readonly type: "function";
2322
2399
  }, {
2323
2400
  readonly inputs: readonly [];
2324
2401
  readonly name: "firstEpochStart";
@@ -2380,6 +2457,45 @@ export declare const epochEntropyAbi: readonly [{
2380
2457
  }];
2381
2458
  readonly stateMutability: "view";
2382
2459
  readonly type: "function";
2460
+ }, {
2461
+ readonly inputs: readonly [{
2462
+ readonly internalType: "uint64";
2463
+ readonly name: "epochId";
2464
+ readonly type: "uint64";
2465
+ }, {
2466
+ readonly internalType: "uint8";
2467
+ readonly name: "attempt";
2468
+ readonly type: "uint8";
2469
+ }];
2470
+ readonly name: "getEpochFallbackSelection";
2471
+ readonly outputs: readonly [{
2472
+ readonly components: readonly [{
2473
+ readonly internalType: "uint8";
2474
+ readonly name: "source";
2475
+ readonly type: "uint8";
2476
+ }, {
2477
+ readonly internalType: "address";
2478
+ readonly name: "airnode";
2479
+ readonly type: "address";
2480
+ }, {
2481
+ readonly internalType: "bytes32";
2482
+ readonly name: "selector";
2483
+ readonly type: "bytes32";
2484
+ }, {
2485
+ readonly internalType: "bytes32";
2486
+ readonly name: "queryHash";
2487
+ readonly type: "bytes32";
2488
+ }, {
2489
+ readonly internalType: "string";
2490
+ readonly name: "canonicalRequest";
2491
+ readonly type: "string";
2492
+ }];
2493
+ readonly internalType: "struct EpochEntropy.Selection";
2494
+ readonly name: "s";
2495
+ readonly type: "tuple";
2496
+ }];
2497
+ readonly stateMutability: "view";
2498
+ readonly type: "function";
2383
2499
  }, {
2384
2500
  readonly inputs: readonly [{
2385
2501
  readonly internalType: "uint64";
package/dist/abi.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated from canonical protocol sources with solc 0.8.28+commit.7893614a.Emscripten.clang.
2
2
  export const coordinatorAbi = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "AlreadyDelivered", "type": "error" }, { "inputs": [], "name": "AlreadyFulfilled", "type": "error" }, { "inputs": [], "name": "BlockHashUnavailable", "type": "error" }, { "inputs": [], "name": "ContractConsumerRequired", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "EpochUnavailable", "type": "error" }, { "inputs": [], "name": "EvidencePacketTooLarge", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "FeeOverflow", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "expected", "type": "uint256" }, { "internalType": "uint256", "name": "actual", "type": "uint256" }], "name": "IncorrectFee", "type": "error" }, { "inputs": [], "name": "InsufficientCallbackGas", "type": "error" }, { "inputs": [], "name": "InvalidBatch", "type": "error" }, { "inputs": [], "name": "InvalidCallbackGas", "type": "error" }, { "inputs": [], "name": "InvalidConfig", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "InvalidMapping", "type": "error" }, { "inputs": [], "name": "InvalidPublicKey", "type": "error" }, { "inputs": [], "name": "InvalidRefundAddress", "type": "error" }, { "inputs": [], "name": "InvalidScan", "type": "error" }, { "inputs": [], "name": "NoKeeperCredit", "type": "error" }, { "inputs": [], "name": "NoRefundCredit", "type": "error" }, { "inputs": [], "name": "NotFulfilled", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "NotReady", "type": "error" }, { "inputs": [], "name": "NotRefunded", "type": "error" }, { "inputs": [], "name": "OnlyFeeRecipient", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "inputs": [], "name": "ReentrancyGuardReentrantCall", "type": "error" }, { "inputs": [], "name": "RefundCallbackAlreadyDelivered", "type": "error" }, { "inputs": [], "name": "RefundNotAvailable", "type": "error" }, { "inputs": [], "name": "RenounceDisabled", "type": "error" }, { "inputs": [], "name": "RequestExpired", "type": "error" }, { "inputs": [], "name": "RequestRefunded", "type": "error" }, { "inputs": [], "name": "TransferFailed", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "inputs": [], "name": "UnknownRequest", "type": "error" }, { "inputs": [], "name": "WrongPublicKey", "type": "error" }, { "inputs": [], "name": "WrongSeed", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": false, "internalType": "uint64", "name": "targetBlock", "type": "uint64" }, { "indexed": false, "internalType": "bytes32", "name": "blockHash", "type": "bytes32" }], "name": "BlockHashStored", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "success", "type": "bool" }, { "indexed": false, "internalType": "uint32", "name": "gasLimit", "type": "uint32" }], "name": "CallbackAttempted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "refundAddress", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "FeeOverpaymentCredited", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousRecipient", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newRecipient", "type": "address" }], "name": "FeeRecipientChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "FeesWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "bytes32", "name": "transcriptHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes", "name": "packet", "type": "bytes" }], "name": "FulfillmentEvidence", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": false, "internalType": "uint8", "name": "reason", "type": "uint8" }], "name": "FulfillmentSkipped", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "keeper", "type": "address" }, { "indexed": true, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "KeeperCreditWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint16", "name": "previousBps", "type": "uint16" }, { "indexed": false, "internalType": "uint16", "name": "newBps", "type": "uint16" }], "name": "KeeperFeeBpsChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "keeper", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "paid", "type": "bool" }], "name": "KeeperFeePaid", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "bytes32", "name": "mappingHash", "type": "bytes32" }, { "components": [{ "internalType": "enum RandomnessMapping.Operation", "name": "operation", "type": "uint8" }, { "internalType": "uint256", "name": "lower", "type": "uint256" }, { "internalType": "uint256", "name": "upper", "type": "uint256" }, { "internalType": "uint32", "name": "count", "type": "uint32" }, { "internalType": "uint32", "name": "population", "type": "uint32" }], "indexed": false, "internalType": "struct RandomnessMapping.Spec", "name": "spec", "type": "tuple" }], "name": "MappingRequested", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferStarted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint256", "name": "minFee", "type": "uint256" }, { "indexed": false, "internalType": "uint16", "name": "feeMultiplier", "type": "uint16" }, { "indexed": false, "internalType": "uint32", "name": "fulfillGasOverhead", "type": "uint32" }], "name": "PricingChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "bytes32", "name": "keyHash", "type": "bytes32" }, { "indexed": false, "internalType": "uint256", "name": "seed", "type": "uint256" }, { "indexed": false, "internalType": "bytes32", "name": "proofHash", "type": "bytes32" }], "name": "ProofVerified", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": false, "internalType": "bytes32", "name": "randomness", "type": "bytes32" }, { "indexed": true, "internalType": "address", "name": "submitter", "type": "address" }], "name": "RandomnessFulfilled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "consumer", "type": "address" }, { "indexed": true, "internalType": "bytes32", "name": "keyHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes32", "name": "clientSeed", "type": "bytes32" }, { "indexed": false, "internalType": "uint64", "name": "requestBlock", "type": "uint64" }, { "indexed": false, "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "indexed": false, "internalType": "uint256", "name": "feePaid", "type": "uint256" }, { "indexed": false, "internalType": "address", "name": "refundAddress", "type": "address" }, { "indexed": false, "internalType": "uint64", "name": "deadline", "type": "uint64" }], "name": "RandomnessRequested", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint16", "name": "previousBps", "type": "uint16" }, { "indexed": false, "internalType": "uint16", "name": "newBps", "type": "uint16" }], "name": "RefundBpsChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "consumer", "type": "address" }, { "indexed": false, "internalType": "bool", "name": "success", "type": "bool" }, { "indexed": false, "internalType": "uint32", "name": "gasLimit", "type": "uint32" }], "name": "RefundCallbackAttempted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "recipient", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], "name": "RefundCreditWithdrawn", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "address", "name": "refundAddress", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, { "indexed": false, "internalType": "bool", "name": "paid", "type": "bool" }], "name": "RequestRefundedTo", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "indexed": true, "internalType": "uint256", "name": "serveIndex", "type": "uint256" }], "name": "RequestServed", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "CONFIG_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_CALLBACK_GAS", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_EVIDENCE_PACKET_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_FEE_MULTIPLIER", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_FULFILL_BATCH", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_FULFILL_GAS_OVERHEAD", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_MIN_FEE", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MIN_CALLBACK_GAS", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MIN_FULFILL_GAS_OVERHEAD", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MIN_REFUND_BPS", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "REFUND_CALLBACK_GAS", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "RESPONSE_TIMEOUT", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SEED_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "TRANSCRIPT_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "confirmationBlocks", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "earnedFees", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "epochRegistry", "outputs": [{ "internalType": "contract EpochEntropy", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "feeMultiplier", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "feeRecipient", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "fulfillGasOverhead", "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "components": [{ "internalType": "uint256[2]", "name": "pk", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "gamma", "type": "uint256[2]" }, { "internalType": "uint256", "name": "c", "type": "uint256" }, { "internalType": "uint256", "name": "s", "type": "uint256" }, { "internalType": "uint256", "name": "seed", "type": "uint256" }, { "internalType": "address", "name": "uWitness", "type": "address" }, { "internalType": "uint256[2]", "name": "cGammaWitness", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "sHashWitness", "type": "uint256[2]" }, { "internalType": "uint256", "name": "zInv", "type": "uint256" }], "internalType": "struct VRF.Proof", "name": "proof", "type": "tuple" }], "name": "fulfillRandomness", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, { "components": [{ "internalType": "uint256[2]", "name": "pk", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "gamma", "type": "uint256[2]" }, { "internalType": "uint256", "name": "c", "type": "uint256" }, { "internalType": "uint256", "name": "s", "type": "uint256" }, { "internalType": "uint256", "name": "seed", "type": "uint256" }, { "internalType": "address", "name": "uWitness", "type": "address" }, { "internalType": "uint256[2]", "name": "cGammaWitness", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "sHashWitness", "type": "uint256[2]" }, { "internalType": "uint256", "name": "zInv", "type": "uint256" }], "internalType": "struct VRF.Proof[]", "name": "proofs", "type": "tuple[]" }], "name": "fulfillRandomnessBatch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "getMappedResult", "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "getMapping", "outputs": [{ "components": [{ "internalType": "enum RandomnessMapping.Operation", "name": "operation", "type": "uint8" }, { "internalType": "uint256", "name": "lower", "type": "uint256" }, { "internalType": "uint256", "name": "upper", "type": "uint256" }, { "internalType": "uint32", "name": "count", "type": "uint32" }, { "internalType": "uint32", "name": "population", "type": "uint32" }], "internalType": "struct RandomnessMapping.Spec", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "fromId", "type": "uint256" }, { "internalType": "uint256", "name": "limit", "type": "uint256" }], "name": "getPendingRequestIds", "outputs": [{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }, { "internalType": "uint256", "name": "nextCursor", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "getProofContext", "outputs": [{ "internalType": "uint256", "name": "seed", "type": "uint256" }, { "internalType": "uint64", "name": "deadline", "type": "uint64" }, { "internalType": "bool", "name": "fulfilled", "type": "bool" }, { "internalType": "bool", "name": "refunded", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "getRequest", "outputs": [{ "components": [{ "internalType": "address", "name": "consumer", "type": "address" }, { "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "internalType": "uint64", "name": "requestBlock", "type": "uint64" }, { "internalType": "uint64", "name": "targetBlock", "type": "uint64" }, { "internalType": "uint64", "name": "deadline", "type": "uint64" }, { "internalType": "address", "name": "refundAddress", "type": "address" }, { "internalType": "bytes32", "name": "clientSeed", "type": "bytes32" }, { "internalType": "bytes32", "name": "mappingHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "blockHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "randomness", "type": "bytes32" }, { "internalType": "bytes32", "name": "proofHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "transcriptHash", "type": "bytes32" }, { "internalType": "bool", "name": "fulfilled", "type": "bool" }, { "internalType": "bool", "name": "delivered", "type": "bool" }, { "internalType": "bool", "name": "refunded", "type": "bool" }, { "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }], "internalType": "struct D20VRFCoordinator.Request", "name": "result", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "initialFeeRecipient", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "initialMinFee", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256[2]", "name": "publicKey", "type": "uint256[2]" }, { "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "fee", "type": "uint256" }, { "internalType": "uint16", "name": "confirmations", "type": "uint16" }, { "internalType": "contract EpochEntropy", "name": "registry", "type": "address" }, { "internalType": "uint16", "name": "keeperBps", "type": "uint16" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "keeperCredits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "keeperFeeBps", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "keyHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastServedIndex", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "lastServedRequestId", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "randomness", "type": "bytes32" }, { "components": [{ "internalType": "enum RandomnessMapping.Operation", "name": "operation", "type": "uint8" }, { "internalType": "uint256", "name": "lower", "type": "uint256" }, { "internalType": "uint256", "name": "upper", "type": "uint256" }, { "internalType": "uint32", "name": "count", "type": "uint32" }, { "internalType": "uint32", "name": "population", "type": "uint32" }], "internalType": "struct RandomnessMapping.Spec", "name": "spec", "type": "tuple" }], "name": "mapRandomness", "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], "stateMutability": "pure", "type": "function" }, { "inputs": [], "name": "minFee", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "nextRequestId", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingOwner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pricing", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "uint16", "name": "", "type": "uint16" }, { "internalType": "uint32", "name": "", "type": "uint32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "protocolConfigurationHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "publicKeyX", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "publicKeyY", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }], "name": "quoteFee", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "internalType": "uint256", "name": "baseFee", "type": "uint256" }], "name": "quoteFeeAt", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "refundBps", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "refundCallbackDelivered", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "refundCredits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "refundRequest", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "requestFeePaid", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "clientSeed", "type": "bytes32" }, { "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "internalType": "address", "name": "_refundAddress", "type": "address" }, { "components": [{ "internalType": "enum RandomnessMapping.Operation", "name": "operation", "type": "uint8" }, { "internalType": "uint256", "name": "lower", "type": "uint256" }, { "internalType": "uint256", "name": "upper", "type": "uint256" }, { "internalType": "uint32", "name": "count", "type": "uint32" }, { "internalType": "uint32", "name": "population", "type": "uint32" }], "internalType": "struct RandomnessMapping.Spec", "name": "spec", "type": "tuple" }], "name": "requestMappedRandomness", "outputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "bytes32", "name": "clientSeed", "type": "bytes32" }, { "internalType": "uint32", "name": "callbackGasLimit", "type": "uint32" }, { "internalType": "address", "name": "_refundAddress", "type": "address" }], "name": "requestRandomness", "outputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "requestRefundBps", "outputs": [{ "internalType": "uint16", "name": "", "type": "uint16" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "requestSeed", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "internalType": "uint32", "name": "gasLimit", "type": "uint32" }], "name": "retryCallback", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "internalType": "uint32", "name": "gasLimit", "type": "uint32" }], "name": "retryRefundCallback", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "servedRequestAt", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "next", "type": "address" }], "name": "setFeeRecipient", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint16", "name": "next", "type": "uint16" }], "name": "setKeeperFeeBps", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "nextMinFee", "type": "uint256" }, { "internalType": "uint16", "name": "multiplier", "type": "uint16" }, { "internalType": "uint32", "name": "overhead", "type": "uint32" }], "name": "setPricing", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint16", "name": "next", "type": "uint16" }], "name": "setRefundBps", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }], "name": "storeBlockHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "totalKeeperCredits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "totalRefundCredits", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "requestId", "type": "uint256" }, { "components": [{ "internalType": "uint256[2]", "name": "pk", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "gamma", "type": "uint256[2]" }, { "internalType": "uint256", "name": "c", "type": "uint256" }, { "internalType": "uint256", "name": "s", "type": "uint256" }, { "internalType": "uint256", "name": "seed", "type": "uint256" }, { "internalType": "address", "name": "uWitness", "type": "address" }, { "internalType": "uint256[2]", "name": "cGammaWitness", "type": "uint256[2]" }, { "internalType": "uint256[2]", "name": "sHashWitness", "type": "uint256[2]" }, { "internalType": "uint256", "name": "zInv", "type": "uint256" }], "internalType": "struct VRF.Proof", "name": "proof", "type": "tuple" }], "name": "verifyRequestProof", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address payable", "name": "recipient", "type": "address" }], "name": "withdrawFees", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address payable", "name": "recipient", "type": "address" }], "name": "withdrawKeeperCredit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address payable", "name": "recipient", "type": "address" }], "name": "withdrawRefundCredit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }];
3
- export const epochEntropyAbi = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "AlreadyCommitted", "type": "error" }, { "inputs": [], "name": "AnchorUnavailable", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "InvalidConfig", "type": "error" }, { "inputs": [], "name": "InvalidData", "type": "error" }, { "inputs": [], "name": "InvalidEpoch", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "InvalidSigner", "type": "error" }, { "inputs": [], "name": "InvalidTime", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "OnlyCommitter", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "inputs": [], "name": "PacketTooLarge", "type": "error" }, { "inputs": [], "name": "PreparationClosed", "type": "error" }, { "inputs": [], "name": "RenounceDisabled", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint64", "name": "fromEpoch", "type": "uint64" }, { "indexed": true, "internalType": "bytes32", "name": "catalogHash", "type": "bytes32" }, { "indexed": false, "internalType": "address[4]", "name": "signers", "type": "address[4]" }], "name": "CatalogScheduled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousCommitter", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newCommitter", "type": "address" }], "name": "CommitterChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "indexed": true, "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes", "name": "packet", "type": "bytes" }], "name": "EpochCommitted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferStarted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "EPOCH_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "EPOCH_LENGTH", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_ATTESTATION_AGE", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_PACKET_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "RECIPE_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SELECT_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "anuSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "btcTradeSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "catalogHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "catalogHashAt", "outputs": [{ "internalType": "bytes32", "name": "hash", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "checkpointEpoch", "outputs": [{ "internalType": "bytes32", "name": "anchor", "type": "bytes32" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "components": [{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "internalType": "struct EpochEntropy.Attestation", "name": "a", "type": "tuple" }], "name": "commitEpoch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "committer", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "name": "epochAnchors", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], "name": "epochForBlock", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "epochStart", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ethTradeSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "firstEpochStart", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "getEpoch", "outputs": [{ "components": [{ "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "catalogHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "anchorHash", "type": "bytes32" }, { "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "dataHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "attestationHash", "type": "bytes32" }, { "internalType": "uint256", "name": "signedAt", "type": "uint256" }, { "internalType": "uint64", "name": "committedBlock", "type": "uint64" }], "internalType": "struct EpochEntropy.Epoch", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "getEpochSelection", "outputs": [{ "components": [{ "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "address", "name": "airnode", "type": "address" }, { "internalType": "bytes32", "name": "selector", "type": "bytes32" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "string", "name": "canonicalRequest", "type": "string" }], "internalType": "struct EpochEntropy.Selection", "name": "s", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "hyperliquidSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }, { "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "address", "name": "initialCommitter", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], "name": "nextEpochToPrepare", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingOwner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }, { "internalType": "uint64", "name": "fromEpoch", "type": "uint64" }], "name": "scheduleCatalog", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "next", "type": "address" }], "name": "setCommitter", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "signersAt", "outputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }];
3
+ export const epochEntropyAbi = [{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [{ "internalType": "address", "name": "target", "type": "address" }], "name": "AddressEmptyCode", "type": "error" }, { "inputs": [], "name": "AlreadyCommitted", "type": "error" }, { "inputs": [], "name": "AnchorUnavailable", "type": "error" }, { "inputs": [], "name": "ECDSAInvalidSignature", "type": "error" }, { "inputs": [{ "internalType": "uint256", "name": "length", "type": "uint256" }], "name": "ECDSAInvalidSignatureLength", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "s", "type": "bytes32" }], "name": "ECDSAInvalidSignatureS", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "implementation", "type": "address" }], "name": "ERC1967InvalidImplementation", "type": "error" }, { "inputs": [], "name": "ERC1967NonPayable", "type": "error" }, { "inputs": [], "name": "FailedCall", "type": "error" }, { "inputs": [], "name": "FallbackNotOpen", "type": "error" }, { "inputs": [], "name": "InvalidConfig", "type": "error" }, { "inputs": [], "name": "InvalidData", "type": "error" }, { "inputs": [], "name": "InvalidEpoch", "type": "error" }, { "inputs": [], "name": "InvalidFallback", "type": "error" }, { "inputs": [], "name": "InvalidInitialization", "type": "error" }, { "inputs": [], "name": "InvalidSigner", "type": "error" }, { "inputs": [], "name": "InvalidTime", "type": "error" }, { "inputs": [], "name": "NotInitializing", "type": "error" }, { "inputs": [], "name": "OnlyCommitter", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "owner", "type": "address" }], "name": "OwnableInvalidOwner", "type": "error" }, { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "OwnableUnauthorizedAccount", "type": "error" }, { "inputs": [], "name": "PacketTooLarge", "type": "error" }, { "inputs": [], "name": "PreparationClosed", "type": "error" }, { "inputs": [], "name": "RenounceDisabled", "type": "error" }, { "inputs": [], "name": "UUPSUnauthorizedCallContext", "type": "error" }, { "inputs": [{ "internalType": "bytes32", "name": "slot", "type": "bytes32" }], "name": "UUPSUnsupportedProxiableUUID", "type": "error" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint64", "name": "fromEpoch", "type": "uint64" }, { "indexed": true, "internalType": "bytes32", "name": "catalogHash", "type": "bytes32" }, { "indexed": false, "internalType": "address[4]", "name": "signers", "type": "address[4]" }], "name": "CatalogScheduled", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousCommitter", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newCommitter", "type": "address" }], "name": "CommitterChanged", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "indexed": true, "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }, { "indexed": false, "internalType": "bytes", "name": "packet", "type": "bytes" }], "name": "EpochCommitted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": false, "internalType": "uint64", "name": "version", "type": "uint64" }], "name": "Initialized", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferStarted", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" }], "name": "OwnershipTransferred", "type": "event" }, { "anonymous": false, "inputs": [{ "indexed": true, "internalType": "address", "name": "implementation", "type": "address" }], "name": "Upgraded", "type": "event" }, { "inputs": [], "name": "EPOCH_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "EPOCH_LENGTH", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "FALLBACK_DELAY_BLOCKS", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_ATTESTATION_AGE", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_FALLBACK_ATTEMPT", "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "MAX_PACKET_BYTES", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "RECIPE_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "SELECT_DOMAIN", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "UPGRADE_INTERFACE_VERSION", "outputs": [{ "internalType": "string", "name": "", "type": "string" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "acceptOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "anuSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "btcTradeSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "catalogHash", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "catalogHashAt", "outputs": [{ "internalType": "bytes32", "name": "hash", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "checkpointEpoch", "outputs": [{ "internalType": "bytes32", "name": "anchor", "type": "bytes32" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "components": [{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "internalType": "struct EpochEntropy.Attestation", "name": "a", "type": "tuple" }], "name": "commitEpoch", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }, { "components": [{ "internalType": "uint256", "name": "timestamp", "type": "uint256" }, { "internalType": "bytes", "name": "data", "type": "bytes" }, { "internalType": "bytes", "name": "signature", "type": "bytes" }], "internalType": "struct EpochEntropy.Attestation", "name": "a", "type": "tuple" }], "name": "commitEpochFallback", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "committer", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "name": "epochAnchors", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], "name": "epochForBlock", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "epochStart", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "ethTradeSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }], "name": "fallbackOpensAt", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "firstEpochStart", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "getEpoch", "outputs": [{ "components": [{ "internalType": "bytes32", "name": "epochHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "catalogHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "anchorHash", "type": "bytes32" }, { "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "dataHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "attestationHash", "type": "bytes32" }, { "internalType": "uint256", "name": "signedAt", "type": "uint256" }, { "internalType": "uint64", "name": "committedBlock", "type": "uint64" }], "internalType": "struct EpochEntropy.Epoch", "name": "", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }, { "internalType": "uint8", "name": "attempt", "type": "uint8" }], "name": "getEpochFallbackSelection", "outputs": [{ "components": [{ "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "address", "name": "airnode", "type": "address" }, { "internalType": "bytes32", "name": "selector", "type": "bytes32" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "string", "name": "canonicalRequest", "type": "string" }], "internalType": "struct EpochEntropy.Selection", "name": "s", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "getEpochSelection", "outputs": [{ "components": [{ "internalType": "uint8", "name": "source", "type": "uint8" }, { "internalType": "address", "name": "airnode", "type": "address" }, { "internalType": "bytes32", "name": "selector", "type": "bytes32" }, { "internalType": "bytes32", "name": "queryHash", "type": "bytes32" }, { "internalType": "string", "name": "canonicalRequest", "type": "string" }], "internalType": "struct EpochEntropy.Selection", "name": "s", "type": "tuple" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "hyperliquidSigner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }, { "internalType": "address", "name": "initialOwner", "type": "address" }, { "internalType": "address", "name": "initialCommitter", "type": "address" }], "name": "initialize", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint256", "name": "number", "type": "uint256" }], "name": "nextEpochToPrepare", "outputs": [{ "internalType": "uint64", "name": "", "type": "uint64" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "owner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "pendingOwner", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxiableUUID", "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }, { "internalType": "uint64", "name": "fromEpoch", "type": "uint64" }], "name": "scheduleCatalog", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "next", "type": "address" }], "name": "setCommitter", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "uint64", "name": "epochId", "type": "uint64" }], "name": "signersAt", "outputs": [{ "internalType": "address[4]", "name": "signers", "type": "address[4]" }], "stateMutability": "view", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], "name": "transferOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [{ "internalType": "address", "name": "newImplementation", "type": "address" }, { "internalType": "bytes", "name": "data", "type": "bytes" }], "name": "upgradeToAndCall", "outputs": [], "stateMutability": "payable", "type": "function" }];
package/dist/epoch.d.ts CHANGED
@@ -35,8 +35,11 @@ export interface EpochProtocolConfiguration {
35
35
  export declare function epochCatalogHash(signers: EpochSigners): string;
36
36
  export declare function epochStart(firstEpochStart: bigint, epochId: bigint): bigint;
37
37
  export declare function epochForBlock(firstEpochStart: bigint, block: bigint): bigint;
38
- export declare function selectEpoch(catalog: EpochCatalog, epochId: bigint, anchorHash: string): {
38
+ export declare const FALLBACK_DELAY_BLOCKS = 20n, MAX_FALLBACK_ATTEMPT = 3;
39
+ export declare function fallbackOpensAt(firstEpochStart: bigint, epochId: bigint, attempt: number): bigint;
40
+ export declare function selectEpoch(catalog: EpochCatalog, epochId: bigint, anchorHash: string, attempt?: number): {
39
41
  source: number;
42
+ attempt: number;
40
43
  airnode: string;
41
44
  selector: string;
42
45
  canonicalRequest: string;
@@ -103,6 +106,7 @@ export declare function replayEpochCommitment(input: {
103
106
  epochHash: string;
104
107
  selected: {
105
108
  source: number;
109
+ attempt: number;
106
110
  airnode: string;
107
111
  selector: string;
108
112
  canonicalRequest: string;
package/dist/epoch.js CHANGED
@@ -15,17 +15,26 @@ export function epochStart(firstEpochStart, epochId) {
15
15
  return firstEpochStart + (epochId - 1n) * EPOCH_LENGTH;
16
16
  }
17
17
  export function epochForBlock(firstEpochStart, block) { return block < firstEpochStart ? 0n : 1n + (block - firstEpochStart) / EPOCH_LENGTH; }
18
- export function selectEpoch(catalog, epochId, anchorHash) {
18
+ /// A fallback attempt n uses the source n slots after the selected one, from n × FALLBACK_DELAY_BLOCKS into the epoch.
19
+ export const FALLBACK_DELAY_BLOCKS = 20n, MAX_FALLBACK_ATTEMPT = 3;
20
+ export function fallbackOpensAt(firstEpochStart, epochId, attempt) {
21
+ if (!Number.isInteger(attempt) || attempt < 0 || attempt > MAX_FALLBACK_ATTEMPT)
22
+ throw new Error("Invalid fallback attempt");
23
+ return epochStart(firstEpochStart, epochId) + BigInt(attempt) * FALLBACK_DELAY_BLOCKS;
24
+ }
25
+ export function selectEpoch(catalog, epochId, anchorHash, attempt = 0) {
19
26
  if (epochId < 1n || BigInt(anchorHash) === 0n)
20
27
  throw new Error("Invalid epoch anchor");
28
+ if (!Number.isInteger(attempt) || attempt < 0 || attempt > MAX_FALLBACK_ATTEMPT)
29
+ throw new Error("Invalid fallback attempt");
21
30
  const catalogHash = epochCatalogHash(catalog.signers);
22
31
  const selector = keccak256(abi.encode(["bytes32", "bytes32", "uint64", "bytes32"], [id("D20_EPOCH_SELECT"), catalogHash, epochId, anchorHash]));
23
- const source = Number(BigInt(selector) % 4n);
32
+ const source = (Number(BigInt(selector) % 4n) + attempt) % 4;
24
33
  const request = source === 0 ? { operation: "metaAndAssetCtxs", parameters: { dex: "" }, responseProjection: { symbol: "/0/universe/0/name", value: "/1/0/dayNtlVlm" } }
25
34
  : source === 1 ? { operation: "randomNumbers", parameters: { type: "hex8", length: 4, size: 8 } }
26
35
  : { operation: "lastTrade", parameters: { assetClass: "crypto", symbol: source === 2 ? "BTCUSD" : "ETHUSD" } };
27
36
  const canonicalRequest = canonicalApiRequest(request);
28
- return { source, airnode: catalog.signers[source], selector, canonicalRequest, queryHash: keccak256(toUtf8Bytes(canonicalRequest)), request };
37
+ return { source, attempt, airnode: catalog.signers[source], selector, canonicalRequest, queryHash: keccak256(toUtf8Bytes(canonicalRequest)), request };
29
38
  }
30
39
  export function verifyEpochAttestation(selected, a, commitTimestamp) {
31
40
  validateApiSignatureEncoding(a.signature);
@@ -63,10 +72,12 @@ export function decodeEpochEvidencePacket(packet) {
63
72
  return { canonicalRequest: canonicalRequest, attestation };
64
73
  }
65
74
  export function replayEpochCommitment(input) {
66
- const { catalog, epochId, record } = input, start = epochStart(catalog.firstEpochStart, epochId);
67
- if (record.committedBlock < start)
75
+ const { catalog, epochId, record } = input;
76
+ // The committed source fixes the attempt; a fallback is valid only if it was committed after its window opened.
77
+ const attempt = (Number(record.source) - selectEpoch(catalog, epochId, record.anchorHash).source + 4) % 4;
78
+ if (record.committedBlock < fallbackOpensAt(catalog.firstEpochStart, epochId, attempt))
68
79
  throw new Error("Invalid epoch commit block");
69
- const selected = selectEpoch(catalog, epochId, record.anchorHash), evidence = decodeEpochEvidencePacket(input.packet);
80
+ const selected = selectEpoch(catalog, epochId, record.anchorHash, attempt), evidence = decodeEpochEvidencePacket(input.packet);
70
81
  if (evidence.canonicalRequest !== selected.canonicalRequest)
71
82
  throw new Error("Epoch recipe mismatch");
72
83
  const verified = verifyEpochAttestation(selected, evidence.attestation, input.commitTimestamp);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d20dao/vrf-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "D20DAO verifiable randomness: Solidity consumer helpers, contract ABIs and public proof replay",
5
5
  "publishConfig": {
6
6
  "access": "public",