https://github.com/yuichiroaoki/poly-flash
Flashloan on Polygon
https://github.com/yuichiroaoki/poly-flash
blockchain bsc dodo ethereum flashloan matic mev polygon solidity typescript
Last synced: 17 days ago
JSON representation
Flashloan on Polygon
- Host: GitHub
- URL: https://github.com/yuichiroaoki/poly-flash
- Owner: yuichiroaoki
- License: mit
- Created: 2021-11-20T23:55:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-18T02:53:00.000Z (over 2 years ago)
- Last Synced: 2025-03-29T19:05:58.641Z (24 days ago)
- Topics: blockchain, bsc, dodo, ethereum, flashloan, matic, mev, polygon, solidity, typescript
- Language: Solidity
- Homepage: https://yuichiroaoki.medium.com/no-flashloan-fee-with-dodo-cc78215d7f93
- Size: 2.51 MB
- Stars: 300
- Watchers: 22
- Forks: 175
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Poly-Flash

An open source flashloan smart contract on polygon network
## Installation
### 1. Install [Node.js](https://nodejs.org/en/) & [yarn](https://classic.yarnpkg.com/en/docs/install/#windows-stable), if you haven't already.
### 2. Clone This Repo
Run the following command.
```bash
git clone https://github.com/yuichiroaoki/poly-flash.git
cd poly-flash
```## Quickstart
### 1. Setup Environment Variables
You'll need an `ALCHEMY_POLYGON_RPC_URL` environment variable. You can get one from [Alchemy website](https://alchemy.com/?r=33851811-6ecf-40c3-a36d-d0452dda8634) for free.
Then, you can create a .env file with the following.
```
ALCHEMY_POLYGON_RPC_URL=''
```#### Add your Private Key
If you want to execute flashloan on the polygon mainnet, you need to add your `PRIVATE_KEY` environment variable, [with a private key from your wallet](https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key).
```
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.
```bash
yarn install
```### 3. Compile Smart Contracts
Run the following command.
```bash
yarn compile
```### 4. Test on Polygon Mainnet Fork 🔥
Run the following command.
```bash
yarn test test/polygon/dodoflash.test.ts
```## Deploy
Once you have successfully done the above quickstart and added your private key to .env file, you can deploy your smart contract with the following command:
```bash
yarn deploy --network polygon
```It costs about 0.2 MATIC to deploy `Flashloan` contract.
## Example Contract
https://polygonscan.com/address/0xb6c4448386c4ecf4e5eab057351f8a6a8a465a0d
## Liquidations
Deploy on the polygon mainnnet fork with the following command:
```bash
yarn liquidations
```Deploy on the polygon mainnnet with the following command:
```bash
yarn liquidations --network polygon
```