← Developer Forum

Entropy·help question·✓ answered

Having trouble deploying my V2 on Base

Open on dev-forum →Back to forum

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.

import " openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol at master · OpenZeppelin/openzeppelin-contracts · GitHub ";

import " openzeppelin-contracts/contracts/token/ERC20/IERC20.sol at master · OpenZeppelin/openzeppelin-contracts · GitHub ";

import " pyth-crosschain/target_chains/ethereum/entropy_sdk/solidity/IEntropyV2.sol at main · pyth-network/pyth-crosschain · GitHub ";

import “pyth-crosschain/target_chains/ethereum/entropy_sdk/solidity/IEntropyConsumer.sol at main · pyth-network/pyth-crosschain · GitHub”;

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}();

Showing the original post only. Read the full thread on dev-forum.pyth.network ↗

Replies: 2
Views: 286
Likes: 2
Posted: 11/29/2025

Source: https://dev-forum.pyth.network/t/having-trouble-deploying-my-v2-on-base/479 · external id 479