An open source flashloan smart contract on polygon network
Run the following command.
git clone https://github.com/yuichiroaoki/poly-flash.git
cd poly-flash
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, 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)
Run the following command.
yarn install
Run the following command.
yarn compile
Run the following command.
yarn test test/flashloan.test.ts
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.
https://polygonscan.com/address/0x0e0ec2c716b5ba2512af9d3790d8804da42ddd58
In the project directory, you can run:
Clears the cache and deletes all artifacts && Compiles the entire project, building all artifacts
Clears the cache and deletes all artifacts
Compiles the entire project, building all artifacts
Starts a JSON-RPC server on top of Hardhat Network
Runs mocha tests
Implement a code coverage for tests
Show the list of accounts
Show the current block number
Show an account's balance