0xdavinchee / uniswap-interaction

My first foray into interacting with some of Uniswap's smart contracts, the contracts in here allow naive swaps and flash swaps for arbitrage.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


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

  1. About The Project
  2. Getting Started
  3. Usage
  4. License
  5. Contact

About The Project

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Installation

  1. Clone the repo
    git clone https://github.com/0xdavinchee/uniswap-interaction.git
  2. Install NPM packages
    npm install
  3. 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

About

My first foray into interacting with some of Uniswap's smart contracts, the contracts in here allow naive swaps and flash swaps for arbitrage.


Languages

Language:Solidity 70.7%Language:TypeScript 29.3%