Coder Social home page Coder Social logo

rubyredmoon / flashloan-arbitrage-money-legos Goto Github PK

View Code? Open in Web Editor NEW

This project forked from devbootstrap/flashloan-arbitrage-money-legos

0.0 0.0 0.0 67 KB

A flashloan arbitrage example using money legos

JavaScript 75.70% TypeScript 24.30%

flashloan-arbitrage-money-legos's Introduction

Flashloan Example using Money Legos

In this example we will use the Money Legos Library to create a flashloan and arbitrage accross several DEXs.

Test Uniswap Exchanges

This example uses a couple of exchanges set up and maintained by @robsjr and @ggviana. The are forks of Uniswap and published on the Kovan network to help test arbitrage smart contracts like this one. The two exchanges are:

YouTube Video Tutorial

I have made a video turtorial over on the DevBootstrap YouTube channel. Enjoy and don't forget to Like!

Usage

Below are high level instructions to try out this example using the Kovan Testnet.

Setup

Rename env to '.env' and complete the missing values for your project.

Connect your truffle console to the Kovan network like so:

truffle console --network kovan

Compile / Deploy

Compile and deploy the contract to the Kovan network. From within your truffle console instance do the following:

compile
migrate --reset

Interact via Truffle Console

Interact with the contract via the truffle console:

let f = await FlashloanMoneyLego.deployed()
let assetToFlashLoan = '0xFf795577d9AC8bD7D90Ee22b6C1703490b6512FD' // DAI
let amountToLoan = web3.utils.toWei('1') // 1 'unit' of the 'assetToFlashLoan' (DAI)
Object.keys(f)
f.addressesProvider()
f.initateFlashLoan(assetToFlashLoan, amountToLoan)

Interact via Typescript app

There is a Typescript file that runs the same above arbitrage. This can be run as folllows.

Install Typescript and ts-node

npm install -g typescript
npm install -g ts-node

Now run the script as follows:

ts-node src/execFlashloanMoneyLego.ts

Verify

Confirm the transaction output in Kovan Etherscan.

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.