Make sure to check the Pyth Documentation to check for guides, common errors and reference materials.
Make sure to add the following items asking for support.
- Base mainnet
- 0x075A9C4D78894B9497aFa8836CD4A70D2819EcB2
- Steps to reproduce the error
- Any
code snippetthat you can share
contract MyContract is ReentrancyGuard, IEntropyConsumer {
constructor(
address \_entropy
) {
entropy = IEntropyV2(\_entropy);
}
…rest of code….
IEntropyV2 private entropy;
…rest of code…
// Get the fee for requesting a random number (V2 returns uint128 in the SDK)
function getRequestFee() public view returns (uint256 fee\_) {
uint128 f = entropy.getFeeV2();
fee\_ = uint256(f);
}
// Callback function called by entropy with the random number
function entropyCallback(
uint64 sequenceNumber,
address /\* providerAddress \*/,
bytes32 randomNumber
) internal override {
// Convert the random number to uint256
uint256 randomValue = uint256(randomNumber);
…rest of code….
}
// Required by IEntropyConsumer interface
// Required by IEntropyConsumer interface
function getEntropy() internal view override returns (address) {
return address(entropy);
}
receive() external payable {}
function fetchEntropyData () public payable nonReentrant {
uint64 sequenceNumber = entropy.requestV2{value: \_fee}();