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.