In this guide we’ll walk you through the complete process of forking, adapting and redeploying Uniswap V2-core Smart Contracts. In the second half of this guide, we’ll also show you the basic steps to running a basic version of the Uniswap front end and integrating your own Smart Contracts.
Please note that if your Metamask wallet auto-locks while using the Reactor you might loose some unsaved progress. We recommend that you remove any auto-timeouts on Metamask while using the ARC Reactor
That’s it, we’ve now imported our Uniswap V2 Core contracts.
Please note that the ARC Reactor features a powerful auto-compiler. Please turn the auto compiler on for all projects in this guide.
First off you’ll change the contract's name and symbol. Thereafter you’ll add a function to grab the hash of the contract. This process will illustrate how to translate lines of code into diagrams. We do have an existing file with the INIT_CODE_HASH function added in case you’d like to skip this step. For full documentation on all functions of each diagram, please refer to our docs. https://reactor-docs.arc.market
If you’d prefer to skip this step, you can import this file and delete the existing UniswapV2 Factory: https://github.com/ARC-MARKET/arc-uniswap/blob/main/uniswap/v2-core/contracts/UniswapV2Factory.sol
That’s it! We can now use this INIT_CODE_HASH function to get our contract hash which we’ll need later on.
If the auto-compiler is turned on, your project should be compiled and as long as there are no problems in the problems tab, you can move on to the next step. Please ensure you’ve enabled optimizations and set the optimizations value to 1.
If your auto-compiler is turned off, navigate to the compiler tab and select the Uniswap V2 Factory contract and click on ‘Compile’. If there are no problems in the problems tab, you can move on to the next step.
If you there are problems in the problems tab, please refer to your guide on how to debug problems: https://ip.arc-reactor.com/guides/workflow#identify
It will look something like this:
As we did with UniswapV2-core, we’ll import the UniswapV2 Periphery to our existing “@uniswap” folder.
It will look something like this:
We’ll only edit one value in the contract file and then move onto the deployment. In order to deploy these contracts we’ll need to use a few of the values we copied from the Factory deployment.
We’re now ready to move onto the deployment. First make sure all your files are saved and then open the compiler tab. Making sure auto-compile is set to true, compile the UniswapV2Library.sol contract and the UniswapV2Router02.sol contract.
Once these contracts are compiled without any problems, you should be able to move onto the Run tab.
That’s it, we can now test our new Uniswap contracts from the sidebar on the Run tab. Each of these buttons correlate to a function within the contract.
Taking this further, you can hook up these new contracts you created to the Uniswap UI. We’ve compiled this UI from sources around the web however since this is not a smart contract nor will it use the ARC Reactor (nor was it created by the ARC Team), the scope is a bit broad for the purposes of this guide.
If you’d like to use the UI to connect your new contracts to and test your Uniswap live, please refer to these files: http://bit.ly/3XmWIIF
To run the UI, use npm run, and to create a build config, use npm build.
Please remember that if you’re facing any bugs or errors, our support team is here to help! Simply leave a message in the #beta-testing channel on our discord server and a member of staff will be happy to help.