Uniswap Interaction
The Swapper contract allows you to run a simple flash swap arbitrage or just a simple regular swap arbitrage between Uniswap and Sushiswap.
Table of Contents
About The Project
Built With
Getting Started
To get a local copy up and running follow these simple steps.
Installation
- Clone the repo
git clone https://github.com/0xdavinchee/uniswap-interaction.git
- Install NPM packages
npm install
- Create a
.env
file and add the two following values:
INFURA_API_KEY
: You can get this from https://infura.io by signing up for a free account.RINKEBY_PRIVATE_KEY
(if you want to deploy to testnet).ALCHEMY_MAINNET_URL
: You can get this from https://alchemyapi.io by signing up for a free account.
Usage
To compile: npx hardhat compile
.
To run tests: npx hardhat test
.
Run npx hardhat node
to start up a local node.
Open up another terminal window and run npx hardhat deploy --network localhost
to deploy your project to localhost. You can similarly deploy to other networks like so: npx hardhat deploy --network <NETWORK>
.
To execute an arbitrage you would have to open another terminal window and run npx hardhat console --network <NETWORK>
and then attach the contract and execute the desired function. This simply executes the arbitrage, but does not actually scope out profitable opportunities nor protect against frontrunning or other adversarial possibilities.
License
Distributed under the MIT License. See LICENSE
for more information.
Contact
@0xdavinchee - 0xdavinchee@gmail.com
Project Link: https://github.com/0xdavinchee/uniswap-interaction