So im trying to write a smart contract that involves using Uniswap. I would like to test my smart contract and was looking into setting up uniswap on my local ganache server, but as I am new, a few things are not very clear.
I found a medium article that explained how this is done:
-Deploy the UniswapExchange contract
-Deploy the UniswapFactory contract
-Initialize the UniswapFactory (with the UniswapExchange address)
-Deploy the Dai ERC20 token contract
-Deploy the Dai UniswapExchange contract (using the Dai address)
-Approve the Dai UniswapExchange contract to transfer Dai
-Add liquidity to the Dai UniswapExchange contract
So I want to start off by deploying the uniswapexchange and uniswap factory contract. When I go to uniswapV2factory on uniswap github it has 2 import functions on the top, namely:
import './interfaces/IUniswapV2Factory.sol'; import './UniswapV2Pair.sol';
Now these point toward a folder that I do not have on my local computer. When importing the UniswapV2Factory.sol contract to my own contract, do I have to also seperately download the interface and UniswapV2Pair and put them in the folder as stated in the contract I am importing? Also, on a local ganache server the uniswap factory contract are not up, so I have to deploy them myself, but if I would deploy my contract on a testnetwork, would just using an interface and the contract address suffice. If so, what are the benefits of either importing the contract or using an interface? As fas as Im aware an interface doesnt inherit and importing does? For this reason I read that some people prefer to use a contract instead of an interface, when should I go for an interface and when should I use a contract to interact with other smart contracts?
My last question is, the UniswapV2Factory.sol contract uses solidity 0.5.16, but its written as
pragma solidity =0.5.16;
does this mean that my contract where I want to call the functions from this contract has to be written in 0.5.16 as well?
Thanks in advance!