All Projects → yuichiroaoki → poly-flashloan-bot

yuichiroaoki / poly-flashloan-bot

Licence: MIT license
Flashloan Bot on Polygon

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to poly-flashloan-bot

poly-flash
Flashloan on Polygon
Stars: ✭ 233 (+17.09%)
Mutual labels:  polygon, flashloan
uniswap-arbitrage-flash-swap
Uniswap flash swap arbitrage solidity contracts
Stars: ✭ 341 (+71.36%)
Mutual labels:  polygon, flashloan
awesome-solidity-gas-optimization
Best resources for Solidity gas optimizations ⛽
Stars: ✭ 893 (+348.74%)
Mutual labels:  polygon
OpenLoginSdk
Pluggable auth infrastructure for Web3 wallets and dapps
Stars: ✭ 108 (-45.73%)
Mutual labels:  polygon
polygon-etl
ETL (extract, transform and load) tools for ingesting Polygon blockchain data to Google BigQuery and Pub/Sub
Stars: ✭ 53 (-73.37%)
Mutual labels:  polygon
geopip
Reverse geocode a lng/lat coordinate within a geojson `FeatureCollection` and return information about the containing country (polygon).
Stars: ✭ 27 (-86.43%)
Mutual labels:  polygon
martinez-src
Mirrored implementations of polygon clipping/CSG/operations algorithm, in C (original, by Martínez et al) and ActionScript3 (port, by Mahir Iqbal)
Stars: ✭ 34 (-82.91%)
Mutual labels:  polygon
pyscissor
✂️ calculate polygon mask for netCDF/GRIB/raster
Stars: ✭ 14 (-92.96%)
Mutual labels:  polygon
kotal
Blockchain Kubernetes Operator
Stars: ✭ 137 (-31.16%)
Mutual labels:  polygon
EsriRESTScraper
A Python class that scrapes ESRI Rest Endpoints and exports data to a geodatabase
Stars: ✭ 43 (-78.39%)
Mutual labels:  polygon
PolygonOps.jl
Generic Polygon Operations
Stars: ✭ 19 (-90.45%)
Mutual labels:  polygon
idex-sdk-js
IDEX v3 SDK built with TypeScript, supporting both web and Node environments.
Stars: ✭ 35 (-82.41%)
Mutual labels:  polygon
envelope ex
Utilities for calculating and comparing envelopes from geometries
Stars: ✭ 15 (-92.46%)
Mutual labels:  polygon
osm-static-maps
Openstreetmap static maps is a nodejs lib, CLI and server open source inspired on google static map service
Stars: ✭ 130 (-34.67%)
Mutual labels:  polygon
nft-collection-scaffold
Production-ready code for an NFT Collection sale and minting on Ethereum, Polygon, Arbitrum or Binance Smart Chain
Stars: ✭ 53 (-73.37%)
Mutual labels:  polygon
Rabby
The game-changing wallet for Ethereum and all EVM chains
Stars: ✭ 562 (+182.41%)
Mutual labels:  polygon
Bogged-Token-List
Multichain token lists by Bogged Finance
Stars: ✭ 106 (-46.73%)
Mutual labels:  polygon
leaflet-paintpolygon
Leaflet plugin to create polygon with circle as paint
Stars: ✭ 38 (-80.9%)
Mutual labels:  polygon
PolyDraw
✳️ PTSource PolyDraw is a free 3D polygonal modeller for Windows x86 and x64, for creating or modifying 3D objects using a mesh of 3D points and parametric NURBS Curves .Exports and imports to over 40 formats including WebVR and 3D Printing.
Stars: ✭ 17 (-91.46%)
Mutual labels:  polygon
origami
Origami Building in threejs
Stars: ✭ 29 (-85.43%)
Mutual labels:  polygon

Poly Flashloan Bot

test

An open source flashloan bot on polygon network

Documentation

Note: This bot just demonstrates how you can run a flashloan bot on polygon and is not designed to make profits (Reasons why my flashloan bot didn't work).

Prerequisites

This flashloan bot works with the smart contract.

You need to deploy your own smart contract on polygon mainnet if you want to run this bot.

Installation

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

2. Clone This Repo

Run the following command.

$ git clone https://github.com/yuichiroaoki/poly-flashloan-bot.git
$ cd poly-flashloan-bot

Quickstart

1. Setup Environment Variables

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

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

ALCHEMY_POLYGON_RPC_URL='<your-own-alchemy-polygon-mainnet-rpc-url>'

If you want to execute flashloan on the polygon mainnet, you need to add your PRIVATE_KEY environment variable as well, with a private key from your wallet.

PRIVATE_KEY='your-PRIVATE_KEY'

*Note: If using metamask, you'll have to add a 0x to the start of your private key)

2. Install Dependencies

Run the following command.

yarn install

3.Build

yarn build

4. Run Bot

yarn start

Configuration

Edit src/config.ts

Optimal Bot Configuration

If you have deployed your own contract, replace flashloan address to your deployed smart contract address.

export const flashloanAddress = "<your-deployed-contract-address>";

Note: If you update the flashloan smart contract, you need to replace this ABI to the new one.

ABI

This flashloan bot uses an ABI from this flashloan smart contract.

If you update the flashloan smart contract, you need to replace this ABI to the new one.

Docker

source startup.sh

All supported liquidity protocols

curl -X GET "https://api.1inch.exchange/v3.0/137/protocols" -H  "accept: application/json"
curl -X GET "https://api.1inch.exchange/v4.0/137/liquidity-sources" -H  "accept: application/json"
{
  "protocols": [
    "POLYGON_SAFE_SWAP",
    "POLYGON_APESWAP",
    "IRONSWAP",
    "POLYGON_JETSWAP",
    "POLYGON_DODO",
    "POLYGON_DODO_V2",
    "POLYGON_KYBER_DMM",
    "POLYGON_BALANCER_V2",
    "POLYGON_WAULTSWAP",
    "DFYN",
    "POLYGON_ONE_INCH_LIMIT_ORDER",
    "POLYDEX_FINANCE",
    "ONESWAP",
    "FIREBIRD_FINANCE",
    "POLYGON_MSTABLE",
    "POLYGON_SUSHISWAP",
    "POLYGON_QUICKSWAP",
    "WMATIC",
    "POLYGON_CURVE",
    "POLYGON_AAVE_V2",
    "COMETH",
    "POLYGON_DFX_FINANCE",
    "POLYGON_CURVE_V2"
  ]
}

All supported tokens

curl -X GET "https://api.1inch.exchange/v3.0/137/tokens" -H  "accept: application/json"
curl -X GET "https://api.1inch.exchange/v4.0/137/tokens" -H  "accept: application/json"

Debug transactions

ts-node src/debug.ts 0xc3ec5defe7b6b8a5e4a4f083b5d67110637f3074c84a4808c607cca1f544daa8
{
  hash: '0xc3ec5defe7b6b8a5e4a4f083b5d67110637f3074c84a4808c607cca1f544daa8',
  from: '0x4d844504470f7E43740af80BD5462022F69FeFB0',
  to: '0xe43A0003955f8745c77A2A987Afa316D6B9828B3',
  gasPrice: 30000000000,
  gasLimit: 15000000,
  nonce: 46,
  blockNumber: 22593589
}
{
  name: 'dodoFlashLoan',
  params: {
    flashLoanPool: 'USDC_DAI',
    loanAmount: 10000000000,
    firstRoutes: [
      'POLYGON_QUICKSWAP: DAI → WETH',
      'POLYGON_APESWAP: WETH → MATIC',
      'POLYGON_QUICKSWAP: MATIC → USDT'
    ],
    secondRoutes: [
      'POLYGON_SUSHISWAP: USDT → WETH',
      'POLYGON_QUICKSWAP: WETH → MATIC',
      'POLYGON_APESWAP: MATIC → DAI'
    ]
  }
}
0xc3ec5defe7b6b8a5e4a4f083b5d67110637f3074c84a4808c607cca1f544daa8

MATIC: eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
USDT: c2132d05d31c914a87c6611c10748aeb04b58e8f
WETH: 7ceb23fd6bc0add59e62ac25578270cff1b9f619
DAI: 8f3cf7ad23cd3cadbd9735aff958023239c6a063

USDC_DAI: aaE10Fa31E73287687ce56eC90f81A800361B898

firstRoutes
POLYGON_QUICKSWAP: a5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff DAI
POLYGON_APESWAP: C0788A3aD43d79aa53B09c2EaCc313A787d1d607
POLYGON_QUICKSWAP: a5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff

secondRoutes
POLYGON_SUSHISWAP: 1b02dA8Cb0d097eB8D57A175b88c7D8b47997506
POLYGON_QUICKSWAP: a5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff
POLYGON_APESWAP: C0788A3aD43d79aa53B09c2EaCc313A787d1d607

b27f6a250000000000000000000000000000000000000000000000000000000000000020000000000000000000000000aae10fa31e73287687ce56ec90f81a800361b89800000000000000000000000000000000000000000000000000000002540be400000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000a5e0829caced8ffdd4de3c43696c57f7d7a678ff00000000000000000000000000000000000000000000000000000000000000020000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0630000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000000000000000000000000000000000000000000040000000000000000000000000c0788a3ad43d79aa53b09c2eacc313a787d1d60700000000000000000000000000000000000000000000000000000000000000020000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000a5e0829caced8ffdd4de3c43696c57f7d7a678ff0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f00000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000400000000000000000000000001b02da8cb0d097eb8d57a175b88c7d8b479975060000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000000000000000000000000000000000000000000040000000000000000000000000a5e0829caced8ffdd4de3c43696c57f7d7a678ff00000000000000000000000000000000000000000000000000000000000000020000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000c0788a3ad43d79aa53b09c2eacc313a787d1d6070000000000000000000000000000000000000000000000000000000000000002000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a063

References

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].