Open yuichiroaoki opened 2 years ago
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.
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");
});
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.
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
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?
Sure. I opened an issue on that.
I don't know how this error happened, but some people got this error when they change the config.