0

I had thought each contract deployment and contract address was unique on Ethereum, including across mainnet and testnets. But in the Uniswap documentation it says:

UniswapV2Factory is deployed at 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f on the Ethereum mainnet, and the Ropsten, Rinkeby, Görli, and Kovan testnets. It was built from commit 8160750.

source: https://uniswap.org/docs/v2/smart-contracts/factory/

If this is the case, how can I choose whether I am connecting to the Uniswap mainnet or testnet factory contract? I am connecting via JavaScript and Truffle as follows:

      ...
  
      const UniswapContract = contract(UniswapFactoryAbi);
      UniswapContract.setProvider(this.web3);
      UniswapContract.at('0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f').then(function(instance) {

      ... 

Thanks in advance.

1 Answer 1

1

The network you are on depends on the provider you are using. In your case, this.web3 is associated with some that network that you defined earlier in the code. If you track down what network is associated with this.web3, you will know what Uniswap contract that is referring to.

1
  • Thanks great thanks, in my case I was using metamask
    – Zakoff
    Commented Aug 16, 2020 at 20:49

Your Answer

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

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