diff --git a/pages/entropy/generate-random-numbers/evm.mdx b/pages/entropy/generate-random-numbers/evm.mdx index 698ede81..a6ec0808 100644 --- a/pages/entropy/generate-random-numbers/evm.mdx +++ b/pages/entropy/generate-random-numbers/evm.mdx @@ -119,7 +119,7 @@ This method returns a sequence number and emits a [`RequestedWithCallback`](http ### 3. Implement callback for Entropy -```solidity {28-38} copy +```solidity {28-42} copy pragma solidity ^0.8.0; import { IEntropyConsumer } from "@pythnetwork/entropy-sdk-solidity/IEntropyConsumer.sol"; @@ -151,6 +151,10 @@ contract YourContract is IEntropyConsumer { // @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. // @param randomNumber The generated random number. // This method is called by the entropy contract when a random number is generated. + // This method **must** be implemented on the same contract that requested the random number. + // This method should **never** return an error -- if it returns an error, then the keeper will not be able to invoke the callback. + // If you are having problems receiving the callback, the most likely cause is that the callback is erroring. + // See the callback debugging guide here to identify the error https://docs.pyth.network/entropy/debug-callback-failures function entropyCallback( uint64 sequenceNumber, address provider, @@ -170,7 +174,12 @@ contract YourContract is IEntropyConsumer { 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. -**The entropyCallback function should be implemented in the same contract that is requesting the random number.** + + The `entropyCallback` function should **never** return an error. If it returns + an error, the keeper will not be able to invoke the callback. If you are + having problems receiving the callback, please see [Debugging Callback + Failures](/entropy/debug-callback-failures). + ## Additional Resources