Giter VIP home page Giter VIP logo

0x-1inch-arb-bot's Introduction

0x-1inch-arb-bot

This bot takes fresh orders from the 0x orders book using a smart contract call of 0x and looks for possible arbitrage using the 1inch smart contract function called getExpectedReturn from the nodejs bot. Then, if a profitable trade is identified, the swap is executed in a smart contract written in solidity (TradingBot.sol) and responsible for doing the swap betweeen the source token and the target token, and using a flash loan of DyDx to do so. Gas costs are taken in consideration when executing a trade, and the trade will be executed only if it is profitable.

This current version allows to look for profitable arbitrage opportunities for pairs starting as WETH token, and with any token supported by 1Inch, as a target.

For example:

WETH->DAi WETH->LINK WETH->UNI ...

Tu run the bot:

Download the git repository using git clone and do:

Copy the file TradingBot.sol in Remix and deploy the contract using Injected Web3 option to the mainnet.

The address of the contract deployed will be used in the .env file explained below.

Copy the .env.example to .env and replace the following information with your addresses:

RPC_URL="INFURA_URL"

ADDRESS="0x...YOUR_ADDRESS"

PRIVATE_KEY="0x...YOUR_PRIVATE_KEY"

CONTRACT_ADDRESS="0x...YOUR_CONTRACT_ADDRESS"

GAS_LIMIT=2000000

GAS_PRICE=150

ESTIMATED_GAS=470000

POLLING_INTERVAL=500
From the command line:

npm install

node node arbitrage-bot-0x1inch.js

If you want to add more arbitrage pairs, add these two lines after line 740 in arbitrage-bot-0x1inch.js, as many times as wanted:

console.log('WETH, UNI')
	await checkOrderBook(WETH, UNI)  

With the tokens of your choice. Check that these tokens are defined in the ASSET SYMBOLS list in the same file.

That's it!

0x-1inch-arb-bot's People

Contributors

gilles437 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.