Arbitrage bot for Avalanche DEXes - Trader Joe, Sushiswap, Pangolin
Proof of successful arbitrage on Fuji: https://testnet.snowtrace.io/tx/0xcc89201cbe0b0345f85ffa4ba26c4fcab4ea4bda4559323fc76be2cf2fdf0fff - 0.0196 wavax gain, 0.0083 avax tx cost
- Create .env with wallet mnemonic (see .env.example)
- Edit scripts/constants.ts - add TOKENX = 'tokenx' to Tokens enum
- Edit hardhat.config.ts - add tokenx with address for the token, tokenxChainLink (tokenx must correspond to value for TOKENX from Tokens enum in previous step) for chainlink address (if existing)
- Create arbitrage script in scripts/arb/tokenx-whatever (copy from other scripts in parent folders)
- Add
npx hardhat run
script to package.json for the script created in previous step - Profit
- Edit hardhat.config.ts - add addresses for CoolDex factory, CoolDex router
- Create contract for flashswapping from CoolDex in contracts/
- Edit scripts/constants.ts - edit enum DEX, FlashSwapContractNames, FactoryNamedAccounts, RouterNamedAccounts
- Create deploy script in deploy/ for any combination of flashswap contract between CoolDex and other Dex (copy from other scripts in the folder)
- Run
yarn deploy --network fuji/mainnet
to deploy flashswap contracts to fuji or c-chain mainnet - Edit hardhat.config.ts - add addresses for flashswap contracts deployed in previous step. Must be in the format
flashSwap<DEX1><DEX2>
where<DEX1>
and<DEX2>
are values for Dex1 and Dex2 from DEX enum in scripts/constants.ts - Create arbitrage script in scripts/arb/ in whatever tokens combinations folders you want (copy from other scripts in parent folders)
- Add
npx hardhat run
script to package.json for the script created in previous step - Profit