Skip to content

In this example we will use the Money Legos Library to create a flashloan and arbitrage accross several DEXs(De-centralized Exchanges )

Notifications You must be signed in to change notification settings

PavanAnanthSharma/FlashLoan-Using-Uniswap-MoneyLegos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 

Repository files navigation

Flashloan Arbitrage Example using Money Legos


Introduction

This example demonstrates how to utilize the Money Legos Library to execute a flashloan and perform arbitrage across multiple decentralized exchanges (DEXs).


Test Uniswap Exchanges

To facilitate testing of arbitrage smart contracts, this example utilizes two Uniswap exchanges deployed on the Kovan network. These exchanges, maintained by @robsjr and @ggviana, serve as reliable testing grounds. The exchanges are:


Usage

Below are step-by-step instructions to replicate this example on the Kovan Testnet.


Setup

  1. Rename the 'env' file to '.env' and fill in the required values for your project.

  2. Connect your Truffle console to the Kovan network:

    truffle console --network kovan
    

Compile and Deploy

Compile and deploy the smart contract to the Kovan network:

compile
migrate --reset

Interact via Truffle Console

Interact with the deployed contract using 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

A Typescript file is provided to execute the same arbitrage logic:

Install Typescript and ts-node:

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

Run the script:

ts-node src/execFlashloanMoneyLego.ts

Verification

Verify the transaction output on [Kovan Etherscan].


About

In this example we will use the Money Legos Library to create a flashloan and arbitrage accross several DEXs(De-centralized Exchanges )

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published