Having trouble deploying my V2 on Base

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 snippet that you can share

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

Hey, thank you for posting.

Can you please share some logs or screenshot of the error that you received? This will help us to debug your issues fast.

1 Like

The Pyth V2 contracts just fine. I upgraded it successfully.

1 Like