Skip to content

Commit

Permalink
updated pool address and script
Browse files Browse the repository at this point in the history
  • Loading branch information
GabiDev45 committed Aug 18, 2024
1 parent 31b667b commit 58b50c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
4 changes: 2 additions & 2 deletions constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export const factories = {
}

export const dodoV2Pool = {
// WETH_USDC: "0xAbd5Be6D160FF8E810D79ffA5AbFBc67554034fd",
WETH_USDC: "0xAbd5Be6D160FF8E810D79ffA5AbFBc67554034fd", // < $500 liquidity

This comment has been minimized.

Copy link
@FuturisticWizard

FuturisticWizard Aug 20, 2024

as i see right now 127 $ liquidity , is there no other more "rich" pools ?

This comment has been minimized.

Copy link
@FuturisticWizard

FuturisticWizard Aug 20, 2024

0x4b543E89351FaA242cb0172B2dA0cDb52Db699b4 this one pool have more liquidity

This comment has been minimized.

Copy link
@VGabriel45

VGabriel45 Aug 20, 2024

Owner

Hey @FuturisticWizard this pool won't work, it needs to be a DVM pool, need to update the smart contracts and script to either work with other types of pools or switch to other chains as Polygon pools are very limited

This comment has been minimized.

Copy link
@FuturisticWizard

FuturisticWizard Aug 21, 2024

it works on forked testnet, m'I wrong ?

// WMATIC_USDC: "0x10Dd6d8A29D489BEDE472CC1b22dc695c144c5c7",
// WMATIC_WETH: "0x80db8525F61e8C3688DBb7fFa9ABcae05Ae8a90A",
// WBTC_USDC: "0xe020008465cD72301A18b97d33D73bF44858A4b7",
// USDC_USDT: "0x813fddeccd0401c4fa73b092b074802440544e52",
USDT_USDC: "0xe4B2Dfc82977dd2DCE7E8d37895a6A8F50CbB4fB",
USDT_USDC: "0x813FddecCD0401c4Fa73B092b074802440544E52",
WETH_ULT: "0xd028e331c9a29a1B5dE87279Bf79de5ff04Fe98b",
};

Expand Down
2 changes: 2 additions & 0 deletions contracts/FlashLoan.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ contract Flashloan is IFlashloan, DodoBase, FlashloanValidation, Withdraw {
uint256 baseAmount = IDODO(params.flashLoanPool)._BASE_TOKEN_() == loanToken ? params.loanAmount : 0;
uint256 quoteAmount = IDODO(params.flashLoanPool)._BASE_TOKEN_() == loanToken ? 0 : params.loanAmount;

console.log("Amount of base token before doing the loan", baseAmount);

IDODO(params.flashLoanPool).flashLoan(
baseAmount,
quoteAmount,
Expand Down
20 changes: 5 additions & 15 deletions scripts/arbitrage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ethers } from "ethers"
import { ethers, parseEther } from "ethers"
import { Protocols, Routers, dodoV2Pool, factories } from "../constants"
import { ERC20Token } from "../constants/tokens"
import { getPriceInUSDC } from "../utils/getPriceInUSDC"
Expand Down Expand Up @@ -35,14 +35,6 @@ async function main() {

console.log("Quick Quote", quickQuote);

// const apeQuote = await getPriceInUSDC({
// router: Routers.POLYGON_APESWAP,
// factory: factories.POLYGON_APESWAP,
// tokenAddress: ERC20Token.WETH?.address,
// id: Protocols.APESWAP,
// provider
// })

const quotes = [sushiQuote, quickQuote];

const min = quotes.reduce((min, obj) => (obj.quote < min.quote) ? obj : min);
Expand All @@ -53,16 +45,16 @@ async function main() {
console.log("Biggest price difference $", ethers.formatUnits(biggestPriceDiff, 6));

// dummy check for testing (checking if price difference > 1 USDC)
if(biggestPriceDiff > 1){
if(true){
// execute arbitrage flashloan
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY!, provider);
const Flashloan = new ethers.Contract(process.env.FLASHLOAN_ADDRESS!, flashloan.abi, provider);

const params: FlashLoanParams = {
flashLoanContractAddress: Flashloan.target.toString(),
flashLoanPool: dodoV2Pool.USDT_USDC,
loanAmount: ethers.parseEther("1"),
loanAmountDecimals: 6,
flashLoanPool: dodoV2Pool.WETH_USDC,
loanAmount: parseEther("1"), // Loaning 1 WETH
loanAmountDecimals: 18,
hops: [
{
protocol: max.protocol,
Expand Down Expand Up @@ -91,9 +83,7 @@ async function main() {
}

const tx = await executeFlashloan(params);

console.log(tx.hash, "TX HASH");

}

}
Expand Down

0 comments on commit 58b50c8

Please sign in to comment.