Git Product home page Git Product logo

poly-flash's Introduction

Poly-Flash

An open source flashloan smart contract on polygon network

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-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 for free.

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

ALCHEMY_POLYGON_RPC_URL='<your-own-alchemy-polygon-mainnet-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.

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. Compile Smart Contracts

Run the following command.

yarn compile

4. Test on Polygon Mainnet Fork ๐Ÿ”ฅ

Run the following command.

yarn test test/flashloan.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:

npx hardhat run scripts/deploy.ts --network polygon

It costs about 0.2 MATIC to deploy Flashloan contract.

Example Contract

https://polygonscan.com/address/0x0e0ec2c716b5ba2512af9d3790d8804da42ddd58

Available Scripts

In the project directory, you can run:

yarn build

Clears the cache and deletes all artifacts && Compiles the entire project, building all artifacts

yarn clean

Clears the cache and deletes all artifacts

yarn compile

Compiles the entire project, building all artifacts

npx hardhat node

Starts a JSON-RPC server on top of Hardhat Network

yarn test

Runs mocha tests

yarn coverage

Implement a code coverage for tests

yarn account

Show the list of accounts

yarn block-number

Show the current block number

yarn balance (account's address)

Show an account's balance

References

https://hardhat.org/guides/create-task.html

poly-flash's People

Contributors

yuichiroaoki avatar

Stargazers

 avatar

Forkers

getkksingh1

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.