You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/entropy/generate-random-numbers/evm.mdx
+11-2Lines changed: 11 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,7 @@ This method returns a sequence number and emits a [`RequestedWithCallback`](http
119
119
120
120
### 3. Implement callback for Entropy
121
121
122
-
```solidity {28-38} copy
122
+
```solidity {28-42} copy
123
123
pragma solidity ^0.8.0;
124
124
125
125
import { IEntropyConsumer } from "@pythnetwork/entropy-sdk-solidity/IEntropyConsumer.sol";
@@ -151,6 +151,10 @@ contract YourContract is IEntropyConsumer {
151
151
// @param provider The address of the provider that generated the random number. If your app uses multiple providers, you can use this argument to distinguish which one is calling the app back.
152
152
// @param randomNumber The generated random number.
153
153
// This method is called by the entropy contract when a random number is generated.
154
+
// This method **must** be implemented on the same contract that requested the random number.
155
+
// This method should **never** return an error -- if it returns an error, then the keeper will not be able to invoke the callback.
156
+
// If you are having problems receiving the callback, the most likely cause is that the callback is erroring.
157
+
// See the callback debugging guide here to identify the error https://docs.pyth.network/entropy/debug-callback-failures
154
158
function entropyCallback(
155
159
uint64 sequenceNumber,
156
160
address provider,
@@ -170,7 +174,12 @@ contract YourContract is IEntropyConsumer {
170
174
171
175
When the final random number is ready to use, the entropyCallback function will be called by the Entropy contract. This will happen in a separate transaction submitted by the requested provider.
172
176
173
-
**The entropyCallback function should be implemented in the same contract that is requesting the random number.**
177
+
<Callouttype="warning"emoji="⚠️">
178
+
The `entropyCallback` function should **never** return an error. If it returns
179
+
an error, the keeper will not be able to invoke the callback. If you are
180
+
having problems receiving the callback, please see [Debugging Callback
0 commit comments