0

I saw a lot of tutorials on running the Rinkbey testnet injected using MetaMask on Remix to call functions such as to get conversion rates from Ether to USD using chainlink.

I would like to do so using Remix but deployed to my browser blockchain i.e. JAvaScript VM

I am following this video link where the instructor is using the Fundme() contract code available here. The instructor was using the price feed for Rinkeby testnet.

I am interested in getting his function:

  function getPrice() public view returns(uint256){
        AggregatorV3Interface priceFeed = AggregatorV3Interface(0x8A753747A1Fa494EC906cE90E9f37563A8AF630e);
        (,int256 answer,,,) = priceFeed.latestRoundData();
         return uint256(answer * 10000000000);
    }

into local enviroment in remix. Can you please help me in doing so?

What have I done so far?

I went to this page and copied the contract code to paste it into remix. However, I got an error that I was unable to deploy this contract espcially that this page has many contracts written on it.

Please let me know where to start. Many thanks in advance.

1 Answer 1

0

In Remix, the environment "Javascript VM" is a blockchain simulator which runs in memory browser. There are more information in Remix's documentation.

On the other hand, Rinkeby is a Ethereum testnet network / blockchain.

You can NOT "mix" the environments.

The smart contract FundMe.sol is interacting with contracts deployed on a network, like you can see on line #27, which is using an address already deployed.

So to use the features of the network, you need to deploy your contract on a real environment: one of the testnets or mainnets.

Other option

Maybe you would like to use the Load contract from address option in Remix.

Check this How to load contract from address- remix

3
  • thanks for trying to help. The main idea is that I want to import such deployed contact into the local Blockchain. I know it is possible to copy both bytecode and abi. These will deploy the contract to your local Blockchain which helps with interacting and testing your contact on your local machine without using pubic testnet.
    – Anonymous
    Jan 9, 2022 at 0:43
  • 1
    In your case, importing would be deploying the contract on your local network, which wouldn't help you, because there are external entities that interact with the contract and keep it up to date. Not even a network fork (where you would have all the network data up to a point in time and then only the local data) locally would help you here. Jan 10, 2022 at 3:56
  • Check the "other option" that I add in my response. Jan 10, 2022 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.