An open source flashloan smart contract on polygon network
Run the following command.
git clone https://github.com/serenitysource/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:
yarn deploy --network polygon
It costs about 0.2 MATIC to deploy Flashloan
contract.
https://polygonscan.com/address/0x8311bcA90818330AA228DA17aA8fB7a0bBBaF97C
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