Giter Site home page Giter Site logo

kmsporls / flash-swap-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuichiroaoki/flash-swap-example

0.0 0.0 0.0 156 KB

Example of Flash Swaps

Home Page: https://medium.com/coinmonks/tutorial-of-flash-swaps-of-uniswap-v3-73c0c846b822

License: MIT License

Shell 0.22% TypeScript 52.87% Solidity 46.91%

flash-swap-example's Introduction

Flash Swap Example

Example of Flash Swaps

Installation and Setup

1. Install Node.js & yarn, if you haven't already.

2. Clone This Repo

Run the following command.

git clone https://github.com/yuichiroaoki/flash-swap-example.git

Quickstart

Right now this repo only works with hardhat mainnet fork.

1. Setup Environment Variables

You'll need an ALCHEMY_MAINNET_RPC_URL environment variable. You can get one from Alchemy website for free.

Then, you can create a .env file with the following.

ALCHEMY_MAINNET_RPC_URL='<your-own-alchemy-mainnet-rpc-url>'

2. Install Dependencies

Run the following command.

yarn install

3. Compile Smart Contracts

Run the following command.

yarn compile

4. Execute Flash Swaps ๐Ÿ”ฅ

Run the following command.

yarn flashswaps

Expected Outputs

$ yarn flashswaps
yarn run v1.22.5
$ npx hardhat run scripts/flashswaps.ts
No need to generate any newer typings.
deployer's initial balance 0
deployer's ending balance 4.860772792026915
Congrats! You earned 4.860772792026915 DAI !!
Done in 40.72s.

References

PairFlash

A sample flash swap contract from Uniswap official docs.

Docs / GitHub / Test

flash-swap-example's People

Contributors

yuichiroaoki avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.