Git Product home page Git Product logo

Comments (4)

trancee avatar trancee commented on May 25, 2024

Do you know what config was changed? Because I am not sure about that. But what I did is to make sure the arbitrage opportunity is higher before executing the transaction. I guess that the opportunity is changing quite quickly and while the transaction is running, the opportunity was already lost because it was too slow to execute.

from poly-flashloan-bot.

yuichiroaoki avatar yuichiroaoki commented on May 25, 2024

I thought this error happened when you fail to borrow a loan token from dodo.

it("should be reverted with `INSUFFICIENT_INPUT_AMOUNT` when the bot set a wrong dodo pool and the contract can't borrow tokens.", async () => {
	await expect(
		Flashloan.dodoFlashLoan({
			flashLoanPool: dodoV2Pool.WMATIC_USDT,
			loanAmount: getBigNumber(1, 6),
			firstRoutes: [{
				path: [erc20Address.USDC, erc20Address.DAI],
				router: uniswapRouter.quickswap,
			}],
			secondRoutes: [{
				path: [erc20Address.DAI, erc20Address.USDC],
				router: uniswapRouter.quickswap
			}],
		}, { gasLimit: 1000000 })
	).to.be.revertedWith("UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT");
});

https://github.com/yuichiroaoki/poly-flash/blob/6d29dac77bedf2871eda23ab875b9f4843a993ab/test/errorMsg.test.ts#L37-L53

In this scenario, the contract will try to borrow USDC, but it can't borrow USDC from dodoV2Pool.WMATIC_USDT.
The contract checks if the loan token is a base token of the dodo pool, and if not it borrow a quote token of the pool, so the contract would borrow USDT (quote token of dodoV2Pool.WMATIC_USDT).

I should have checked if the quote token is the loan token as well.

https://github.com/yuichiroaoki/poly-flash/blob/6d29dac77bedf2871eda23ab875b9f4843a993ab/contracts/Flashloan.sol#L51-L66

But it could be a different reason, I'm just guessing.

I will update the contract to check the dodo pool before executing flashloan and to make it clear.

ref.
https://docs.uniswap.org/protocol/concepts/V3-overview/swaps#safety-checks
https://ethereum.stackexchange.com/questions/90241/why-insufficient-output-amount

from poly-flashloan-bot.

trancee avatar trancee commented on May 25, 2024

Thank you for looking into this issue. What you have tested is the INPUT amount, but my issue was about the OUTPUT amount. Can you make sure both are tested?

from poly-flashloan-bot.

yuichiroaoki avatar yuichiroaoki commented on May 25, 2024

Sure. I opened an issue on that.

yuichiroaoki/poly-flash#4

from poly-flashloan-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.